Skip to main content
Visitor II
November 21, 2025
Question

I2C communication unstable on STM32F4 when multiple sensors connected

  • November 21, 2025
  • 1 reply
  • 170 views

I’m working on a project with an STM32F4 microcontroller and using the I2C bus to connect multiple sensors. Everything works initially, but after some time the communication becomes unstable, returning random values or causing the I2C bus to hang. I have tried lowering the clock speed and checking pull-up resistors, but the issue persists.

Has anyone experienced similar issues with I2C on STM32F4 or found a recommended configuration or hardware fix?
Any guidance or examples would be greatly appreciated. Thanks!

1 reply

Ozone
Principal
November 21, 2025

I would check the bus signal first. With multiple slaves and and long lines, reducing pull-up resistance values might help.

Make sure you have no duplicate addresses on the bus, although I suspect this would manifest quite quickly.

> ... returning random values or causing the I2C bus to hang.

This sounds more like a signal quality issue.
The bus usually "hangs" when a device does not see one or more SCLK impulses, and thus is stuck in a transmission.
If possible add some instrumentation code, attach a scope (2-channel), and try to trigger on such a "hang" event. Alternatively a logic analyser, but those give no indication of signal quality.