cancel
Showing results for 
Search instead for 
Did you mean: 

Hello experts , I have a query on how to acquire a PCM audio 2000 to 4000 samples nearly from a PDM out conversion of a MEMS mic and display them on UART/USART for every 2 or 5 seconds? Can any expert help me with a coding part. Thanks in advance

SG.4
Associate II

MEMS mic -ICS43432+ STM32f4xx nucleo board.

i have given a 168MHz HSE clock configuration and used a PDM2PCM middleware too with a 32KHz audio frequency with I2S in master receive mode. and DMA in SPI2_RX DMA1 Stream 3, in the STM32Cube MX.

The oscilloscope shows a PDM out generation at a clock of 1.02MHz and I have referred the user manual too of both board and mic. I guess till this portion its correct. I am stuck at the part of PCM samples displaying on the UART?

4 REPLIES 4
Ozone
Lead II

I don't do Cube ...

First, check if the UART output can keep up with the sampling rate. A 32kHz/12 bit ADC signal produces a 1.6 MBit/s UART output, assuming 5 characters per value.

The UART could be fed by DMA, which is less problematic for transmission.

In my experience, bitrates above 0.5 MBit are unrealistic for external connections.

Consider offline transmission, or reduced data rate.

> Hello ST experts , ...

ST staff is only ocasionally around here, this forum is mostly user-driven.

SG.4
Associate II

Hi @Ozone​ ,

Thank you for the reply I have used DMA too, I dint mention it now thats is corrected.

I am stuck at a point in the PCM conversion for 4k to 5k samples to determine the noise levels in dB SPL later .

..

>> ST experts could be anyone working on these , so I meant that way,not the staff in particular.

Appreciate your suggestion and thanks again.

To be honest, I don't have experience with MEMS microphones and I2S.

I used to go for the internal ADC with my audio-related applications.

> I am stuck at a point in the PCM conversion for 4k to 5k samples to determine the noise levels in dB SPL later .

The datasheet says 24 bit per channel, MSB first.

Since you are supposedly use DMA, you might need to unpack the data, since 3-byte items will give you quite a performance penalty.

I used to convert ADC values from the DMA TC interrupt on the fly, usually to float for a following FFT routine.

Not sure about accuracy requirements for your calculations (like SNR), but float (single precision) might not be appropriate.

SG.4
Associate II

Hi @Ozone​ ,

Thank you for the reply and your suggestion.