CN102567133B - Method for implementing communication by means of interruption I2C (inter to integrated circuit) devices and I2C system - Google Patents

Method for implementing communication by means of interruption I2C (inter to integrated circuit) devices and I2C system Download PDF

Info

Publication number
CN102567133B
CN102567133B CN201110461107.2A CN201110461107A CN102567133B CN 102567133 B CN102567133 B CN 102567133B CN 201110461107 A CN201110461107 A CN 201110461107A CN 102567133 B CN102567133 B CN 102567133B
Authority
CN
China
Prior art keywords
information
data message
data
buffer memory
check information
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.)
Active
Application number
CN201110461107.2A
Other languages
Chinese (zh)
Other versions
CN102567133A (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.)
GUANGZHOU VIDEO-STAR ELECTRONICS CO LTD
Original Assignee
GUANGZHOU VIDEO-STAR 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 GUANGZHOU VIDEO-STAR Co Ltd filed Critical GUANGZHOU VIDEO-STAR Co Ltd
Priority to CN201110461107.2A priority Critical patent/CN102567133B/en
Publication of CN102567133A publication Critical patent/CN102567133A/en
Application granted granted Critical
Publication of CN102567133B publication Critical patent/CN102567133B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Communication Control (AREA)

Abstract

The invention discloses a method for implementing communication by means of interruption, I2C (inter to integrated circuit) devices and an I2C system. In the technical scheme, the method includes the steps: utilizing the master I2C device to compute data information required to be transmitted in a preset manner to obtain verification information and then to transmit an instruction comprising the data information and the verification information to the slave I2C device; and utilizing the slave I2C device to receive the data information and the verification information transmitted by the master I2C device, compute the data information to obtain validation information in a preset manner and judge whether the validation information is as same as the verification information, performing subsequent processing operations for the data information if the validation information is as same as the verification information, otherwise, marking the data information as error information and storing the data information into a cache. By means of a process of setting information validation on the master I2C device and the slave I2C device, subsequent processing errors due to data loss during data transmission are avoided, so that error rate during data processing is decreased.

Description

