cancel
Showing results for 
Search instead for 
Did you mean: 

Where can I get details on how to generate SAI clocks?

sjalloq
Associate

I'm using an STM32F76x series and am trying to find the relevant information on the clock generation capabilities of the audio PLL.

The datasheet is pretty blank and the reference manual describes the SAI clock generator but not how to generate the incoming sai_x_ker_ck.

Is it possible to generate audio clocks internally and what are the limitations in terms of matching the standard audio sampling rates?

Where is the detail on how to implement external 44.1/48K master clocks and how to switch between them?

2 REPLIES 2

The RM is not exactly clear in this, but the sai_x_ker_ck is the clock coming from RCC:

0690X000006CO1VQAW.png

You have a selection of clocks related to system clock, outputs from two PLLs and an external input pin, at your disposal. This is the master clock, which you can then divide at your will in the SAI module itself; read thoroughly the SAI chapter.

You may want to read my SAI-clock related rants, e.g. https://community.st.com/s/question/0D50X00009XkaBlSAJ/f446-documentation-sai-clock-generator

JW

Piranha
Chief II

As the other guy says, sai_x_ker_ck is SAI's audio clock. These are selected by RCC_DCKCFGR1 bit groups SAI1SEL and SAI2SEL. You can find some useful additional information in SAI presentation here:

https://www.st.com/content/st_com/en/support/learning/stm32-education/stm32f7-online-training.html

Yes, it's possible to generate audio clocks internally with PLLSAI and PLLI2S. But these are not fractional PLLs, so they have their limitations. For example, a STM32F769I-DISCO has HSE 25 Mhz oscillator. Using this, I have configured PLLSAI to generate 12 285 714,.. Hz which is -0,0186 % off of the needed 12,288 MHz (4 * 64 * 48 kHz). That's 18,6 ppm, which is on par with crystal tolerance specifications. No one can detect such a small difference in frequency, so it does not make audio quality worse. What does impact audio quality, is a jitter, but that is another story. Also You can use 11,2896 MHz, 12,288 MHz or some other audio frequency crystal or oscillator for HSE, if that suits rest of the system. In that case, if You set up dividers and multipliers taking into account total 147:160 ratio, both 44,1/48 kHz based frequencies can be matched perfectly. With 48 kHz based HSE frequency You can even get both audio frequencies and 48 MHz for USB matched perfect simultaneously.

External clocks are not specific to or dependent on STM32. You can implement them in whatever way You need and feed them to I2S_CKIN pin.