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
  • Starting Init␍␍␊
    
    [16:16:09:939] Starting recording samples␍␍␊
    
    [16:16:10:179] Got Slab␍␍␊
    
    [16:16:10:181] 0, 0, 0, -4, -24, 606, 562, 1189, 1145, 1769, 1707, 2984, 2268, 3583, 2219, 4206, 2150, 5442, 2697, 6691, 1973, 7984, 1234, 9907, 458, 12495, -1641, 16438, -5768, 24390, -17583, 32746, -32768, -32768, -32768, -32768, -32766, -32758, -32750, -32742, -32734, -32726, -32718, -32710, -32702, -32694, -32686, -32678, -32670, -32662, -32654, -32646, -32638, -32631, -32623, -32615, -32607, -32599, -32591, -32583, -32575, -32567, -32559, -32551, -32543, -32535, -32527, -32519, -32511, -32503, -32495, -32487, -32479, -32472, -32464, -32456, -32448, -32440, -32432, -32424, -32416, -32408, -32400, -32392, -32384, -32377, -32369, -32361, -32353, -32345, -32337, -32329, -32321, -32313, -32305, -32298, -32290, -32282, -32274, -32266, -32258, -32250, -32242, -32235, -32227, -32219, -32211, -32203, -32195, -32187, -32180, -32172, -32164, -32156, -32148, -32140, -32132, -32125, -32117, -32109, -32101, -32093, -32085, -32078, -32070, -32062, -32054, -32046, -32038, -32031, -32023, -32015, -32007, -31999, -31992, -31984, -31976, -31968, -31960, -31952, -31945, -31937, -31929, -31921, -31913, -31906, -31898, -31890, -31882, -31875, -31867, -31859, -31851, -31843, -31836, -31828, -31820, -31812, -31805, -31797, -31789, -31781, -31774, -31766, -31758, -31750, -31743, -31735, -31727, -31719, -31712, -31704, -31696, -31688, -31681, -31673, -31665, -31657, -31650, -31642, -31634, -31626, -31619, 32767, -13646, 26467, -2448, 18951, 1751, 15585, 3988, 13017, 4789, 11185, 5140, 9947, 6185, 8651, 5155, 6603, 4556, 5942, 4786, 5563,

    After printing this much it gives me USB port error and if I start debugging after commenting out USB Init, it goes into fault state as mentioned in previous post after 3-4 iterations.

    And  if comment out printing data on terminal in the while loop, it gives proper ideal output.

    ] Starting recording samples␍␍␊
    [16:24:09:887] Got Slab␍␍␊
    [16:24:09:890] Released slab␍␍␊
    [16:24:09:896] ␍␍␊
    [16:24:10:137] Got Slab␍␍␊
    [16:24:10:139] Released slab␍␍␊
    [16:24:10:147] ␍␍␊
    [16:24:10:387] Got Slab␍␍␊
    [16:24:10:389] Released slab␍␍␊
    [16:24:10:395] ␍␍␊
    [16:24:10:637] Got Slab␍␍␊
    [16:24:10:639] Released slab␍␍␊
    [16:24:10:648] ␍␍␊
    [16:24:10:887] Got Slab␍␍␊
    [16:24:10:896] Released slab␍␍␊
    [16:24:10:896] ␍␍␊
    [16:24:11:137] Got Slab␍␍␊
    [16:24:11:143] Released slab␍␍␊
    [16:24:11:143] ␍␍␊
    [16:24:11:387] Got Slab␍␍␊
    [16:24:11:393] Released slab␍␍␊
    [16:24:11:393] ␍␍␊
    [16:24:11:637] Got Slab␍␍␊
    [16:24:11:643] Released slab␍␍␊
    [16:24:11:643] ␍␍␊
    [16:24:11:888] Got Slab␍␍␊
    [16:24:11:889] Released slab␍␍␊
    [16:24:11:895] ␍␍␊
    [16:24:12:138] Got Slab␍␍␊
    [16:24:12:139] Released slab␍␍␊
    [16:24:12:145] ␍␍␊
    [16:24:12:388] Got Slab␍␍␊
    [16:24:12:394] Released slab␍␍␊
    [16:24:12:394] ␍␍␊
    [16:24:12:638] Got Slab␍␍␊
    [16:24:12:645] Released slab␍␍␊
    [16:24:12:645] ␍␍␊
    [16:24:12:888] Got Slab␍␍␊
    [16:24:12:895] Released slab␍␍␊
    [16:24:12:895] ␍␍␊
    [16:24:13:137] Got Slab␍␍␊
    [16:24:13:142] Released slab␍␍␊
    [16:24:13:142] ␍␍␊
    [16:24:13:387] Got Slab␍␍␊
    [16:24:13:393] Released slab␍␍␊
    [16:24:13:393] ␍␍␊
    [16:24:13:638] Got Slab␍␍␊
    [16:24:13:645] Released slab␍␍␊
    [16:24:13:645] ␍␍␊
    [16:24:13:887] Got Slab␍␍␊
    [16:24:13:894] Released slab␍␍␊
    [16:24:13:894] ␍␍␊
    [16:24:14:137] Got Slab␍␍␊
    [16:24:14:144] Released slab␍␍␊
    [16:24:14:144] ␍␍␊
    [16:24:14:387] Got Slab␍␍␊
    [16:24:14:389] Released slab␍␍␊
    [16:24:14:393] ␍␍␊

    So now what could be the issue here ?

Children
Related