A kind of by implement of interruption function communication means, I2C device and I2C system
Technical field
The present invention relates to communication technical field, in particular, relate to by implement of interruption function communication means, I2C device and I2C system.
Background technology
I2C (Inter-Integrated Circuit) bus is the twin wire universal serial bus developed by PHILIPS company, for connecting microcontroller and peripherals thereof.I2C main device and I2C are exactly based on the controller I2C bus from device, and I2C main device and I2C are widely used from device.
Existing I2C is only provided with address of devices and answer signal from device, and when an I2C main device sends data to I2C from device time, I2C can recognize it is the request which I2C main device proposes from device by address of devices; I2C after the data processing the transmission of I2C main device, can send answer signal from device, to notify that the process of I2C main device completes, waits for that I2C main device obtains I2C again from the processed data completed of device.
To in the research and practice process of prior art, the present inventor finds that prior art exists following problem:
Send the process of data at I2C main device to I2C from device, likely because certain reason causes loss of data, and I2C from device receive and process be mistake data, and the data of mistake also can be returned to I2C main device from device by I2C, thus cause whole process to go wrong, so the error rate of existing I2C device in data communication process is high.
Therefore, how to reduce the error rate of I2C device in data communication process, become the problem needing most solution at present.
Summary of the invention
In view of this, purpose of design of the present invention is, provides a kind of by implement of interruption function communication means, I2C device and I2C system, to reduce the error rate of I2C device in data communication process.
The embodiment of the present invention is achieved in that
A kind of by implement of interruption function communication means, comprising:
Obtain data message to be sent;
The check information of described data message is calculated by predetermined manner;
The instruction comprising described data message and described check information is sent to I2C from device;
Read described I2C from the information the buffer memory of device;
When in described buffer memory there is error message time, then send to described I2C from device and comprise the instruction of described data message and described check information, there is not described error message in described buffer memory till.
Preferably, above-mentioned by implement of interruption function communication means, described predetermined manner be specially described data message be added after remainder again.
A kind of by implement of interruption function communication means, comprising:
By interrupting the instruction comprising data message and check information obtaining the transmission of I2C main device;
The authorization information of described data message is calculated by predetermined manner;
Judge that whether described authorization information is identical with described check information, if identical, then described data message is processed, then the data after process are put into buffer memory; Otherwise, described data message is labeled as error message and puts into buffer memory.
Preferably, above-mentioned by implement of interruption function communication means, described predetermined manner be specially described data message be added after remainder again.
Preferably, pass through in implement of interruption function communication means above-mentioned, described instruction also comprises end mark;
When receiving the end mark in described instruction, then terminate this reception.
Preferably, above-mentioned by implement of interruption function communication means, when processing described data message, Status Flag in process is put into buffer memory.
Preferably, above-mentioned by implement of interruption function communication means, when carrying out process to described data message and completing, process completed Status Flag and puts into buffer memory.
A kind of I2C main device, comprising:
Acquiring unit, for obtaining data message to be sent;
Computing unit, for calculating the check information of described data message by predetermined manner;
Transmitting element, for sending the instruction comprising described data message and described check information to I2C from device;
Reading unit, for reading described I2C from the information the buffer memory of device;
Judging unit, for when in described buffer memory there is error message time, then described transmitting element sends the instruction comprising described data message and described check information to described I2C from device, there is not described error message in described buffer memory till.
A kind of I2C, from device, comprising:
Receiving element, for obtaining the instruction comprising data message and check information that I2C main device sends by interruption;
Computing unit, for calculating the authorization information of described data message by predetermined manner;
Judging unit, for judging that whether described authorization information is identical with described check information;
Processing unit, for when described authorization information is identical with described check information, processes described data message, then the data after process are put into buffer memory;
Mistake mark unit, for when described authorization information is different from described check information, is labeled as error message by described data message and puts into buffer memory.
A kind of I2C system, comprises I2C main device and I2C from device;
Described I2C main device, for obtaining data message to be sent; The check information of described data message is calculated by predetermined manner; The instruction comprising described data message and described check information is sent to I2C from device; Read described I2C from the information the buffer memory of device; When in described buffer memory there is error message time, then send to described I2C from device and comprise the instruction of described data message and described check information, there is not described error message in described buffer memory till.
Described I2C from device, for by interrupt obtain I2C main device send the instruction comprising data message and check information; The authorization information of described data message is calculated by predetermined manner; Judge that whether described authorization information is identical with described check information, if identical, then described data message is processed, then the data after process are put into buffer memory; Otherwise, described data message is labeled as error message and puts into buffer memory.
Compared with prior art, the technical scheme that the present embodiment provides has the following advantages and feature:
In scheme provided by the invention, the data message needing to send first is calculated by the mode preset by I2C main device, thus obtains check information, then sends the instruction comprising data message and check information to I2C from device; I2C receives data message and the check information of I2C main device transmission from device, and calculate this data message be verified information by the mode preset, judge that whether authorization information is identical with check information again, if identical, then post-treatment operations is carried out to this data message, otherwise, data message is labeled as error message and puts into buffer memory.The process that the present invention verifies from device two ends configuration information at I2C main device and I2C, causes subsequent treatment mistake to avoid factor data in data transmission procedure to lose, thus reduces the error rate in data handling procedure.
Accompanying drawing explanation
In order to be illustrated more clearly in the present invention or technical scheme of the prior art, be briefly described to the accompanying drawing used required in embodiment or description of the prior art below, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
Fig. 1 is a kind of process flow diagram by implement of interruption function communication means provided by the present invention;
Fig. 2 is the process flow diagram of another kind provided by the present invention by implement of interruption function communication means;
Fig. 3 is the module map of a kind of I2C system provided by the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
Embodiments provide a kind of by implement of interruption function communication means, I2C device and I2C system, to solve the high problem of the error rate in data communication process that exists in prior art.
Owing to there is various ways above by the specific implementation of implement of interruption function communication means, I2C device and I2C system, be described in detail below by specific embodiment:
Shown in Figure 1, shown in Fig. 1 is a kind of by implement of interruption function communication means, and the method is applicable to I2C main device, and the method comprises:
Step S11, obtain data message to be sent;
Step S12, calculated the check information of described data message by predetermined manner;
Step S13, to send to I2C from device and comprise the instruction of described data message and described check information;
Step S14, read described I2C from the information the buffer memory of device;
Step S15, when in described buffer memory there is error message time, then return step S13, there is not described error message in described buffer memory till.
In the embodiment shown in fig. 1, I2C main device needs the check information first being calculated data message pending by predetermined manner, send to I2C from device again after data message and check information, also to read I2C again from the information the buffer memory of device, judge whether I2C is error message from the information the buffer memory of device, if, then illustrate and to send at I2C main device the situation occurring loss of data the process of data to I2C from device, I2C main device is needed again to send data message and check information to I2C from device, till there is not described error message in I2C from the buffer memory of device.Can be found out by the embodiment shown in Fig. 1, the invention provides the ability that I2C main device has correcting data error.
In addition, predetermined manner be in step s 12 specially described data message be added after remainder again, certainly, this account form can also adopt other modes, so in an embodiment of the present invention, is not limited thereto kind of a method, can also adopts other modes.But, I2C main device and I2C from the mode that device uses want identical.
Shown in Figure 2, shown in Fig. 2 is another kind of by implement of interruption function communication means, and the method is applicable to I2C from device, and the method comprises:
Step S21, by interrupt obtain I2C main device send the instruction comprising data message and check information;
Step S22, calculated the authorization information of described data message by predetermined manner;
Step S23, judge that whether described authorization information is identical with described check information;
If step S24 is identical, then described data message is processed, then the data after process are put into buffer memory;
Step S25 otherwise, described data message is labeled as error message and puts into buffer memory.
In the embodiment shown in Figure 2, I2C calculates authorization information from device by predetermined manner, then judge that whether the authorization information calculated is identical with check information, if identical, then illustrate that data message does not lose any information being sent to I2C from I2C main device from the process of device, namely I2C is correct from the data message that device receives, thus can carry out follow-up process operation; If different, so illustrate that data message is being sent to the loss that I2C exists information from the process of device, so need data message is labeled as error message and puts into buffer memory from I2C main device.In the process, whether I2C can be correct according to the compare data message that judges to obtain of the check information received and the authorization information oneself calculated from device, thus the process also proceeding data when obtaining the data message of mistake can be avoided, after finding the data message mistake received, stop subsequent operation at once, buffer memory is put into, so that I2C main device can from new transmission after finding after directly being mislabeled by this data message.
In the embodiment shown in Figure 2, in the step s 21, interrupt referring to when occurring needing, I2C temporarily stops the execution of present procedure from device, then performs program and the implementation of disposition.In addition, the predetermined manner in step S22 be specially described data message be added after remainder again, certainly, this account form can also adopt other modes, so in an embodiment of the present invention, is not limited thereto kind of a method, can also adopts other modes.But, I2C main device and I2C from the mode that device uses want identical.
In the embodiment shown in Figure 2, in the step s 21, instruction can also comprise end mark; When to receive the end mark described instruction from device as I2C, then terminate this reception.When processing described data message, Status Flag in process is put into buffer memory.When carrying out process to described data message and completing, process is completed Status Flag and puts into buffer memory.
Shown in Figure 3, shown in Fig. 3 is a kind of I2C system, comprises I2C main device 1 and I2C from device 2.I2C main device 1 comprises acquiring unit 11, computing unit 12, transmitting element 13, reading unit 14 and judging unit 15, and wherein, acquiring unit 11, for obtaining data message to be sent; Computing unit 12, for calculating the check information of described data message by predetermined manner; Transmitting element 13, for sending the instruction comprising described data message and described check information to I2C from device 2; Reading unit 14, for reading described I2C from the information the buffer memory 26 of device 2; Judging unit 15, for when in described buffer memory 26 there is error message time, then sent the instruction comprising described data message and described check information to described I2C from device 2 by described transmitting element 13, there is not described error message in described buffer memory 26 till.I2C comprises receiving element 21, computing unit 22, judging unit 23, processing unit 24 and mistake mark unit 25 from device 2, and wherein, receiving element 21, for obtaining the instruction comprising data message and check information that I2C main device 1 sends by interruption; Computing unit 22, for calculating the authorization information of described data message by predetermined manner; Judging unit 23, for judging that whether described authorization information is identical with described check information; Processing unit 24, for when described authorization information is identical with described check information, processes described data message, then the data after process are put into buffer memory 26; Mistake mark unit 25, for when described authorization information is different from described check information, is labeled as error message by described data message and puts into buffer memory 26.
In the embodiment shown in fig. 3, because this I2C system is corresponding with said method, thus can with method part cross-reference, do not repeat them here.
In sum, the data message needing to send first is calculated by the mode preset by I2C main device, thus obtains check information, then sends the instruction comprising data message and check information to I2C from device; I2C receives data message and the check information of I2C main device transmission from device, and calculate this data message be verified information by the mode preset, judge that whether authorization information is identical with check information again, if identical, then post-treatment operations is carried out to this data message, otherwise, data message is labeled as error message and puts into buffer memory.The process that the present invention verifies from device two ends configuration information at I2C main device and I2C, causes subsequent treatment mistake to avoid factor data in data transmission procedure to lose, thus reduces the error rate in data handling procedure.
It should be noted that, the embodiment shown in Fig. 1 to Fig. 3 is the preferred embodiment that the present invention introduces, and those skilled in the art on this basis, can design more embodiment completely, therefore not repeat herein.
To be apparent for those skilled in the art to the multiple amendment of these embodiments, General Principle as defined herein can without departing from the spirit or scope of the present invention, realize in other embodiments.Therefore, the present invention can not be restricted to these embodiments shown in this article, but will meet the widest scope consistent with principle disclosed herein and features of novelty.

