cancel
Showing results for 
Search instead for 
Did you mean: 

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?

FirmwareDev
Associate II
 
5 REPLIES 5

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

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?

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

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) ?

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