IIC protocol analysis

IIC is a synchronous half-duplex serial bus

Synchronize

Indicates that this bus has an SCL line

half duplex

Two-way communication is possible, but sending and receiving cannot be carried out at the same time. Receiving is prohibited when sending, and sending is prohibited when receiving.

serial

Data is sent bit by bit

bus

Two lines (SCL SDA) can be connected to multiple IIC type devices, such as AT24CXX, four-pin OLED, SHT30, AHT10

How to identify each device?

Communicate with each device via slave address

Take 24C02 as an example, its slave address is 1010xxx (a total of 7 digits), 1010 is fixed, xxx is determined by the pin of the hardware, it is 1 when it is connected to 3V3, and it is 0 when it is connected to GND. If all three hardware pins are connected to GND , the address is 1010000.

send request

Send from the high bit (from left to right), such as 1010, the order of sending is 1, 0, 1, 0

Fixed signal start signal

Falling edge of data line Falling
edge of clock line

Take the commonly used four-pin OLED driver as an example
insert image description here

Fixed Signal Response Signal

SDA sends high level
insert image description here

fixed signal end signal

The rising edge of the clock line
The rising edge of the data line
is the reverse of the start signal
insert image description here

Summarize

The IIC specification leaves some degrees of freedom for manufacturers, so the fixed drivers for IIC are also slightly different

In the I2C bus, some signals are fixed, not according to the slave device. Here are those fixed signals:

Clock signal (SCL): The master device controls the clock signal on the bus. The clock signal is used to synchronize data transmission, and its frequency determines the data transmission speed.

Data signal (SDA): Both master and slave devices can send and receive data on the bus. The level on the SDA line represents the bit value of the binary data.

Start signal (Start): sent by the master device to indicate the start of a data transmission.

Stop signal (Stop): sent by the master device to indicate the end of this data transmission.

Response signal (Acknowledge): sent by the slave device to respond to the read and write requests of the master device. If the data is received correctly from the device, an acknowledge signal will be returned.

Device Address: Used to address and access each device. Each device has a unique address for identification and addressing on the bus.

The role and use of these signals are fixed and are not affected by slave devices. Therefore, on the I2C bus, these signals are fixed and not determined according to the slave device.

Guess you like

Origin blog.csdn.net/lllmeimei/article/details/130024415
IIC