Skip to content

I2C-20 Clock-stretching device on a master that cannot stretch

Severity Status Implementation
suggestion planned judgement, depends on CFG-5

Looks at. Device and master data (library).

What it catches. A slave known to stretch SCL (sensors that hold the clock during conversion, some MCUs as slaves) on a master known to mishandle stretching.

Why it matters. The standard allows a slave to hold SCL low until it is ready; some masters do not wait correctly. The best known is the BCM2835 of early Raspberry Pis, whose controller only masks the clock while SCL is held and does not restore a full clock period afterwards, so a stretch that ends at the wrong phase corrupts the following bits. Such a pairing works most of the time and fails on the occasional long conversion.

Example. A BNO055 IMU (stretches for up to a millisecond) on a Raspberry Pi 3 over hardware I2C: sporadic bad readings until the bus is slowed to 50 kHz or moved to a software I2C with stretching support.

How to check. Both parts flagged in the library; a finding is a reminder, not a fault of the schematic.

Fix. A master that supports stretching, a lower clock, or a protocol that avoids it (the device may offer an interrupt line instead).

References. UM10204 §3.1.9 (clock stretching); Advamation, "Raspberry Pi I2C clock-stretching bug" (advamation.com/knowhow/raspberrypi/rpi-i2c-bug.html); our "I2C in the wild" notes §2.