cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F746G Discovery audio codec samplerate drift?

misterstarshine
Associate III
Posted on September 30, 2016 at 00:14

Hi.

I'm generating a stereo sinewave with the BSP_AUDIO routines and notice that the frequency of the generated waveform changes randomly with a couple of cents in either direction. How stable is the word clock from the SAI unit? Is it possible to get data on this and how can this problem be addressed?
3 REPLIES 3
Posted on September 30, 2016 at 03:06

You'd have to look at the BOM to figure the ppm rating of the crystal used, and then look at the PLL/VCO performance. You should be able to export internal clocks via MCO/MCO2 pins. Would probably look at those wrt a precise reference both for accuracy and jitter. You could play with the PLL comparison frequency, which as I recall should be in the 1-2MHz range, and the VCO frequency >192MHz (at least in earlier F4 specs).

A TCXO source for HSE would be significantly more stable.

If you are using HSI that is very variable, and not suitable for CAN/USB applications.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
misterstarshine
Associate III
Posted on September 30, 2016 at 15:29

Thanks for your reply. There were four candidates of oscillators in the bill of materials. Three of them were +-50ppm and the other +-20ppm. I can say for sure that the word clock in the BSP_AUDIO library is way off those specifications. I thought most clocks were derived from a main clock with prescalers but I may be wrong of course. From an audio viewpoint one musical cent is about 578ppm if I have calculated correctly. 50ppm would be very hard to detect by ear since it is less than one tenth of a musical cent. The drift of the word clock is slightly audible and apparent if played alongside a straight waveform or another recording of it.

misterstarshine
Associate III
Posted on October 07, 2016 at 15:35

It seems the internal RC oscillator (HSI) was activated by default and the HSE alternative was greymarked and couldn't be chosen since one had to enable it in the pin configuration for some reason. The HSI alternative was totally unsuitable for audio as you said. Thank you for your help.