I²C Protocol in microcontrollers

I²C (Inter-Integrated Circuit) (generically referred to as “two-wire interface”) is a multi-master serial single-ended computer bus invented by Philips that is used to attach low-speed peripherals to a motherboard, embedded system, or cellphone.

No licensing fees are required to implement the I²C protocol. However, fees are still required to obtain I²C slave addresses allocated by NXP.

I²C uses only two bidirectional open-drain lines, Serial Data Line (SDA) and Serial Clock (SCL), pulled up with resistors. Typical voltages used are +5 V or +3.3 V although systems with other voltages are permitted.

Maximum no of I2C UC ca be interfaced: 27=128, 16 reserved addresses, so a maximum of 112 nodes can communicate on the same bus.

Max. Communication Speed: 100 kbit/s standard mode and the 10 kbit/s low-speed mode, but arbitrarily low clock frequencies are also allowed. Recent revisions of I²C can host more nodes and run at faster speeds (400 kbit/s Fast mode, 1 Mbit/s Fast mode plus or Fm+, and 3.4Mbit/s High Speed mode). These speeds are more widely used on embedded systems than on PCs.

3 wire (SPI) Vs 2 wire (I²C):

I²C (for ‘Inter-Integrated Circuit’, protocol) and SPI (for ‘Serial Peripheral Interface’) both protocols are well-suited for communications between integrated circuits, for slow communication with on-board peripherals. At the roots of these two popular protocols we find two major companies – Philips for I²C and Motorola for SPI – and two different histories about why, when and how the protocols were created.

The I²C bus was developed in 1982; its original purpose was to provide an easy way to connect a CPU to peripherals chips in a TV set. Peripheral devices in embedded systems are often connected to the microcontroller as memory-mapped I/O devices. One common way to do this is connecting the peripherals to the microcontroller parallel address and data busses. This results in lots of wiring on the PCB (printed circuit board) and additional ‘glue logic’ to decode the address bus on which all the peripherals are connected. In order to spare microcontroller pins, additional logic and make the PCBs simpler – in order words, to lower the costs – Philips labs in Eindhoven (The Netherlands) invented the ‘Inter-Integrated Circuit’, IIC or I²C protocol that only requires 2 wires for connecting all the peripheral to a microcontroller.

It seems the Serial Peripheral Protocol (SPI) was first introduced with the first microcontroller deriving from the same architecture as the popular Motorola 68000 microprocessor, announced in 1979. SPI defined the external microcontroller bus, used to connect the microcontroller peripherals with 4 wires. Unlike I²C, it is hard to find a formal separate ‘specification’ of the SPI bus – for a detailed ‘official’ description, one has to read the microcontrollers data sheets and associated application notes.


Table: Advantages and Disadvantages of 3-/2-Wire Interfaces





1. Speed
2. No pullup resistors required
3. Full-duplex operation
4. Noise immunity

1. Larger number of bus line connections
2. Individual chip-select lines required to communicate with more than one slave at a time
3. No acknowledgment of received data

2-Wire: I²C and SMBus 

1. Fewer bus line connections
2. Multiple devices share the same bus
3. Received data is acknowledged

1. Speed: SMBus limited to 100kHz; I²C limited to 3.4MHz
2. Half-duplex operation
Open-drain bus lines require pullup resistors
4. Reduced noise immunity

A master and a slave communicate through multiple bus lines over a 
serial interface. During a write cycle, the master uses its own clock and data signals to transmit data to the slave. During a read cycle, the slave transmits data to the master.

External Links:



Measuring and analyzing I²C signals

SPI/I²C Bus Lines Control Multiple Peripherals AN4024