cancel
Showing results for 
Search instead for 
Did you mean: 

SAI configuration for 2 PDM Microphone in Stereo Mode

IOT_Dev
Associate II

Dear ST Community Member,

 

I hope you are all doing well.

 

We are currently acquiring audio using the STM32G4 and 2 PDM microphones in stereo mode. I would like to know how to split the left and right channel data. Could you please provide me with the appropriate SAI settings? Thank you!

 

Best regards,  

Neeraj

2 REPLIES 2
Emmanuel_C
ST Employee

Hi,

One channel data is acquired on the rising edge of the clock, the other channel is acquired on the falling edge.

There is an input signal on microphones, usually set to ground or vdd, to tell if the microphone sends data on the rising edge of the clock or the falling edge.

There are more information about this topic in the series of video there: https://www.youtube.com/watch?v=_YQSJJQUp-g

best regards,

Emmanuel

In stereo mode you would get an interleaved buffer: left PDM word followed by a right PDM word.
Even after converting PDM into PCM - still an interleaved buffer (like for I2S).

If you want to split the "stereo buffer" into two separate single channel buffers - you have to split by SW, e.g. via C-code running over the buffer or using a Mem-to-Mem DMA (as a "vector DMA": skipping the other channel values).