Skip to main content
Visitor II
March 3, 2024
Question

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

  • March 3, 2024
  • 1 reply
  • 2733 views

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

    This topic has been closed for replies.

    1 reply

    Super User
    March 3, 2024

    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.

    WalAuthor
    Visitor II
    March 3, 2024

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

    Super User
    March 3, 2024

    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 .