![]() |
VOOZH | about |
I2C stands for Inter-Integrated Circuit. It is a bus interface connection protocol incorporated into devices for serial communication. It was originally designed by Philips Semiconductor in 1982. Recently, it is a widely used protocol for short-distance communication. It is also known as Two Wired Interface(TWI).
It uses only 2 bi-directional open-drain lines for data communication called SDA and SCL. Both these lines are pulled high.
Serial Data (SDA) : Transfer of data takes place through this pin.
Serial Clock (SCL) : It carries the clock signal.
I2C operates in 2 modes
Each data bit transferred on SDA line is synchronized by a high to the low pulse of each clock on the SCL line.
π Working of I2C Communication protocol
According to I2C protocols, the data line can not change when the clock line is high, it can change only when the clock line is low. The 2 lines are open drain, hence a pull-up resistor is required so that the lines are high since the devices on the I2C bus are active low. The data is transmitted in the form of packets which comprises 9 bits. The sequence of these bits are -
Here are the steps of I2C (Inter-Integrated Circuit) data transmission
START and STOP can be generated by keeping the SCL line high and changing the level of SDA. To generate START condition the SDA is changed from high to low while keeping the SCL high. To generate STOP condition SDA goes from low to high while keeping the SCL high, as shown in the figure below.
Between each start and stop condition pair, the bus is considered as busy and no master can take control of the bus. If the master tries to initiate a new transfer and does not want to release the bus before starting the new transfer, it issues a new START condition. It is called a REPEATED START condition.
A high Read/Write bit indicates that the master is sending the data to the slave, whereas a low Read/Write bit indicates that the master is receiving data from the slave.
After every data frame, follows an ACK/NACK bit. If the data frame is received successfully then ACK bit is sent to the sender by the receiver.
The address frame is the first frame after the start bit. The address of the slave with which the master wants to communicate is sent by the master to every slave connected with it. The slave then compares its own address with this address and sends ACK.
In the I2C communication protocol, the data is transmitted in the form of packets. These packets are 9 bits long, out of which the first 8 bits are put in SDA line and the 9th bit is reserved for ACK/NACK i.e. Acknowledge or Not Acknowledge by the receiver.
START condition plus address packet plus one more data packet plus STOP condition collectively form a complete Data transfer.
| Features | I2C Communication Protocol | SPI Communication Protocol |
| Number of wires | 2 (SDA and SCL) | 4 (MOSI, MISO, SCK, and SS) |
| Communication type | Half-duplex | Full-duplex |
| Maximum number of devices | Limited by addressing scheme | Limited by number of chip select (SS) lines |
| Data transfer speed | Slower | Faster |
| Error handling | Improved due to ACK/NACK feature | Not as robust |
| Cost | Cost-efficient due to fewer wires | More expensive due to additional wires |
| Complexity | Simpler due to fewer wires | More complex due to additional wires |
| Multi-master configuration | Yes | No |
| Synchronous communication | Yes | Yes |
| Clock stretching | Yes | No |
| Arbitration | Yes | No |
The I2C communication protocol is a simple and effective way for devices to communicate with each other. It allows multiple devices to connect using just two wires, making it easy to add new components to a system. I2C is popular in various applications because it supports multiple devices, is relatively easy to implement, and requires less wiring compared to other protocols. Overall, I2C is a reliable choice for connecting sensors, displays, and other peripherals in electronic projects.