2017-07-01 10:48 PM
Hi, I'm trying to use I2S2 in STM32F107VC in this Configuration:
SYSCLK and HLCK: 72 MHz
I2S2 Clock (Using PLL3_VCO): 80 MHz
But in configuration tab I can't set audio frequency more than 32 KHz (i.e. 44 KHz 48 KHz and 96 KHz).
The CubeMX error is:
'With this I2S Clock (36.0 MHz), the divider value 1 is too low to obtain the desired Audio Frequency (44.0 KHz).
The I2S Clock must be higher than (45.056 MHz).'
Is it possible to implement higher audio frequencies?
Any guidance could be helpful.
Thanks
#stm32f1 #i2sSolved! Go to Solution.
2018-01-12 07:53 AM
Hi K 270,
I think that issue is fixed with STM32CubeMX 4.23. I don't reproduce the problem initiall described here.
2017-07-03 07:14 AM
Hi
Boodaghi.Karim
,I Think that you are using an old version of STM32CubeMX tool.
With last one (4.0), I don't face such issue.
Could you please update the version you are using?
-Amel
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.
2017-07-04 12:30 AM
Thank you for your reply, I updated CubeMX but it seems I'm missing other thing(s).
Did you try in same configuration that I mentioned before (like pictures which I attached).
When I unchecked Master Clock Output it has no error but I want to use Master Clock Output it has error with frequencies upper than 32 KHz.
2017-07-04 06:01 AM
OK, I am checking. Thanks for detail.
-Amel
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.
2017-07-05 03:51 AM
Hi
Boodaghi.Karim
,I confirm that there is an issue withAudio frequency computation for STM32F107 device when Master clock output is enabled because usedI2S clock in calculation is wrong.
This issue is reported internally to be fixed soon. Sorry for such inconvenience
-Amel
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.
2017-07-05 04:05 AM
Hello K 270,
If you take a look at the Refrence Manual
page 736, you'll find the I2S clock divider formula:F
S
= I2SxCLK / [(16*2)*((2*I2SDIV)+ODD)*8)] when the channel frame is 16-bit wide
Fs being the audio frequncy. Knowing that the minimal
I2SDIV value is 2 and the minimal value of ODD is 0 we can compute the minimal I2SxCLK allowed for an audio frequency Fs=44 kHz.
I2SxCLK = 44000* [(16*2)*((2*2)+0)*8)] = 45.056Mhz
But, as we can see, according to your clock configuration the I2S clock= 80MHz which is obviously not 36MHz, I can tell you that there is nothing wrong with your configuration, the problem must be a CubeMx bug.
To solve that, jsut pick any audio frequncy (8kHz for example) and generate your code. Afterwards you can just change the I2S audio frequncy manually.
Open the main.c file
In the function: static void MX_I2S2_Init(void)
change the value of the
parameter
hi2s2.Init.AudioFreqand make sure to respect the clock divider formula (You can go up to an audio frequency=96kHz with an I2S clock= 100MHz)
2017-07-05 06:30 AM
Thank you for your effort in solving this problem.
2017-07-05 06:33 AM
Hi Mohamed
Thank you for this complete answer.
Regards
Karim
2018-01-12 07:53 AM
Hi K 270,
I think that issue is fixed with STM32CubeMX 4.23. I don't reproduce the problem initiall described here.