cancel
Showing results for 
Search instead for 
Did you mean: 

How can I set the right parameters for the SAI using PDM interface?

Diego93
Associate

Hi, i'm using the STM32WB5MM-DK borad and i encountered some problems about acquiring data from the SAI using the PDM interface.

On my board is mounted the IMP34DT05 microphone which requires a clock frequency between 1.2MHz and 3.25MHz to work. I can generate a 2 MHz clock signal from the SAI and the microphone outputs the data correctly (I'm sure of this because I can the data with the oscilloscope).

The problem is that I need to generate a 2MHz clock signal in order to let the microhone work but, to do that, I violate the constraints written in the datasheet of the STM32 in the SAI paragraph.
I set the frame lenght = 256 bits but in the datasheet it is written that, using 1 or 2 microphones, the frame lenght must be 16 bits following the formula FRL = ( 16 * MICNBR + 1) - 1, where MICNBR is 0 in my case (1-2 microphones).

I also tried to implement the example that is written in the global manual (see the highlighted row of the table in attached image).
When I used 16 bits frame, 2 slots of 8 bits with sampling frequency 16 KHz and the clock signal to the SAI which minimize the sampling frequency error (= 0.05%), I expected to see on my oscilloscope SAI_CK = 1.024MHz but i see 128 KHz.

Diego93_0-1698043843139.png

I really don't understand how to find the right balance between the needed frequency for the microphone and the constraints for the SAI.

In other words the problem is that I can't send the right clock signal to the microphone and have the right frame size simoultaneously.
I read the STM32 global manual for the SAI interface.
I read the IMP34DT05 datasheet for the microphone.
I read examples on the internet (ST Forum, ST examples and github examples).

Is there any other documentation?
Have you ever had the same problem?
The IMP34DT025 microphone is 8 bits or 16 bits frame?
How can I correctly set the paramter of the SAI interface and generate the needed 2 MHz clock signal?

I also noticed that in the STM32WB5MM-DK demo board datasheet is written that the micrphone is connected to SAI1_CK2 and SAI1_D2 pins but in the CubeMX when I set the SAI into PDM mode using CK2 with 1-2 microphones, it sets the data pin as SAI1_D1. Is it an error? When I select 3-4 microphone it set both D1 and D2 as data pins. I really don't understand, how can I set the right SAI parameters for this microphone?

Thank you.

1 REPLY 1
TZiel.1
Associate II

Me too.