cancel
Showing results for 
Search instead for 
Did you mean: 

question about the SAI clock and example in cubeL4

jiangpen
Associate II
Posted on December 04, 2015 at 07:07

for the SAI example in cubeL4, it looks like running 22050 sample rate, and the input clock is 11.294M.

I measure the frame len is about 45us which is 1/22050.

Now I develop an audio app runs 44100,  I have checked the data sheet, seems only way is to double the PLLSAI1, but most closest setting I get is 22.85M which is not fit very well.

I think the measured frame len for 44100 sample rate should be about 1/44100=27us. I use this meathod to verify the clock setting.

May I know any guys work on SAI 44100? have the right clock setting(not use external one)? or any setting can based on 11.294MHZ PLLSAI to make 44100 working?

 thanks a lot

#44100
2 REPLIES 2
Amel NASRI
ST Employee
Posted on December 04, 2015 at 17:10

Hi jiang.peng,

The ''Clock Configuration'' wizard in the CubeMX tool can help you to set the parameters in order to reach the clock values you need.

Using HSI, it seems that you cannot reach exactly 44.1MHz for SAI, but an approximate value with PLLM (/3), N (x 58) and P (/7).

-Mayla-

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.

jiangpen
Associate II
Posted on December 04, 2015 at 23:50

Hi Mayla,

 thanks for reply. Yes, I use Cube to generate clock. According to my understanding, the SAI example sets PLLSAI1N to 24 and PLLSAI1P to 17 to generate 11.294MHz which fits for 22050 sample rate in this example code.

 Now I want to have 44100 sample rate, a way is double this clock, and keep the frame setting same.

 But I can hardly adjust it to 22.58M, I tried the HSI and MSI, seems I can get 22.85M but it seems not fit very well.

I think 44100 sample rate is very commonly used, so maybe somebody already do that, then I can refer to.

thanks