This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRFX based PDM to PCM implementation (I2S example)

Hello,

I am currently interfacing my nRF52840 DK with i2S based MP34DT05 sensor. I am using nrfx i2s driver's for interfacing with sensor. I am using master clk of 2MHz, LCLK 16KHZ. 

My sensor output PDM data. In my project I am recording audio samples on left channel, so I am currently getting 2*16bit of left data per 32bits as shown in nrf docs. I have got 16bit recorded samples in buffer, but to how to convert this pdm data in pcm format. 

Normally we need to divide the PDM data with a decimation factor, but in I2S we already are dividing the bit sampling rate with ratio value. So is the output from the I2S itself is decimated PCM ?  

Or can anyone give a example of how to convert the PDM to PCM data. Any sort of help is dually appreciated. 

Parents
No Data
Reply
  • Note: Kindly read my previous reply for terminal output reference.

    Okay i found out the possible bug. 

    When i connect logic analyzer pin directly to Sensor data out pin it gives me 1.2MHz PDM data output as expected. 

    Now i have connected my sensor DOUT pin to nRF52840 DK DIN pin (P1.05) using the socket connector available on board.  Now when i connect my analyzer pin on nRF52840 DK (P1.05) using the through hole that's provided besides PL15 connector, i only get DIN frequency of 15-16KHz, shouldn't it be the same as 1.2MHz as output-ed by PDM sensor.

    As per my observation, it should be 1.2MHz available using through hole connector too, because i am  getting CLK signal of  1.2MHz from through hole pin (P1.04) too. 

    So how does a 1.2MHz signal PDM signal (measured from Senor DOUT pin directly) gets converted into 16KHz signal after reaching board (measured at DIN pin via. through hole) ?

    Below i have attached Logic Analyzer output for your reference :

    Analyzer data Read from Sensor:

    Analyzer data Read from board:

    Is it the right behavior ? As per me NO, because at DIN pin we should  get 1.2MHz PDM signal, from there PDM peripheral takes input and all that decimation and filtering happens.

    So what can be the issue here now ? Sensor is working properly at least as it output frequency is same as PDM CLK. Please let me know what should i check or what are the possibility i can try. 

Children
  • Thanks for the Logic analyzer traces!

    The logic analyzer trace from the sensor directly looks to be more in range of the expected frequency, but it's hard to say if it's good or not just by looking at this snippet. Did you try running the python script on this measurement?

    It's possible that the issue is electrical. What does your test setup look like? Are you powering the sensor from one of the nRF52840-DK headers, or is there a separate supply? Are there other components connected to the CLK or DIN lines?

    I would recommend connecting the CLK signal to the sensor, but keep the DIN line to nRF52840 disconnected. This way you can measure the data output on the sensor again, without getting potential interference from the nRF52840-DK. For example if the nRF52840 is configured with a pull resistor on P1.05, this could influence the signal level.

Related