Personal #electronics#networking 2 min

I2C - Inter Integrated Circuit bus

Translation of the original in Catalan. Read it in: CatalàCastellano

Going back to the topic of buses that can work over GPIO here you have another bus that is very, very widely used on this type of port.

Definition

I2C ("eye-squared-see") was invented by Philips around the 1980s with the aim of connecting different ICs (integrated circuits) with their CPUs inside a TV. Basically it is a bus designed for short distances and low bandwidth.

Furthermore I2C is capable of detecting collisions, synchronising the clock and negotiating the master in systems where there may be more than one. The clock is always generated by the master, but the slaves can hold the clock to generate a wait state. Often the master on an I2C bus is the microcontroller.

The maximum number of devices that can be connected on an I2C bus is calculated from the maximum capacitance of the line (about 400pF), and the address limit is 16k; normally each device has a capacitance of about 10pF. So we have 127 addresses available. In principle the addresses of each IC are assignable by the system designer.

How it works

Only two cables are needed to work with I2C, two active cables and ground. The active cables are SDA (Serial Data Line) and SCL (Serial Clock Line). That is, the first for data and the second for the clock.

i2c.gif

With only these two active cables we have enough to establish full-duplex communications. The interface often works at low speeds, from 100KHz to 400KHz. On an I2C bus, each IC connected to the bus has a unique address. Each device can work as receiver and/or transmitter depending on its functionality.

On the bandwidth question, essentially there are three modes of operation, a standard one of up to 100kbps and a fast one of up to 400kpbs. The last mode is the High-Speed one that can reach up to 3.4Mbps.

Uses

A very common device that is often used over an I2C bus are EEPROMs, there are also others like sensors, and real-time clocks. Sometimes I2C buses are also used only as a signalling line for other data lines, for example, in multimedia applications, where RF tuners, video encoders and/or decoders, audio processors are often used. In fact, the market is full of hundreds of ICs that use the I2C bus as a communications protocol on their buses.

Examples of use

Maxim has within its repository of technical articles a heap of references to applications using this protocol. I found particularly interesting an application that lets us control an LCD display with an HD44780 interface (local). The document explains how to serialise the 11 pins this device needs in order to work with only the 2 cables the I2C bus has.

Another use, I'd say more than useful, is the one that lets us connect the I2C bus to the PC's parallel port. In fact, the circuit that lets us do it is fairly simple if you want more information: I2C interfacing via PC parallel port.

Sources