I2C (Inter-Integrated Circuit), also known as IIC or I2C bus, is a serial communication protocol used to connect multiple devices over short distances. It was first introduced by Philips in 1982 and is now widely used for communication between embedded systems, sensors, memory, and other peripheral devices. Here are some detailed information about I2C:
Physical Layer Characteristics
Two-wire System: The I2C bus uses two lines, SDA (Serial Data Line) and SCL (Serial Clock Line).
SDA Line: The line for data transmission, which can be shared by multiple devices.
SCL Line: The line for transmitting clock signals, used to synchronize data transmission.
Working Principle
Start and Stop Conditions: Communication begins with a start condition and ends with a stop condition.
Start Condition: The SDA line switches from high to low while the SCL line remains high.
Stop Condition: The SDA line switches from low to high while the SCL line remains high.
Data Transmission: Data transmission always occurs on the rising or falling edge of SCL, and the level changes on SDA are only valid when SCL is low.
Each data bit on the data line is transmitted within one clock cycle of SCL, starting with the high bit followed by the low bit.
After each byte transmission, there can be an ACK (acknowledgment) bit.
Address Frame: At the start of communication, the master device sends a frame containing a 7-bit or 10-bit address to select the slave device for communication.
Device Roles
Master Device: The device that controls the I2C bus, responsible for initiating and stopping communication and sending address frames.
Slave Device: Responds to commands from the master device and sends or receives data as needed.
Clock Frequency
The clock frequency of the I2C bus is variable, allowing adjustments based on system requirements. Typically, the clock frequency can be set from several hundred kilohertz to several megahertz.
Advantages and Applications
Simple and Flexible: The I2C communication protocol is relatively simple and easy to implement, suitable for scenarios involving multiple devices.
Suitable for Short-Distance Communication: Due to its two-wire system and synchronous transmission, I2C is suitable for short-distance communication, typically within a few meters.
Widely Used: Commonly used to connect sensors, memory, displays, and other peripheral devices, especially in embedded systems and the Internet of Things.
Physical Connection
Working Principle
Advantages and Applications
Physical Layer Characteristics
Working Principle
-
Start Condition: The SDA line switches from high to low while the SCL line remains high. -
Stop Condition: The SDA line switches from low to high while the SCL line remains high.
-
Each data bit on the data line is transmitted within one clock cycle of SCL, starting with the high bit followed by the low bit. -
After each byte transmission, there can be an ACK (acknowledgment) bit.
Device Roles
Clock Frequency: The clock frequency of the I2C bus is variable, allowing adjustments based on system requirements. Typically, the clock frequency can be set from several hundred kilohertz to several megahertz.
Advantages and Applications
Physical Layer Characteristics
Working Principle
Device Roles
Communication Rate: The communication rate of the CAN bus can be adjusted based on application needs, with typical rates including 100 Kbps, 250 Kbps, 500 Kbps, and 1 Mbps.
Advantages and Applications
Physical Layer Characteristics
Frame Structure
Working Principle
-
Data is divided into frames, including start bits, data bits, parity, and stop bits. -
Data starts sending from the least significant bit (LSB). -
Start bit is 0, data bits are sent from least significant to most significant, parity is sent according to the set method, and finally the stop bit.
-
The receiver monitors the receive line throughout the baud rate. -
When it detects the start bit of 0, it begins to read the data bits, followed by the parity bit and finally the stop bit. -
The receiver uses the start bit, data bits, and stop bits to parse the received data.
Advantages and Applications
Add Assistant Get Study Notes
After adding, reply“Notes” to receive it faster~