cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate i2c timingR for stm32H5

A_Bit_More
Associate II

I need help understanding how to calculate I2C timingR without using stm32cubemx.

I have searched high and low and I haven't had any luck finding solutions.

I want to create function that helps me manually setup the timing with different inputs without the use of stm32cubemx.

As of now i do a an i2c example working in standard mode, I am able to receive and transmit.

here are my settings: using i2c1

 

A_Bit_More_1-1743700131984.png

my clock configuration: 

A_Bit_More_2-1743700187180.png

I would like instructions on how to get the timing above: 0x60808CD3
I have reviewed the Reference manual, but haven't had any luck with how it get's the values for SCLL, SCLH, SDADEL, and SCLDEL. Or the best rule of thumb with choosing the values.

here is the link to the RM: STM32H523/33xx, STM32H562/63xx, and STM32H573xx Arm<Sup>®</Sup>-based 32-bit MCUs - Reference manual
section 48 for ic2


Another question: SDADEL and SCLDEL does it calculate value every single time so on a different board (but with the same board) it might have a different value or would it be the same with the same chip.

Any help would be appreciated!
Thank you in Advance.

1 REPLY 1
AScha.3
Chief III

Hi,

i would recommend using Cube...its just for making life more easy.

But if want to go the hard way... take the rm and read...

1. the I2C module gets a clock...see in your clock tree, what you give to it.

2. it has an prescaler...set it.

3. then set the sck hi and lo times, to get the clock speed you want:

 

AScha3_0-1743702192252.png

Take a scope and look, sending something on this I2C, what comes out...and adjust, as you like it to be.

+

Another question: SDADEL and SCLDEL does it calculate value every single time so on a different board (but with the same board) it might have a different value or would it be the same with the same chip.

i cannot understand...but if same clock tree setting on same chip type, same i2c timing will result, if same timing set.

If you feel a post has answered your question, please click "Accept as Solution".