I2C Communication
This post was migrated from Tistory. You can find the original here.
Inter-Integrated circuit communication
Taking the two “I”s gives us the name I2C communication.
It supports one-to-many communication: a single Master node communicates with multiple Slave nodes.
Two-pin protocol
SDA (Serial data): data transmission
SCL (Serial clock): clock transmission — it keeps everything in sync.
Communication happens over these two pins.
Timing diagram
Free state - Both SCL and SDA start out HIGH.
Start condition - Once SDA goes LOW, the slave nodes are ready to receive data.
Since I2C is one-to-many, the Master has to specify which slave node it wants to talk to.
After entering the start condition, the first 7 bits transmit the slave node address.
Data is sent over SDA, and the SDA data is read whenever SCL is HIGH.
That’s why the SDA line has to hold steady for the entire time the SCL line rises and falls.
So the first 7 bits carry the address, and the next 1 bit determines whether the master will read or write data.
Read (HIGH): the master reads data from the slave.
Write (LOW): the master sends data to the slave.
The following 1 bit is the ACK/NACK flag.
If the communication link was set up correctly over those first 8 bits, the slave sends an ACK back to the master.
If a NACK is received, or there’s no response at all, it means the communication link wasn’t established properly.
In the end, it takes 9 bits to get everything ready to send and receive data.
Stop condition - SCL holds HIGH first, then SDA follows it up to HIGH.
The stop condition then leads back into the free state.


