STM32 Cube IDE clock configuration for 96kHz I2S and 48MHz USB

Hello everyone,

It took a bit of time to messing around today to get this to work, so I thought I would post (details may be specific to the STM32F4 microcontroller I am using).

But I do have a question also for any STM32 experts at the end.

On the STM32 platform the if you pick a external crystal with frequency that is a multiple of the 96kHz then you can, unsurprisingly, get 0% error between desired and actual I2S frequency. 24.576MHz / 96kHz = 256, so 24.576MHz seems a good choice being a standard frequency with lots of options of low-cost crystals.

Screenshot 2024-08-06 at 13.49.41.png


USB needs exactly 48MHz clock, fortunately 48MHz / 96kHz = 500. Below is a solution that gives exactly 96kHz for I2S and 48MHz for USB.

Screenshot 2024-08-06 at 14.01.50.png


Question

What is I2S_APB1 CLK and why does it having a value of 147.456MHz make everything work so well? I mean, this is 6x the crystal frequency and 1536 x 96kHz but why is this the required value for the I2S_APB1 CLK?
 
  • Like
Reactions: analog_sa
What do you normally use to create the I2S_CKIN? A don’t have any other clock master on the board other than an STM32.

Anyway, the above shows how it is possible using a single 24.576MHz crystal that is fairly standard. The reason I put effort into this is to get the clocking working with one crystal.

It’s an STM32F479.

But the thing I don’t understand is the significance of I2S_APB1 CLK being 147.456MHz