Showing results for 
Search instead for 
Did you mean: 

I2C_TIMINGR configuration for STM32H753 ARM CORTEX-7

Associate II

I am using the STM32H753 ARM Cortex M7 processor(Package LQFP208).
My SYSCLK runs at the max. speed of 480 MHz and I want to configure my I2C1 (polling) in the Fast Mode (400KHz). 

I have configured the GPIOs and the modes but I am stuck at the "I2C_TIMINGR". I went through the I2C_TIMINGR register configuration examples on Pg. 1982 - 1984 of the reference sheet for the H753 but I wasn't able to figure out how to use those values. 

As my aim is to configure the I2C in the fast mode, how and which register should I use to set it at 400 KHz speed and accordingly what values to be loaded in the Prescaler, SCLL, SCLH? The examples provided in the reference sheet are for configuring I2C @ 8MHz, 16MHz and 40MHz. 

I will kindly need someone's assistance on the same. Please correct me if I am wrong with my understanding here. Also, I am new to programming so I would kindly appreciate if someone could explain this configuration part in detail for me.  

PS: I can use the CubeMX tool to configure the speed for the I2C but I want to use the register flags to understand it in depth. I have attached the code for configuring the I2C1 peripheral. Pardon me as I do not have comments for the code. 

Thank You,

Associate II

I use the `__LL_I2C_CONVERT_TIMINGS` macro defined in the "*_ll_i2c.h" files which makes the value slightly easier to interpret, but I still use the CubeMX tool to generate the timings.

0x10901031 would become __LL_I2C_CONVERT_TIMINGS(0x1, 0x9, 0x0, 0x10, 0x31).

Just a minor point, but I'll also mention that the CubeMX tool often seems to generate quite conservative timings that will usually be slower than the requested frequency when you check the bus on an oscilloscope, so could be worth double checking them.

I never heard about this macro, but I will give it a try. Thanks for the suggestion. Do you know a sample I2C program for the H7 processor to configure the I2C using registers?

The web has a lot of I2C programs for various types of STM32Fxxx processors but none for the STM32Hxxx series. Thank you.

Associate II

The LL examples are probably as close as you'll get, 


Most of the LL functions are just a single line that set a bit in a register, so it should be fairly similar to what you're trying to do.

Thank you.