I²C (Inter-Integrated Circuit) is a multi-drop serial bus invented by Philips (now NXP) for communication between ICs on the same PCB, i.e. short distance.

I2C uses a 2-wire bus to communicate between a bus master and 1 or more slave devices. The master is a microcontroller, the slave devices are often microcontroller peripherals, but can also be an other microcontroller. Typical slave devices include:

  • EEPROMs
  • RTCs (Real Time Clocks)
  • Temperature sensors
  • GPIO expanders

Protocol
Communication goes over two wires: SDA (data) and SCL (clock). The lines are pull-up to high level by resistors, and the devices can make them low level with an open-drain NFET. A communication is initiated by a master which sends a start condition:

enter image description here

Start and stop conditions are easily detectable; they're the only situations where SDA can change while SCL is high. All other SDA changes should take place while SCL is low.

The master then sends the slave's 7-bit address followed by a R/W bit. After 8 bits have been received the slave replies with an ACK by pulling SDA low, which is read by the master at the 9th clock pulse. Successive byte may be written by the master or the slave as the master clock SCL. Each byte is to be acknowledged by the slave. The communication ends with the stop condition: SDA going high while SCL is high.

enter image description here

Addressing
An I2C address is 7 bits long. Many devices have the highest bits of their address fixed, while the lowest bits can be selected using 1 or more inputs on the IC. The LM75B, for instance has the address range 1001xxx\$_2\$, where the 3 least significant bits can be set via 3 inputs on the device. This allows for up to 8 LM75Bs sharing the same I2C bus.

Further reading

I2C Specification at NXP
I2C Manual at NXP
I2C Interface Solutions, NXP presentation
I2C info at www.i2c-bus.org

I2C pull-up resistors

EDN article Design calculations for robust I2C communications
Is there a correct resistance value for I2C pull-up resistors?
TI application note I2C Bus Pullup Resistor Calculation

history | excerpt history