cancel
Showing results for 
Search instead for 
Did you mean: 

Using CubeIDE to configure I2S, can't set I2S Clock

Wal
Associate II

hello, I'm tring to configure STM32F103RCT6 to interface a codec with I2S. I use a 8MHz external crystal as HSE, in the clock configuration page, the I2S clock is direct connect to SYSCLK and cannot be adjusted. the selected audio frequency is 48KHz, the real audio frequency shows 46.875KHz and -2.34% error.

the question is, how can I configure the clock so there's no error between selected and real, and also can output a I2S_MCK with 12.288MHz to the codec? Thanks

截屏2024-03-03 18.44.37.png截屏2024-03-03 18.44.47.png

5 REPLIES 5
AScha.3
Chief III

Hi,

>how can I configure the clock so there's no error between selected and real

In short : you cannot.

To have a 12.288MHz clk, you just have to use a 12.288MHz crystal or clock instead of 8 MHz.

Only way to get on this cheap and old cpu the desired audio clock.

On newer and more complex cpu you have more chance to get a extra audio pll to the desired frequency or at least close to it.

If you feel a post has answered your question, please click "Accept as Solution".

thanks for your helping, I tried with 12.288MHz HSE setting, but it can't provide suitable USB Clock. It's very frustrating.

Yes, i know ....   :)

You could trick the cube a little : set in cube external HSE to 12,0 MHz, but use your 12,288  !

USB should not work then as device - but just try.

Otherwise use a more actual cpu, i would use stm32H503 .

If you feel a post has answered your question, please click "Accept as Solution".

thanks again, I wonder if I use the 12,288 HSE, am I limiting the SYSCLK to 12,288MHz and cannot reach max 72MHz , right?

No, you still can use the pll as with 12MHz, if you set 12 as HSE clk in cube, all is as before;

just 12,88 x 6 -> 73,7 MHz real. (This is no problem for the cpu, it would run at 100MHz also (i tried...).)

If you feel a post has answered your question, please click "Accept as Solution".