Skip to content

I2C Bus Stuck When Slave Holds Clock Low (STM32F401) #5

@ludovicb1239

Description

@ludovicb1239

I2C Bus Stuck When Slave Holds Clock Low (STM32F401)

Description:

I’m encountering intermittent I2C bus lock-ups with the SparkFun Optical Tracking Odometry Sensor when using an STM32F401 as the master. The issue manifests either:

On the very first acknowledge byte of a transaction, or

After several successful transactions, communication randomly fails.

In these cases, the slave appears to hold the SCL line low, causing the master to hang.

Setup:

STM32F401 as I2C master.

Pull-ups are configured correctly.

I2C speed: 100 kHz.

Slave: SparkFun Optical Tracking Odometry Sensor.

Steps to Reproduce:

Initialize I2C communication at 100 kHz.

Attempt to read or write data to the sensor.

Sometimes the transaction works; other times, the slave holds SCL low either immediately on the first ACK or after a few successful reads/writes.

Expected Behavior:

The bus should function reliably at 100 kHz without hanging.

Actual Behavior:

Slave occasionally holds SCL low.

Software attempts to reset the bus (disabling/enabling the peripheral, clearing CR1/CR2, sending STOP conditions) do not release the bus.

Attempts to Resolve:

Verified pull-ups are present and strong.

Tried software resets and STOP generation.

Tried multiple retries from the master.

Request:

Guidance on reliably recovering the bus or avoiding this intermittent SCL hold issue would be greatly appreciated. Is this a known issue with certain slaves, or is additional master-side handling required?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions