当前位置:网站首页>Easy to understand I2C protocol
Easy to understand I2C protocol
2022-07-06 05:05:00 【Embedded base】
I2C The bus is a simple 、 Two way two wire synchronous serial bus .
I2C The communication protocol has few pins , The hardware implementation is simple , High scalability , Unwanted USART、CAN And other communication protocols , It is widely used in multiple integrated circuits in the system (IC) Communication between .
I2C Information exchange is completed by two signal lines ,SCL It's a clock signal line ,SDA For data entry / Output line .
I2C Support multiple slaves (Slaver), It can also support multi host mode (Master). Most of the I2C Device support 100kHz and 400kHz Pattern , Some special applications can also be designed to support 3.4MHz.
I2C Its simple applications mainly include I2C Hardware connection and I2C Communication protocol Two aspects , This article gives a brief description of common communication methods .
I2C Hardware connection
As shown in the figure below , In a I2C In the communication bus , Can connect multiple I2C Communication equipment , Support multiple communication hosts and multiple communication slaves .
- SDA, SCL Pin and pull-up resistance
- The equipment SDA, SCL Pin use OD Gate output , Line and operate between different equipment , namely “ And logic ”.
- SDA and SCL It needs to be connected with pull resistance , According to I2C Number of equipment , Communication speed of the system , Design and choose different pull-up resistors .I2C The number of devices determines the bus capacitance on the bus , Bus capacitance and pull-up resistance limit the communication rate of the system .
- Usually ,3.3V Pull up the resistance of the system and take 3.3kΩ,5V Pull up the resistance of the system and take 4.7kΩ.
- When I2C When the device is idle , It will output a high resistance state , And when all the devices are idle , When both output high resistance states , Pull the bus to high level by pull-up resistor .
Multi master and multi slave applications
- Each slave device connected to the bus has an independent address , The host can use this address to access different devices .
- When multiple hosts use the bus at the same time , To prevent data conflicts , Arbitration can be used to decide which host device occupies the bus .
I2C Communication protocol
The following figure shows a host (Master) To the slave (Slaver) Write a byte of data as an example , explain I2C Basic protocol of communication .

- Start signal ( S ): When SCL It's high level ,SDA Switch from high level to low level .
- Stop signal ( P ): When SCL It's high level ,SDA Switch from low level to high level .

- Frame address : Unique to each slave 7 Bit or 10 Bit address , Used for address identification between master and slave devices .I2C The protocol states that the device address can be 7 Bit or 10 position , In the actual 7 Bit addresses are widely used .
- read / Write in : a , If the master sends data to the slave, it is low , The request data is high .
- ACK/NACK:I2C The data and address of the transmission are with response . Responses include “ The reply (ACK)” and “ Non response (NACK)” Two signals .ACK Low level ,NACK High level .
- The data is valid : When data is transmitted ,SCL For high voltage ,SDA The data is valid , That at this time SDA Show data for high level “1”, Show data for low level “0”; When SCL Low power level ,SDA Invalid data for , Usually at this time , Yes SDA Carry out level switching .

Focus on v-x- Male - many - Number :【 Embedded base 】
after - platform - return - complex :【 Electric competition 】 Information available
reply 【 Programming 】 Can get
It includes :C、C++、C#、JAVA、Python、JavaScript、PHP、 database 、 Wechat applet 、 Artificial intelligence 、 The embedded 、Linux、Unix、QT、 The Internet of things 、 Introduction to algorithms 、 Big data and other information

边栏推荐
- 图数据库ONgDB Release v-1.0.3
- Summary of three log knowledge points of MySQL
- GAMES202-WebGL中shader的編譯和連接(了解向)
- [noip2008 improvement group] stupid monkey
- F12 solve the problem that web pages cannot be copied
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
- 项目经理,你会画原型嘛?项目经理需要做产品设计了?
- Oracle deletes duplicate data, leaving only one
- [classic example] binary tree recursive structure classic topic collection @ binary tree
- Postman Association
猜你喜欢

Summary of redis basic knowledge points

Introduction of several RS485 isolated communication schemes

Nacos - TC Construction of High available seata (02)

Fiddler installed the certificate, or prompted that the certificate is invalid

Postman断言

The IPO of mesk Electronics was terminated: Henan assets, which was once intended to raise 800 million yuan, was a shareholder

The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower

The underlying structure of five data types in redis

趋势前沿 | 达摩院语音 AI 最新技术大全

Three methods of Oracle two table Association update
随机推荐
Realize a binary read-write address book
Huawei equipment is configured with OSPF and BFD linkage
What are the advantages of the industry private network over the public network? What specific requirements can be met?
Flink kakfa data read and write to Hudi
Simple understanding of interpreters and compilers
Weng Kai C language third week 3.1 punch in
win10电脑系统里的视频不显示缩略图
集合详解之 Map + 面试题
[classic example] binary tree recursive structure classic topic collection @ binary tree
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
MySQL if and ifnull use
ISP学习(2)
比尔·盖茨晒18岁个人简历,48年前期望年薪1.2万美元
Raspberry pie 3.5-inch white screen display connection
优秀PM必须经历这3层蜕变!
饼干(考试版)
麥斯克電子IPO被終止:曾擬募資8億 河南資產是股東
ISP learning (2)
Quatre méthodes de redis pour dépanner les grandes clés sont nécessaires pour optimiser