2018-12-07 08:58 AM
2018-12-07 09: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.
2018-12-07 09: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?
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.
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) ?
2018-12-07 01: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