pdm interfcae with nrf5340 and live data transfer

Hello, I am using a NRF5340 with an IM69D120 mic. I want to record the audio and send it while recording.  

Majorly, I want to know: how should i configure my pdm clock to achieve this? How should I add my gain to it?

What should the connection speed be?currently mic is working at 1280khz frequency but audio seems to distorted?
How can I calculate the decimation ratio? ie., for 8 kHz sampling
 
How is the PDM clock genrated in the below calculation?

how can i set NRF_PDM0->PDMCLKCTRL  &  NRF_PDM0?

1280K

0x0A000000

PDM_CLK = 32 MHz / 25 = 1.280 MHz. Nominal clock for RATIO=Ratio80.

     // set 1280kHz frequency
    NRF_PDM0->PDMCLKCTRL = 0x0A000000;
    // set factor of 80 to get 16kHz sampling frequency
    NRF_PDM0->RATIO = 1

regards,

Manilkandan V

Parents
  • Hello Manilkandan V,

    How is the PDM clock genrated in the below calculation?

    In that example it is using the 32 MHz crystal for the clock source.

         // set 1280kHz frequency
        NRF_PDM0->PDMCLKCTRL = 0x0A000000;
        // set factor of 80 to get 16kHz sampling frequency
        NRF_PDM0->RATIO = 1

    I notice that you are writing to the registers directly here, is this a requirement for your application or could it be an alternative to use the nrfx pdm driver instead? I would recommend using the driver over the register manipulation approach.

    currently mic is working at 1280khz frequency but audio seems to distorted?

    Could you describe this distortion - is it a constant noise, like a filter or offset, an intermitting distortion, or audiable artifacts like clicks and pops?


    Best regards,
    Karl

Reply
  • Hello Manilkandan V,

    How is the PDM clock genrated in the below calculation?

    In that example it is using the 32 MHz crystal for the clock source.

         // set 1280kHz frequency
        NRF_PDM0->PDMCLKCTRL = 0x0A000000;
        // set factor of 80 to get 16kHz sampling frequency
        NRF_PDM0->RATIO = 1

    I notice that you are writing to the registers directly here, is this a requirement for your application or could it be an alternative to use the nrfx pdm driver instead? I would recommend using the driver over the register manipulation approach.

    currently mic is working at 1280khz frequency but audio seems to distorted?

    Could you describe this distortion - is it a constant noise, like a filter or offset, an intermitting distortion, or audiable artifacts like clicks and pops?


    Best regards,
    Karl

Children
  • Hi, thanks for your reply.

    Our requirement is a 512 kHz clock with a sampling frequency of 4 kHz and a decimination ratio of 128.

    1) Is it possible to set the NRF_PDM0->PDMCLKCTRL register to 512 KHZ? If yes, what would be the NRF_PDM0->PDMCLKCTRL register value? And how are we calculating it?

    2)I have seen this document: https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf5340%2Fpdm.html Only ratio 40 and 80 were used. Is this the only possible decimination ratio that can be used? If not, how can I set the ratio in this register, NRF_PDM0->RATIO? ie:128

    3)I have attached distorted audio file kindly check.

    Regards,

    Manikandan V

  • Hello,

    Let us continue this discussion in your other open ticket on the matter so as to not duplicate the questions and information.

    Best regards,
    Karl

Related