[Bug STM32 Lib] I2C clock wrong (> 100 kHz)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2009-03-11 12:03 PM
Posted on March 11, 2009 at 20:03
[Bug STM32 Lib] I2C clock wrong (> 100 kHz)
This discussion is locked. Please start a new topic to ask your question.
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 4:05 AM
Posted on May 17, 2011 at 13:05
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.Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 4:05 AM
Posted on May 17, 2011 at 13:05
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.Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 4:05 AM
Posted on May 17, 2011 at 13:05
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.Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-05-17 4:05 AM
Posted on May 17, 2011 at 13:05
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.