CN100346330C - Method for recovering communication of I2C main device and I2C slave device - Google Patents

Method for recovering communication of I2C main device and I2C slave device Download PDF

Info

Publication number
CN100346330C
CN100346330C CNB2005100534584A CN200510053458A CN100346330C CN 100346330 C CN100346330 C CN 100346330C CN B2005100534584 A CNB2005100534584 A CN B2005100534584A CN 200510053458 A CN200510053458 A CN 200510053458A CN 100346330 C CN100346330 C CN 100346330C
Authority
CN
China
Prior art keywords
main device
communication
main
line
data line
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.)
Expired - Fee Related
Application number
CNB2005100534584A
Other languages
Chinese (zh)
Other versions
CN1831801A (en
Inventor
叶荣标
邱锦
陈祺
柳精伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CNB2005100534584A priority Critical patent/CN100346330C/en
Publication of CN1831801A publication Critical patent/CN1831801A/en
Application granted granted Critical
Publication of CN100346330C publication Critical patent/CN100346330C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Transfer Systems (AREA)

Abstract

The present invention discloses a method for restoring the communication of an I<2>C main device and an I<2>C secondary device, which solves the problem in the prior art that the reset I<2>C main device can not continue the read operation on the I<2>C secondary device because the communication is abnormally interrupted. The method comprises the steps that SCL clock signals are forced to be input to the I<2>C secondary device by the I<2>C main device so as to make the I<2>C secondary device release SDA data lines, and thereby, the bus of the I<2>C can be restored to the normal readable and writeable state. The present invention compensates for the inadequacy of an I<2>C protocol by a software method, improves the interference rejection of the different I<2>C devices in the communication process, avoids the bus faults resulting from abnormal interruption of the communication and enhances the reliability of the system.

Description

Recover I 2C main device and I 2C is from the method for device communication
Technical field
The present invention relates to I 2C main device and I 2C relates in particular to a kind of recovery I from device 2C main device and I 2C is from the method for device communication.
Background technology
I 2C (Inter-Integrated Circuit, interactional integrated circuit) bus is a kind of two-wire system bus that is used for connecting between the integrated chip, it is a kind of universal serial bus that constitutes by SDA (serial data line) and SCL (serial time clock line), it is transmission information between the device of linking on the bus by SDA and SCL, and the highest transfer rate is 3.4Mbps.At present, I 2The C bus has become an international standard, is used widely in fields such as communication, industry control.
As certain I 2The C bus interface device is when bus sending information, and it is exactly I 2The C main device, and when its when bus receives information, become I again 2C is from device, I 2C main device and I 2C can work in from device and receive and transmit status.At I 2In the C bus course of work, in its idle condition, SDA and SCL all remain high level.
I 2Control signal on the C bus has three types, is respectively: commencing signal, end signal and answer signal, and its concrete concept is as follows:
When commencing signal: SCL was high level, SDA to low transition, began to transmit data by high level;
When end signal: SCL was high level, SDA to the high level saltus step, finished to transmit data by low level;
Answer signal: I 2When C is in accepting state from device, I 2C receives data from device at each rising edge of SCL, after receiving the 8bit data, at the 9th rising edge of SCL to I 2The C main device sends the ACK response bits of low level pulse, and data are correctly received in expression.
I 2The C bus must be by I 2The control of C main device, I 2The SCL signal that the C main device sends is used for the transmission direction of control bus, and produces the initial sum stop condition.Data mode on the sda line only could change during SCL is low level, SCL be high level during, the change of SDA state is used to represent the initial sum stop condition.
Traditionally, I 2C main device and I 2C is to be designed to independently from resetting of device, perhaps some I 2The C device does not just have the external reset input function, the electrification reset that has only energized to produce.Under this design, I 2Generally can both normal communication between the C principal and subordinate device, I can not appear 2The problem of C read-write failure.But at some in particular cases, principal and subordinate's device I may occur in the read-write communication process 2The C main device has resetted, and I 2The situation that C does not reset from device, for example: work as I 2C is in transmit status from device, i.e. I 2The C main device is to I 2When C carried out read operation from device, communication abnormality interrupted, I 2The data that C is sent when the communicating interrupt from device are " 0 ", and sda line keeps low level always, I 2C the state that continues such as is in from device always, can not discharge I 2The C bus.Even like this at I 2After the C main device normally resets, also can't with I 2C carries out normal communication from device.In this case, if do not take measures necessary, I 2The C main device is to I 2C will fail from the read operation of device always.
I commonly used 2The C device has two kinds, be respectively reset function self arranged with self no reset function.I for self no reset function 2The C device is (as the E on the memory bar SDRAM 2The PROM chip does not provide reseting interface separately), adopt I 2The C device descends the operation that re-powers behind the electricity to solve the problems referred to above.After re-powering, I 2The C device can carry out initialization automatically, thereby has recovered I 2The normal condition that the C device is read-write.This method needs manual intervention to recover I 2The normal condition of C device, self-healing property is relatively poor, works as I 2The communication failure rate of C device is than under the condition with higher, and its maintenance cost is higher; And in most cases the power supply of all devices is unified, is difficult to independent I 2The C device carries out the power-on and power-off operation.
For the I that reset function is arranged self 2The C device adopts independent control mode to recover its reset function, when breaking down, defective device is resetted specially, reinitializes I by reset operation 2The C device is fixed a breakdown.When adopting this mode to reset, principal and subordinate I 2The precedence relationship complexity that resets of C device needs before resetting through complicated judgement defective device, and needs the corresponding external circuit of design that reset passages is provided, thereby has increased the coupling of system greatly; The I that reset function is arranged in addition 2Though the C device provides reseting interface, reset can carry out initialization to entire device, rather than initialization I only 2C interface has caused influence more on a large scale thus.
Summary of the invention
The object of the present invention is to provide a kind of recovery I 2C main device and I 2C is from the method for device communication, to solve in the prior art because of I 2The C bus communication interrupts and the I that causes 2After resetting, can't continue the C main device I 2C carries out the problem of read operation from device.
For addressing the above problem, the invention provides following technical scheme:
A kind of recovery I 2C main device and I 2C is from the method for device communication, described I 2C main device and I 2C carries out communication from device by serial data line and serial time clock line; As described I 2C main device and I 2C carries out following step after the device communicating interrupt:
A, I resets 2The C main device;
B, I 2The C main device detects serial data line, and when detecting serial data line and be in occupied state by serial clock alignment I 2C is from the device input clock signal, up to I 2C returns to normal read-write state from device.
Described serial data line is in occupied state and is meant that serial data line is in low level state.
In described step B, I 2The C main device is given I by serial time clock line 2C is from the device clock enabling signal I at least 9 cycles of input 2The byte that C is sending during with communicating interrupt from device continues to send and finishes.
Described step B comprises step:
B1, I 2The C main device detects serial data line, if serial data line is in occupied state, execution in step b2; Otherwise confirm I 2C returns to normal read-write state from device.
B2, I 2The C main device is given I by serial time clock line 2C returns execution in step b1 after the clock signal in n cycle of device input, wherein n is smaller or equal to 8 integer more than or equal to 1;
I 2The C main device is given I by serial time clock line 2C is from the device clock signal in 9 cycles of input.
Because the present invention has adopted above technical scheme, so have following beneficial effect:
The present invention is at I 2C main device and I 2When C interrupts from the device communication abnormality, by I 2The C main device is forced to I 2C makes I from device input SCL clock signal 2C discharges the SDA data line from device, thereby makes I 2The C bus recovery is to normal read-write state.The present invention has remedied I with the method for software 2Deficiency on the C agreement has improved different I 2Anti-interference in the C device communication process has reduced the cost of fault recovery, has increased the reliability of system.
Description of drawings
Fig. 1 is for solving I 2The process flow diagram of C bus communication fault method one;
Fig. 2 is I 2C discharges I from device 2The sequential synoptic diagram of C bus;
Fig. 3 is for solving I 2The process flow diagram of C bus communication fault method two;
Fig. 4 is the synoptic diagram of specific embodiments of the invention.
Embodiment
I 2C main device and I 2C is from devices use I 2The C bus is carried out in the process of communication, if I 2The C main device is to I 2When C carried out read operation from device, communication abnormality interrupted, I 2The data that C is sent when the communicating interrupt from device are " 0 ", like this at I 2Behind the C main device electrification reset, sda line keeps low level, I always 2C the state that continues such as is in from device always, so I 2The C main device can't with I 2C carries out normal communication from device.
If I 2The data that C is sent when the communicating interrupt from device are " 1 ", and then sda line is a high level, like this at I 2Behind the C main device electrification reset, I 2C can discharge bus, I from device 2The C main device can be visited I 2C can be to I from device 2C initiates new communication from device.But, because at I 2The point on opportunity that the C bus communication interrupts is difficult to control I 2C is from the output state of device, and the ratio of output " 0 " and output " 1 " roughly is respectively 50%, so be necessary to provide a kind of at I 2Recover I during C bus communication aborted 2C main device and I 2C is from the method for device communication.
As shown in Figure 1, at I 2During C bus communication generation aborted, if I 2The C main device detects sda line and keeps low level, i.e. I always after normally resetting 2The situation that C can't recover from device, in this case, as shown in Figure 2, I 2The C main device is forced to I 2C is from the device SCL clock signal in one period at least 9 cycle of input, I 2After several (1~8) that C is left from the byte that device is sending when clock drives down with communicating interrupt at this moment sent, sda line became high level, I 2C discharges sda line from device, I 2C returns to normal read-write state from device.
Because I 2C is from any one that opportunity of device communicating interrupt, point might be in the middle of 8 of bytes, so I 2The C main device is forced to I 2C can make I from one section 9 SCL clock signals more than the clock period of device input 2C fully discharges sda line from device, guarantees I 2The C main device is to I 2C is from the communication again of device.
At I 2During C bus communication generation aborted, if I 2The C main device detects sda line and keeps low level situation also can adopt following method to solve always after normally resetting:
As shown in Figure 3, I at first 2The C main device is given I by scl line 2C is from the clock signal in n cycle of device input, and n is smaller or equal to 8 integer more than or equal to 1; I then 2The C main device detects the state of sda line, if sda line is then I of high level 2C returns to normal read-write state from device; If sda line is then I of low level 2The C main device continues to give I by scl line 2C is from the clock signal in n cycle of device input, after sda line becomes high level, and I 2C returns to normal read-write state from device.
Figure 4 shows that a specific embodiment of the present invention, wherein MPC8260 is I 2The C main device, the E on the memory bar 2PROM (Electrically-Erasable Programmable Read-Only Memory, electricallyerasable ROM (EEROM)) is I 2C is from device, and PD14/PD15 is IO (Input Output, the input and output) pin of MPC8260; MPC8260 reads the E that is stored in memory bar by SCL and SDA 2Information on the PROM, this information comprise information such as the line number, columns, BANK number, time delay of memory bar.
At I 2In the C communication process, when MPC8260 was carrying out read operation to memory bar, communication abnormality interrupted, and the data that memory bar is sent when communicating interrupt are " 0 ", if MPC8260 has resetted, and the E on the memory bar 2PROM does not recover, and sda line keeps low level always, the state that continues such as still is in, and can not discharge I 2The C bus, so, I 2C main device MPC8260 can't with the E on the memory bar 2PROM carries out normal I 2The C communication.After MPC8260 detects the SDA data line and is dragged down, by scl line to I 2C makes the E on the memory bar from the device clock signal in 9 cycles of transmission 2The byte that PROM is sending when clock drives down with communicating interrupt at this moment continues to send and finishes, and sda line becomes high level, the E on the memory bar 2PROM returns to normal read-write state, and MPC8260 just can continue the E on the memory bar 2PROM initiates new read-write operation.
In the above-described embodiments, after MPC8260 detects the SDA data line and is dragged down, also can be to the E on the memory bar 2The clock signal in n cycle of PROM input, n is smaller or equal to 8 integer more than or equal to 1; MPC8260 detects the state of sda line then, if sda line is the E on the high level memory bar 2PROM returns to normal read-write state; If sda line be low level then MPC8260 continue by scl line to the E on the memory bar 2The clock signal in PROM n cycle of input becomes high level up to sda line, the E on the memory bar 2PROM returns to till the normal read-write state.
Below only the present invention will be described with preferred embodiment, and those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, if of the present invention these are revised and modification belongs within the scope of claim of the present invention and equivalent technologies thereof, then the present invention also is intended to comprise these changes and modification interior.

Claims (5)

1, a kind of recovery I 2C main device and I 2C is from the method for device communication, described I 2C main device and I 2C carries out communication from device by serial data line and serial time clock line; It is characterized in that: as described I 2C main device and I 2C carries out following step after the device communicating interrupt:
A, I resets 2The C main device;
B, I 2The C main device detects serial data line, and when detecting serial data line and be in occupied state by serial clock alignment I 2C is from the device input clock signal, up to I 2C returns to normal read-write state from device.
2, recovery I according to claim 1 2C main device and I 2C is characterized in that from the method for device communication: described serial data line is in occupied state and is meant that serial data line is in low level state.
3, recovery I according to claim 1 2C main device and I 2C is characterized in that from the method for device communication: in described step B, and I 2The C main device is given I by serial time clock line 2C is from the device clock enabling signal I at least 9 cycles of input 2The byte that C is sending during with communicating interrupt from device continues to send and finishes.
4, recovery I according to claim 1 2C main device and I 2C is characterized in that from the method for device communication: described step B comprises step:
B1, I 2The C main device detects serial data line, if serial data line is in occupied state, execution in step b2; Otherwise confirm I 2C returns to normal read-write state from device;
B2, I 2The C main device is given I by serial time clock line 2C returns execution in step b1 after the clock signal in n cycle of device input, wherein n is smaller or equal to 8 integer more than or equal to 1.
5, recovery I according to claim 3 2C main device and I 2C is characterized in that from the method for device communication: I 2The C main device is given I by serial time clock line 2C is from the device clock signal in 9 cycles of input.
CNB2005100534584A 2005-03-10 2005-03-10 Method for recovering communication of I2C main device and I2C slave device Expired - Fee Related CN100346330C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2005100534584A CN100346330C (en) 2005-03-10 2005-03-10 Method for recovering communication of I2C main device and I2C slave device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2005100534584A CN100346330C (en) 2005-03-10 2005-03-10 Method for recovering communication of I2C main device and I2C slave device

Publications (2)

Publication Number Publication Date
CN1831801A CN1831801A (en) 2006-09-13
CN100346330C true CN100346330C (en) 2007-10-31

Family

ID=36994110

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2005100534584A Expired - Fee Related CN100346330C (en) 2005-03-10 2005-03-10 Method for recovering communication of I2C main device and I2C slave device

Country Status (1)

Country Link
CN (1) CN100346330C (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100426274C (en) * 2005-08-08 2008-10-15 中兴通讯股份有限公司 Method and device for preventing I2C bus locked
CN101354689B (en) * 2007-07-24 2010-09-01 明基电通股份有限公司 System and method for transmitting signal
CN100504831C (en) * 2007-08-31 2009-06-24 中兴通讯股份有限公司 Method and apparatus for recovering I2C bus locked by slave device
CN101770443B (en) * 2009-01-07 2012-05-23 成都市华为赛门铁克科技有限公司 Time sequence adjusting method for internal IC (integrated circuit) bus, corresponding device and system thereof
CN101561790B (en) * 2009-05-27 2011-10-26 中兴通讯股份有限公司 Method, system and device for communication between main control computer and slave computers
CN103092175B (en) * 2013-01-21 2015-04-15 杭州华三通信技术有限公司 Controlling method and device for serial clock line (SCL) between inter-integrated circuit (I2C) master equipment and slave equipment
CN104699549B (en) * 2013-12-04 2019-07-26 联想(北京)有限公司 A kind of information acquisition method, method for sending information and electronic equipment
FR3023633B1 (en) * 2014-07-11 2016-07-29 Peugeot Citroen Automobiles Sa DEVICE FOR MANAGING ERRORS ON A SERIAL UNIVERSAL BUS
CN109976489B (en) * 2019-03-28 2021-04-27 烽火通信科技股份有限公司 Automatic reset implementation method and system under IIC (inter-Integrated Circuit) bus abnormal condition
CN110908841B (en) * 2019-12-03 2022-09-20 锐捷网络股份有限公司 I2C communication abnormity recovery method and device
TWI837031B (en) * 2023-06-28 2024-03-21 明泰科技股份有限公司 I2c bus monitoring device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1456982A (en) * 2002-05-10 2003-11-19 英业达股份有限公司 Multitasking serial channel device with anti-locking device
CN1537281A (en) * 2001-06-29 2004-10-13 �ʼҷ����ֵ������޹�˾ Generalized I2C slave transmitter/receiver state machine
US20040252642A1 (en) * 2003-06-12 2004-12-16 Larson Thane M. Method of overflow recovery of I2C packets on an I2C router

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1537281A (en) * 2001-06-29 2004-10-13 �ʼҷ����ֵ������޹�˾ Generalized I2C slave transmitter/receiver state machine
CN1456982A (en) * 2002-05-10 2003-11-19 英业达股份有限公司 Multitasking serial channel device with anti-locking device
US20040252642A1 (en) * 2003-06-12 2004-12-16 Larson Thane M. Method of overflow recovery of I2C packets on an I2C router

Also Published As

Publication number Publication date
CN1831801A (en) 2006-09-13

Similar Documents

Publication Publication Date Title
CN100346330C (en) Method for recovering communication of I2C main device and I2C slave device
CN102073613B (en) Device and method for removing deadlock of I&lt;2&gt;C (Inter-Integrated Circuit) bus
US7536584B2 (en) Fault-isolating SAS expander
CN102521187B (en) Method for solving communication deadlock of I2C (Inter-Integrated Circuit) bus
EP2052326B1 (en) Fault-isolating sas expander
CN103019871B (en) A kind of anti-deadlock system of I2C bus and deadlock prevention method thereof
US7478286B2 (en) Circuit and method of detecting and resolving stuck I2C buses
US20060161714A1 (en) Method and apparatus for monitoring number of lanes between controller and PCI Express device
CN102087621B (en) Processor device with self-diagnosis function
CN102387074B (en) Line processing unit (LPU) card in-place detecting and resetting method and main processing unit (MPU) card and LPU card
CN105259863A (en) PLC warm backup redundancy method and system
CN101282301A (en) Double-redundancy CAN bus controller as well as packet processing method thereof
CN100426274C (en) Method and device for preventing I2C bus locked
WO2022057372A1 (en) Iic hang link restoration circuit and method based on pca9511 chip
CN107942808B (en) DCS capacity expanding device
CN102662902B (en) Method, device and system for preventing I2C (inter-integrated circuit) bus locking
CN112019455B (en) Switch monitoring device and method based on programmable logic device
CN204633800U (en) The switch of a kind of administrative unit and the two redundancy of crosspoint
CN102231700A (en) Exchange card switching information transmission method and exchange card hot backup system
CN111538626A (en) Method for releasing from I2C equipment
CN113721448B (en) Redundant module switching method and device
CN111522757A (en) I2C bus-based interrupt reading and clearing control method
CN101378339B (en) Control method and apparatus, business board for heat insertion and pull
CN112463707A (en) I2C link management system and method
CN104834624A (en) Anti-interference method for IIC bus interface

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20071031

CF01 Termination of patent right due to non-payment of annual fee