2009-03-11 12:03 PM
[Bug STM32 Lib] I2C clock wrong (> 100 kHz)
2011-05-17 04:05 AM
Hi,
I have problems with the SCL clock generated by the I2C core, if I configure a clock speed > 100 kHz. If I set e.g. 400 kHz in I2C_Init(), I get something around 630 kHz. My PCLK1 is 36 MHz. I think the following line in the firmware library is wrong: result = (u16)(pclk1 / (I2C_InitStruct->I2C_ClockSpeed * 3)); After changing it to result = (u16)(pclk1 / (I2C_InitStruct->I2C_ClockSpeed * 2)); everything works as expected. I think the same error is in the reference manual.2011-05-17 04:05 AM
Or maybe Fwlib was compiled with wrong HSE_Value? (ie. 8mhz, but you have 12mhz crystal)
Well... in this case you should see similar symptoms for other devices, like uart.2011-05-17 04:05 AM
I am using the STM3210-E board (RCC_GetClocksFreq() reports PCLK1 36 MHz) and or own board with a 16 MHz external clock.
I think everything is configured right.2011-05-17 04:05 AM
Budde:
Without testing it myself, I think your analysis is correct. I have found several bugs in the Firmware Library and in the Documentation (both Hardware Manual and Firmware Library documents). I expect there are many more minor bugs such as this one. So, thanks for finding this bug. I have changed my firmware library accordingly. Garry.