Claims (1)

1. an I2C system, is characterized in that, comprises I2C main device and I2C from device;
Described I2C main device, comprising:
Acquiring unit, for obtaining data message to be sent;
Computing unit, for calculating the check information of described data message by predetermined manner;
Transmitting element, for sending the instruction comprising described data message and described check information to I2C from device;
Reading unit, for reading described I2C from the information the buffer memory of device;
Judging unit, for when in described buffer memory there is error message time, then described transmitting element sends the instruction comprising described data message and described check information to described I2C from device, there is not described error message in described buffer memory till;
Described I2C, from device, comprising:
Receiving element, for obtaining the instruction comprising data message and check information that I2C main device sends by interruption;
Computing unit, for calculating the authorization information of described data message by predetermined manner;
Judging unit, for judging that whether described authorization information is identical with described check information;
Processing unit, for when described authorization information is identical with described check information, processes described data message, then the data after process are put into buffer memory;
Mistake mark unit, for when described authorization information is different from described check information, is labeled as error message by described data message and puts into buffer memory.
CN201110461107.2A 2011-12-31 2011-12-31 Method for implementing communication by means of interruption I2C (inter to integrated circuit) devices and I2C system Active CN102567133B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110461107.2A CN102567133B (en) 2011-12-31 2011-12-31 Method for implementing communication by means of interruption I2C (inter to integrated circuit) devices and I2C system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110461107.2A CN102567133B (en) 2011-12-31 2011-12-31 Method for implementing communication by means of interruption I2C (inter to integrated circuit) devices and I2C system

Publications (2)

Publication Number Publication Date
CN102567133A CN102567133A (en) 2012-07-11
CN102567133B true CN102567133B (en) 2015-03-04

Family

ID=46412616

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110461107.2A Active CN102567133B (en) 2011-12-31 2011-12-31 Method for implementing communication by means of interruption I2C (inter to integrated circuit) devices and I2C system

Country Status (1)

Country Link
CN (1) CN102567133B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106815162B (en) * 2015-11-27 2019-08-16 佛山市顺德区顺达电脑厂有限公司 The inter-integrated circuit means of communication and expanding unit

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6728908B1 (en) * 1999-11-18 2004-04-27 California Institute Of Technology I2C bus protocol controller with fault tolerance
CN101140556A (en) * 2007-09-11 2008-03-12 中兴通讯股份有限公司 Method and device for realizing accessing multiple I2C slave device by programmable device
CN101719110A (en) * 2009-12-18 2010-06-02 烽火通信科技股份有限公司 Real-time monitoring method of multipath I2C device in optical communication device
CN102262572A (en) * 2011-07-19 2011-11-30 浙江大学 Inter integrated circuit (IIC) bus interface controller with cyclic redundancy checking (CRC) function

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101615145B (en) * 2009-07-24 2011-12-07 中兴通讯股份有限公司 Method and device for improving reliability of data caching of memorizer

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6728908B1 (en) * 1999-11-18 2004-04-27 California Institute Of Technology I2C bus protocol controller with fault tolerance
CN101140556A (en) * 2007-09-11 2008-03-12 中兴通讯股份有限公司 Method and device for realizing accessing multiple I2C slave device by programmable device
CN101719110A (en) * 2009-12-18 2010-06-02 烽火通信科技股份有限公司 Real-time monitoring method of multipath I2C device in optical communication device
CN102262572A (en) * 2011-07-19 2011-11-30 浙江大学 Inter integrated circuit (IIC) bus interface controller with cyclic redundancy checking (CRC) function

Also Published As

Publication number Publication date
CN102567133A (en) 2012-07-11

Similar Documents

Publication Publication Date Title
CN111953387B (en) Near field communication and wireless power
TWI730993B (en) First communication device, communication method, and communication system
US10482047B2 (en) Slave device connected to master device via I2C bus and communication method thereof
CN107908589B (en) I3C communication verification system and method for verifying slave device and master-slave device
TWI512449B (en) Methods and apparatus for reducing power consumption within embedded systems
CN108733600B (en) Electronic system with direct memory access controller and method of operating the same
US7774638B1 (en) Uncorrectable data error containment systems and methods
US20130185472A1 (en) Techniques for improving throughput and performance of a distributed interconnect peripheral bus
TW201642535A (en) Universal serial bus (USB) hub for connecting different port types and method thereof
CN104184543A (en) Data transmission method, device and system
CN102567133B (en) Method for implementing communication by means of interruption I2C (inter to integrated circuit) devices and I2C system
CN105549974A (en) Chip firmware updating method and system
CN110809002A (en) Method for protocol conversion between robot and welding equipment and protocol conversion module
CN104360973A (en) Communicating system, communicating method and relevant communicating devices
US10805043B2 (en) Data transmission apparatus and data transmission method, reception device and reception method, program, and data transmission system
KR101685407B1 (en) Direct memory access device for multicore system and method of the same
RU2018145653A (en) SYSTEMS AND METHODS FOR INITIALIZING THE CONFIGURATION OF DEVICES WORKING IN INDUSTRIAL AUTOMATION ENVIRONMENTS
JP2016177333A (en) Information processing apparatus and control method thereof
US9621339B1 (en) Host devices and data transmission methods
US8301817B1 (en) Ring bus for sharing resources among multiple engines
CN104850517A (en) Method and apparatus for transmitting packet data using DMA
CN104219004A (en) Electronic device and data processing method and device thereof
CN110543442B (en) Data transmission cut-off recovery method, device and system
US20110246684A1 (en) Method for adjusting the transmission speed of the electronic aid
JP5867350B2 (en) Electronic control device for vehicle

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
ASS Succession or assignment of patent right

Owner name: GUANGZHOU VIDEO-STAR INTELLIGENT TECHNOLOGY CO., L

Free format text: FORMER OWNER: GUANGZHOU VIDEO-STAR ELECTRONICS CO., LTD.

Effective date: 20150715

C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20150715

Address after: 510730 Guangdong province Guangzhou city four street bluejade Guangzhou economic and Technological Development Zone No. nine, No. 6 Building 601 room

Patentee after: GUANGZHOU VIDEO-STAR ELECTRONICS Co.,Ltd.

Address before: 510730 Guangdong province Guangzhou city four street bluejade Guangzhou economic and Technological Development Zone No. nine, No. 6 Building 601 room

Patentee before: Guangzhou Video-star Electronics Co.,Ltd.

CP01 Change in the name or title of a patent holder

Address after: 510730 Guangdong province Guangzhou city four street bluejade Guangzhou economic and Technological Development Zone No. nine, No. 6 Building 601 room

Patentee after: Guangzhou visual sound intelligent technology Co.,Ltd.

Address before: 510730 Guangdong province Guangzhou city four street bluejade Guangzhou economic and Technological Development Zone No. nine, No. 6 Building 601 room

Patentee before: GUANGZHOU VIDEO-STAR ELECTRONICS Co.,Ltd.

CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: 510730 Room 601, plant 6, No. 9, Lanyu 4th Street, Guangzhou Economic and Technological Development Zone, Guangzhou, Guangdong Province

Patentee after: GUANGZHOU VIDEO-STAR ELECTRONICS Co.,Ltd.

Address before: 510730 Room 601, plant 6, No. 9, Lanyu 4th Street, Guangzhou Economic and Technological Development Zone, Guangzhou, Guangdong Province

Patentee before: Guangzhou visual sound intelligent technology Co.,Ltd.

CP01 Change in the name or title of a patent holder