CN116301267A - I2c总线复位方法 - Google Patents
I2c总线复位方法 Download PDFInfo
- Publication number
- CN116301267A CN116301267A CN202310242221.9A CN202310242221A CN116301267A CN 116301267 A CN116301267 A CN 116301267A CN 202310242221 A CN202310242221 A CN 202310242221A CN 116301267 A CN116301267 A CN 116301267A
- Authority
- CN
- China
- Prior art keywords
- reset
- slave device
- communication
- sda line
- master device
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 7
- 238000004891 communication Methods 0.000 claims abstract description 11
- 230000005856 abnormality Effects 0.000 claims abstract description 3
- 238000005516 engineering process Methods 0.000 abstract description 2
- 238000001514 detection method Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 3
- 238000007493 shaping process Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F1/00—Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
- G06F1/24—Resetting means
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/42—Bus transfer protocol, e.g. handshake; Synchronisation
- G06F13/4282—Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2213/00—Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F2213/0016—Inter-integrated circuit (I2C)
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
I2C总线复位方法,涉及I2C通信技术。本发明包括下述步骤:(1)主设备判断通信状况,若出现异常需要从设备复位,则通过SDA线连续发送复位信号,所述复位信号为:前一时钟周期内出现一个start翻转,紧邻的后一周期内出现一个stop翻转;(2)从设备对SDA线上连续出现的复位信号进行计数,若连续出现的次数达到预设值,则对自身进行复位。本发明不占用额外的管脚,且通信序列简单,能大大降低通信失败的风险,复位目的稳定可靠。
Description
技术领域
本发明涉及I2C通信技术。
背景技术
I2C总线由SCL和SDA两个信号组成,具体芯片实现的时候通过内部寄存器实现系统复位功能,或者没有复位功能,但是在实际项目中往往需要通过复位来强制实现整体软硬件系统重启功能,从而达到全系统冗余设计的目的。但是在I2Cbus并没有专门的复位指令。
第一种现有技术是,增加一个专门的复位管脚。优点:逻辑简单,性能稳定可靠。缺点:会占用一个芯片管脚,成本增加,且某些定型器件实际使用场景并不允许这样做。
第二种现有技术是,通过增加内部寄存器比特位,通过控制寄存器比特位实现芯片软复位。优点:不占额外的管脚。缺点:受到I2C较繁琐的通信序列的限制,实际应用中受到各种影响并不能达到稳定复位的目的。
发明内容
本发明所要解决的技术问题是,提供一种低成本和高效率的I2C总线复位方法。
本发明解决所述技术问题采用的技术方案是,I2C总线复位方法,其特征在于,包括下述步骤:
(1)主设备判断通信状况,若出现异常需要从设备复位,则通过SDA线连续发送复位信号,所述复位信号为:前一时钟周期内出现一个start翻转,紧邻的后一周期内出现一个stop翻转;
(2)从设备对SDA线上连续出现的复位信号进行计数,若连续出现的次数达到预设值,则对自身进行复位。
本发明的有益效果是,不占用额外的管脚,且通信序列简单,能大大降低通信失败的风险,复位目的稳定可靠。
附图说明
图1是本发明的时序图。
图2是本发明的I2C主从设备示意图。
图3是本发明的复位检测电路原理图。
具体实施方式
参见图1,主机可以基于现有I2C实现方式,连续发送N次连续的Start/Stop请求,迫使从机I2C芯片产生复位行为。Start/Stop请求在SDA信号线上表现为电平翻转。Start缩写为ST,Stop缩写为SP。
从I2C接口逻辑实现识别N次连续的Start/Stop翻转,按照预定协议识别为主机发送了复位请求,以此产生复位信号,从设备据此对自身进行复位。所述预定协议为:若相邻两个时钟周期内,前一时钟周期内出现一个start翻转,紧邻的后一周期内出现一个stop翻转,即为复位请求。
参见图2和图3,从设备中有一个复位检测电路,该电路可连续检测总线上成对出现的start位和stop位的个数,当检测到一个start位后紧跟一个stop位时,则内部计数器cnt加1,若检测到了数据位data bit,则重新开始计数。当连续检测到N个连续的start bit和stop bit后,产生复位信号reset,可将从机复位。如上图所示,通过一个复位检测状态机实现,实际中可通过多种电路方式实现该检测。N可为固定的数值,也可在通信前通过I2C接口或者从设备的其他接口进行配置。
Claims (1)
1.I2C总线复位方法,其特征在于,包括下述步骤:
(1)主设备判断通信状况,若出现异常需要从设备复位,则通过SDA线连续发送复位信号,所述复位信号为:前一时钟周期内出现一个start翻转,紧邻的后一周期内出现一个stop翻转;
(2)从设备对SDA线上连续出现的复位信号进行计数,若连续出现的次数达到预设值,则对自身进行复位。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310242221.9A CN116301267A (zh) | 2023-03-14 | 2023-03-14 | I2c总线复位方法 |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310242221.9A CN116301267A (zh) | 2023-03-14 | 2023-03-14 | I2c总线复位方法 |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116301267A true CN116301267A (zh) | 2023-06-23 |
Family
ID=86781055
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310242221.9A Pending CN116301267A (zh) | 2023-03-14 | 2023-03-14 | I2c总线复位方法 |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116301267A (zh) |
-
2023
- 2023-03-14 CN CN202310242221.9A patent/CN116301267A/zh active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9229897B2 (en) | Embedded control channel for high speed serial interconnect | |
US10108578B2 (en) | Single wire communications interface and protocol | |
JP6517243B2 (ja) | リンクレイヤ/物理レイヤ(phy)シリアルインターフェース | |
TWI403909B (zh) | 主從式系統、主從式電腦系統以及用於在一主從式系統內傳達一中斷之方法 | |
US10169282B2 (en) | Bus serialization for devices without multi-device support | |
US8103896B2 (en) | Method and system for I2C clock generation | |
US10120590B2 (en) | Method for providing read data flow control or error reporting using a read data strobe | |
US20070088874A1 (en) | Offload engine as processor peripheral | |
US8386908B2 (en) | Data transmission methods and universal serial bus host controllers utilizing the same | |
CN101208682B (zh) | 具有锁存服务请求的从设备 | |
JPH06324977A (ja) | データ転送方法 | |
CN109062850B (zh) | 一种单片机的数据发送和接收方法 | |
CN106575269B (zh) | 串行边带信令链路 | |
WO2007030978A1 (fr) | Procede, appareil de reinitialisation et equipement pour effectuer la reinitialisation d'un dispositif maitre dans un bus i2c | |
CN109871344B (zh) | 通讯系统、接口电路及其传输信号的方法 | |
WO2005119448A1 (en) | Error recovery scheme for i2c slave | |
US8799545B2 (en) | Restoring stability to an unstable bus | |
US20140244874A1 (en) | Restoring stability to an unstable bus | |
US4972345A (en) | Apparatus for error detection and reporting on a synchronous bus | |
JP2018514873A (ja) | 集積回路間の通信 | |
CN116301267A (zh) | I2c总线复位方法 | |
CN111538626A (zh) | 一种从i2c设备解挂死的方法 | |
US11782792B2 (en) | PCIe interface and interface system | |
CN108183705B (zh) | 一种服务器系统单向总线传输方法 | |
CN111208892B (zh) | 一种用串行i2c信号对芯片系统实现复位的方法 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |