STM32L4: Two I2C Channels on same Bus - SCL stucks at ground until Timeout
Hello,
we have currently some issues where the I2C bus got stuck (SCL stuck and Ground) until the configured timeout (in the STM32L4) is reached. I was able to reproduce the issue quite often in a stress test setup.
Stress Test Setup description:
The STM32L4 uses two I2C Channels (Ch2 and Ch4), both as I2C Master in DMA mode on the same bus. In addition, there is an external I2C Master also on the same bus.
As an stress test all I2C masters tries to send messages as fast as possible. From time to time, to bus got stuck (SCL stays at Ground) until the configured timeout (in the STM32L4 I2C) e.g. 5ms is reached. After the timeout is reached, everything works again.
Observation
The issue only occurs when both I2C channels of STM32 are active in parallel. For example, when using a software mutex, to make sure only one channel at the time is active, we dont see any issues.
In addition, when using a different I2C speed for the two STM32 I2C Channels (e.g. Ch2 in Fast Mode, Ch4 in FastPlus Mode) there are also no issues. Thus, the bus gets only stuck, when both channels run on the same speed and are active in parallel.
Background Info
- When increasing or decreasing the I2C timeout time in the STM32L4 I2C registers the time the bus stucks will also increase or decrease for the same duration. Thus, it seems that in fact the I2C peripheral of the STM32L4 blocks the bus.
- In the current implementation we use two I2C channels, because in general there are two seperat buses. Just in some scenarios there is an active bridge that connects both buses.
Question
Since we dont see the issue happening with only one active I2C channel at time, we would like to know if there is any known issue, where the I2C bus gets stuck, when running two STM32 I2C channels on the same bus with the same speed?
