I2C Communication Protocol
I2C Communication Protocol
- Dhruv Satasiya
Content
• Introduction
• Comparing I2C and SPI
• Pin Description
• I2C Modes
• Start & Stop Conditions
• Working of I2C
• I2C Generic Configuration
• All About I2C Serial Clock(SCL)
• Various I2C Errors
Introduction
• I2C (Inter-integrated circuit) is a synchronous serial communication protocol, where the
sender and receiver act based on a shared clock signal.
• I2C is fundamentally used to transfer and receive data over shorter distances with only 2
wires and significant data transfer speed.
• I2C can communicate at a speed of 100K bits/second up to 3.4M bits/second, depending
on the different modes.
• I2C-based communication can be accomplished between a distance of less than 0.5 meters
up to 2-3 meters.
• The preliminary advantage of the I2C protocol is its multi-master capability with the help
of only 2-wires, one SDA line and another SCL line.
Comparing I2C and SPI
I2C SPI
• Slower data transfer speed • Faster data transfer speed
• Longer communication distance (0.5 to 2-3 • Shorter communication distance (10 feet)
meters) • Requires a minimum of 4 wires (The more
• Requires only 2 wires slaves, the more wires)
The above exhibit shows the NAK received by the master as the slave of
the given address was not recognized.
3. Data Transfer:
• Next, 8 bits of data are transmitted either:
• From the master to the slave (in a write operation), or
• From the slave to the master (in a read operation).
• Once the data byte is sent, the slave sends an ACK bit to confirm receipt of the data.
4. Stop Condition:
• After the desired communication is complete, the master generates a Stop condition, signaling
the end of the communication.
I2C Engine with
only shift register
and data register
• 1. Bus Error: This error arises when an SDA line transition is non-valid during a byte
transfer. Such as the rising or falling of the SDA line while SCL is high.
• 2. Arbitration Loss Error: This error occurs when the interface loses the arbitration to
another master. This only happens in the multi-master mode of I2C.
• 3. ACK Failure Error: This error occurs when no ACK is returned for the byte transferred.
• 4. Overrun Error: This arises only during the reception process. When a new byte is
received and the data register has not been read yet and new byte received is lost.
• 5. Underrun Error: This is similar to overrun but occurs during the transmission. When a
new byte should be sent and the data register has not been written yet and the same byte
is sent twice.
• 6. PEC Error: This error happens when there is a CRC mismatch if the CRC feature is
enabled.
• 7. Time-Out Error: This happens when the master or slave stretches the clock, by holding
low for more than the specified amount of time.
Thank You…