How can I calculate the I2C_TIMINGR value for STM32L496. I 'll be running I2C system clk with 80 MHz, what are timing register values or psc, scldel, sdadel, sclh, scll values at baud rate of 10 KHz, 100 KHz, 400 KHz, 500 KHz and 1 MHz?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-07 8:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-07 9:20 AM
I guess if CubeMX can't compute them for you, then you'd need to read the RM definitions and write a simple fitter algorithm to come up with workable numbers.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-07 9:36 AM
But how to get the values even in CubeMX tool as I am new in using CubeMX. I have set the clock as 80 MHz in MSI in CubeMX with correct MCU and set the values of PLLM, N and R values in code as well. But where to get the Timing Register values for I2C in cubeMX tool?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-07 10:07 AM
Not using CubeMX here, but I'd imagine the clock speed would be a drop down or menu item related to the configuration of the I2C interface/peripheral, and based on the system clocking you'd defined earlier.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-07 11:16 AM
Yes clock speed can be chosen like that but where to select the I2C baud rates and see the timing register value accordingly (I2C_TIMINGR) ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-07 1:07 PM
As Clive wrote, if CubeMX does not calculate it for you, you read the register description in Reference Manual, draw a chart with the SDA and SCL signals and draw the timings between them, and calculate the required values for the individual fields, taking into account the requirements of the I2C specification.
There are examples given for various I2C input clock frequencies and required bus clock frequencies, it's not that hard to derive from them.
JW
