Private Homepage of Hartmut Henkel

Fixing the Repeated Start Condition of the I2C Bus on the Raspberry Pi by Hardware

The Problem

It seems that the serial module BSC within the Broadcom controller BCM2835 on the Raspberry Pi does not support the Repeated Start condition on the I2C bus. There are several references to this problem in the internet. The following image shows a read operation through the I2C bus (oscilloscope screen shot courtesy of the von Hoerner & Sulger GmbH).

Oscilloscope screen shot of I2C bus read timing on the Raspberry Pi.

It can be seen, that after two frames have been written (address and data byte), the BSC issues a stop condition (P), then follows a fresh start (S) for reading the data.

The stop (P) is incompatible with several ICs designed for the I2C bus, e. g., the temperature sensor ADT7410 from Analog Devices. These ICs require a repeated start condition, which is just a start (S) after the first two frames, but without a stop (P) in front of it.

Solution by Hardware

One maybe possible solution, yet untested (!), is suggested here as shown in the following circuit diagram. This uses CMOS logic built from two decimal counters and two logic gates to suppress the stop (P) condition after the first two frames, if needed. The clock SCL is then held low by an open collector transistor after the Ack following the second frame. The SCL is released when the SDA goes high. This should effectively move the rising SCL edge behind the rising SDA edge, so that there is no valid stop (P) condition.

The circuit needs to be engaged by issuing a reset pulse through some GPIO pin always before starting the I2C bus activity, for which the intervening stop condition should be removed. After the rising SCL edge is delayed, the circuit goes into an idle mode without affecting the SCL line further.

Hardware addition to fix the Repeated Start Condition.

Discussion

Instead of using discrete logic, this function could also be implemented within an FPGA.

Comments or alternative circuit design hints welcome.

This page first put online 13 June 2013.