Skip to main content
SDhar.1
Associate
May 8, 2025
Question

I2C_frequency configuration

  • May 8, 2025
  • 2 replies
  • 308 views

Hi,

I would like to configure the I2C frequency based on the input clock frequency. Is there a specific formula to calculate the I2C timing values? Also, I would like to know whether this formula is applicable to all STM32 microcontrollers, or if it varies depending on the MCU series.

Could you please provide clarification on this, along with example code for configuring the I2C frequency using the appropriate register settings and formulas?

Thanks,
Sainath 

2 replies

KnarfB
Super User
May 8, 2025

The official source is the I2C chapter in the reference manual of your MCU. It comes with tables for some common  settings, otherwise you have to go through the text and formulae.

You may find it easier using STM32CubeMX to derive the register values for your setup.

hth

KnarfB  

Pavel A.
Super User
May 8, 2025

This request pops out here every so often. It's the time for a KB article?