cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f407 - Question of i2s clock frequency

SJoo.1
Associate II

Hi, I'd like to play music through i2s interface using external audio codec.

Refer to "STM32F4xx Reference Manual", Below setting is needed if MCLK is enabled on 48Khz FS.

PLLI2SN : 258 

PLLI2SR : 3 

I2SDIV : 3

I2SODD : 1

After I configured above, BCLK and MCLK are measured 1.536Mhz and 12.288Mhz.

But I want to set MCLK as 24.576Mhz.

Could you please let me know how to set 24.576 Mhz as MCLK if BCLK is 1.536Mhz?

Thanks

6 REPLIES 6
Danish1
Lead II

According to the Reference Manual, MClk is fixed as 256 x Fs (28.2.2 I2S Features).

So for 48 kHz Fs, you are stuck at 12.288 MHz.

If you were to go to 96 kHz Fs, you could then have 24.576 MHz on MClk.

If you then want BClk to be 1.536 MHz keeping 96 kHz Fs, then you'll end up with 16-bit data in a 16-bit frame. And WS might not be doing what you want.

Hope this helps,

Danish

SJoo.1
Associate II

Thank you for your reply.

So it is impossible to generate 24.576 Mhz on 16bit 2channel 48Khz format.

Why do you need that?

You can generate arbitrary frequencies e.g. using a timer.

JW​

Dear waclawek.jan,

Why do you need that?

=>

External Codec which I use need 24.576 Mhz as MCLK.

But some personal reason, I need to use 48Khz FS.

You can generate arbitrary frequencies e.g. using a timer.

=>

I thought MCLK should be syncronized with BCLK and LRCLK. But it was my misunderstood.

Thank you for your guide, it's really helpful for me.

I'll try to find how to generate arbitrary frequencies using a timer.

Thanks,

> I thought MCLK should be syncronized with BCLK and LRCLK.

Maybe it should - that depends on the requirements of the codec.

There are many codecs with many different requirements and capabilities. Some of them can act as I2S masters themselves, so only MCLK has to be provided, or they may be able to generate even that. In that case, you use the I2S in STM32 as slave and don't care about the clocks at all.

As the last resort, you can always generate any mix of clocks you need by chaining timers, generating all 3 I2S clocks in any ratio you need, feeding them to both codec and I2S acting as slave.

JW

Dear JW,

Thank you for reply.

I'm trying to generate 24.576Mhz frequencies using a timer.

But I'm not sure it is possible to generate 24.576Mhz frequencies using a timer.

How do you think of it?

SeungKyu Joo