I2C bus protocol

Source: Internet
Author: User
I2C bus protocol

 

I2C bus protocol learning notes

1. I2C Protocol
Two two-way serial lines, one data line SDA, and one clock line SCL.
The data transmitted by SDA is transmitted at a large end. Each transmission is 8 bits, that is, one byte.
Multimastering is supported, and only one master can be created at any time point.
Each device on the bus has its own ADDR, a total of 7 bits, and the broadcast address is all 0.
The system may have multiple chips of the same type. For this reason, ADDR is divided into a fixed part and a programmable part. The details depend on the chip and the datasheet.

1.1 I2C bit transmission
Data transmission: in High-Power cases, if the SDA line remains stable, the SDA is transmitting data bit;
If SDA changes, it indicates the start or end of a session (later)
Data Change: The transmitted bit can be changed only when the SCL is low.

 1.2 I2C start and end signals
Start signal: in high-power mode, SDA switches from high level to low level to start transmitting data.
End signal: in high-power mode, SDA changes from low-level to high-level and ends data transmission.

1.3 I2C response signal

Each time the master sends 8-bit data, it waits for the slave ack.
That is, in the case of 9th clock, if the Ack is sent from the IC, the SDA will be pulled down.
If there is no ACK, SDA will be set to high, which will cause the master to restart or stop the process, as shown below:

 1.4 I2C write process
The standard process for writing registers is:
1. The master initiates start
2. The master sends I2C ADDR (7bit) and W operations 0 (1bit), waiting for ACK
3. Slave sends ACK
4. The master sends reg ADDR (8bit) and waits for ACK
5. Slave sends ACK
6. The master sends data (8 bit), that is, to write the data in the register, wait for ACK
7. Slave sends ACK
8. Steps 6th and 7th can be repeated multiple times, that is, multiple registers can be written in sequence.
9. The master initiates stop

Write a register

 Write multiple registers

 

 1.5 I2C read Process

The standard process for reading registers is:
1. The master sends I2C ADDR (7bit) and W operations 1 (1bit), waiting for ACK
2. Slave sends ACK
3. The master sends reg ADDR (8bit) and waits for ACK
4. Slave sends ACK
5. The master initiates start
6. The master sends I2C ADDR (7bit) and r operation 1 (1bit), waiting for ACK
7. Slave sends ACK
8. Slave sends data (8 bit), that is, the value in the register.
9. The master sends ack messages.
10. Steps 8th and 9th can be repeated multiple times, that is, multiple registers can be read sequentially.

Read a register

 Read multiple registers

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.