← Writing

I2C (Inter-Integrated Circuit)

2025-06-30 embedded · basic · sp


A technical introduction to the I2C - low-speed two-wire master-slave serial protocol.
I2C is widely used for short-distance data transmission over a data bus (SDA) with a clock synchronization line (SCL).


    I2C

I2C - Inter-Integrated Circuit The most common protocol for transmitting data over short distances.
Synchronous master-slave protocol.
Both the master and slave can transmit data.
Usually operates in half-duplex (at any given moment, only send or receive data can occur) mode at different clock frequencies.
Message exchange occurs in frames.

Two wires are used -

In addition, the wires are connected to the Vcc supply using one pull-up resistor.

    SDA Frame Format

  1. master capture SDA bus with start condition
  2. via SDA is sent slave address which master wants to communicate
  3. after address is specified operation bit R/W. master wants to read or write data
  4. after operation bit slave sends Arc, indicating its presence
  5. if Arc is received from slave then master sends useful data
  6. after data slave sends Arc, thus indicating that data is received
  7. communication is stopped by stop condition

Start Condition

As in UART, the idle state - for SDA and SCL - is high(1)

Slave Address

R/W bit

Immediately after the slave address comes the read or write bit and is set by the master.

Ack bit

An acknowledge bit is sent by the receiver each time a byte of data is received

Data bits

After the address bit come the data bits that are exchanged between the master and slave.

Stop Condition

Mechanism to say that the last byte of data has been sent. Stop condition -

After the stop condition - the bus becomes inactive and there is no clock signal.
And any node on the bus can use the start condition to take over the bus and start a new communication.

    Synchronization of data and clock pulses

    Open Drain

  1. Each I2C device contains a logic device inside that can open and close the drain
  2. When the drain is closed, the SDA or SCL lines are in a low(0) state because now it is connected to ground (GND)
  3. When the drain is opened, the line goes high(1) because now its connected to the power supply (+Vcc)

When the lines are not in use, they are high(1) voltage, that is why I2C is called an open drain system

    Pull- Up resistor

    Modes \ Speed

pull-up resistor values ​​are one of the factors limiting the maximum bus speed.
I2C speeds are usually called modes
I2C supports several speeds: