cancel
Showing results for 
Search instead for 
Did you mean: 

Generate 2MHz SAI Clock for PDM Microphone Using STM32G473VET6

IOT_Dev
Associate

Dear ST Community member,

I hope you all are doing well.

We are using STM32G473VET6 and IMP34DT05TR for Audio acquisition. The PDM Microphone needs a 2 MHz clock signal to operate properly. However, we are getting an error after configuring PLLQ at 2 MHz for SAI. Please let us know how to fix it. Thanks!

IOT_Dev_0-1736142424955.png

 

best regards,

Neeraj

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Peter BENSCH
ST Employee

This will not work with your settings:

  • You have set the divider for PLLM to /16, which results in only 1.5MHz at 24MHz. However, CubeMX points out that PLLM must be between 2.66-16MHz.
  • You have set the factor for PLL *N to x8, which results in 12MHz for you, but must be between 96-344MHz.
  • You have set the divider PLL /Q to /6, which would generate your desired 2MHz (that you think you have to create) from 12MHz, but here too CubeMX points out that PLLQ must be between 8-170MHz. However, the generated SAI frequency is not the one that is output at the clock pin, but the one that clocks as sai_x_ker_ck the SAI block.

If you solve the clock configuration problem in STM32CubeMX, this results in a PLLQ of 24MHz (PLLM=/2, PLLQ=x8/4), which you can easily divide to 2MHz with the MCKDIV contained in the SAI (RM0440, section 40.4.8). Your IOC contains a value of 11 for MCKDIV, which you only need to set to 12 at mentioned 24MHz.

You should also take the opportunity to upgrade to the new version of STM32CubeMX.

Regards
/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

View solution in original post

4 REPLIES 4
Peter BENSCH
ST Employee

Welcome @IOT_Dev, to the community!

Please post your IOC so that people can try to understand it.

Regards
/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
IOT_Dev
Associate

Hi Peter,

Thanks for your response.

Please find the attached IOC.

best regards

Neeraj

Peter BENSCH
ST Employee

This will not work with your settings:

  • You have set the divider for PLLM to /16, which results in only 1.5MHz at 24MHz. However, CubeMX points out that PLLM must be between 2.66-16MHz.
  • You have set the factor for PLL *N to x8, which results in 12MHz for you, but must be between 96-344MHz.
  • You have set the divider PLL /Q to /6, which would generate your desired 2MHz (that you think you have to create) from 12MHz, but here too CubeMX points out that PLLQ must be between 8-170MHz. However, the generated SAI frequency is not the one that is output at the clock pin, but the one that clocks as sai_x_ker_ck the SAI block.

If you solve the clock configuration problem in STM32CubeMX, this results in a PLLQ of 24MHz (PLLM=/2, PLLQ=x8/4), which you can easily divide to 2MHz with the MCKDIV contained in the SAI (RM0440, section 40.4.8). Your IOC contains a value of 11 for MCKDIV, which you only need to set to 12 at mentioned 24MHz.

You should also take the opportunity to upgrade to the new version of STM32CubeMX.

Regards
/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
IOT_Dev
Associate

Hi Peter,

Thanks for your reply.

Is the parameter setting correct for 2 microphones in stereo mode?

regards,

Neeraj