cancel
Showing results for 
Search instead for 
Did you mean: 

I2C Timing configuration for STM32G4xx

uhl
Associate

Hello guys,

I am having problems setting the correct I2C clock on the STM32G4xx in Master Mode.

 

The example configuration from the data sheet for 400 kHz at 16 MHz f_I2CCLK generates 432 kHz (RM0440-Rev4: P1892 Table 381). I use the __LL_I2C_CONVERT_TIMINGS() function, to convert the values from Datasheet.

An unchanged example from the CubeIDE also generates an incorrect frequency on my Nucleoboard. (CubeIDE version 1.15.0)

By trial and error I have now managed to generate almost exactly 400 kHz. In the TIMINGR I write 0x00100716, analogfilter enabled and digitalfilter disabled. Unfortunately I cannot reproduce this number with the information in the data sheet. So I can't get through the code review.

I was able to find a configuration tool for other controllers, is there such a tool for the STM32G4xx?

Can someone please help me to calculate the I2C timing correctly and comprehensibly?

1 ACCEPTED SOLUTION

Accepted Solutions
Imen.D
ST Employee

Hello @uhl ,

You can use the I2C configuration tool STSW-STM32126.

Please check these threads:

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

View solution in original post

1 REPLY 1
Imen.D
ST Employee

Hello @uhl ,

You can use the I2C configuration tool STSW-STM32126.

Please check these threads:

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen