I2C Bus Communication Protocol Tutorial with Example

What is I2C:

- Inter Integrated Circuit
- Bidirectional Data Transfer
- Half duplex (have only one data line)
- Synchronous bus so data is clocked with clock signal
- Clock is controlled when data line is changed

Speed of I2C:

low (under 100 kbps)
Fast (400 kbps)
high speed (3.4 mbps) I2C V2.0
2 wire communication :
Vtg high = 1, low = 0

when SCL = 1 data is a valid data, when SCL = 0 data changes
Basic protocol is master slave protocol
- Master controls the clock
- Slave device may hold the clock low to prevent data transfer
- no data transfer is present when clock is low
- It is a kind of wired and connection
- need to put pullup resistor
- default it is a open-drain or open-collector, so that adding pull up resistor is necessary so that it will have only two states that is 1.floating high and 2.drive low
- Default state is high when no device is pulling it low

Packet format:

Start condition:

SDA changes High to Low when SCL is High

Stop Condition:

SDA changes Low to High when SCL is High

Repeated Start:

Incase of repeated start START condition is generated instead of STOP after a frame.

Data Transfer:

It is byte oriented (8bit)
Ack transmited by recepient of the data
MSB first
First byte is address
First byte is transmitted by master and addressed slave is the recepient
Next byte is based on the last bit (R/W)
7bit address
1 bit R/W
0 - master write
1 - master receive

9th Pulse ACK

 ACK => SDA - low
maste only generates clock and slave pulls low the SDA line

Full I2C Data transfer

I2C Multi Master:

It is a multi master bus
So bus arbitration is required
When two device tries to drive SDA to different value
It is necessary to be sure that is not interfiering with another message
If a device is trying to send logic one but hears logic 0, it immediately stops transmission and gives the other sender priority
Synch needed in SCL


Good for comm in On-board devices
Easy to link multiple devices because of addressing scheme
Cost and complexity do not scale up with the num of devices


The complexity of supporting software components can be higher than that of scheme(EX. SPI - No need of address in SPI)

Video Tutorail

No comments:

Post a Comment