CN103229158A - Control circuit and control method for inter-integrated circuit bus - Google Patents
Control circuit and control method for inter-integrated circuit bus Download PDFInfo
- Publication number
- CN103229158A CN103229158A CN2012800029333A CN201280002933A CN103229158A CN 103229158 A CN103229158 A CN 103229158A CN 2012800029333 A CN2012800029333 A CN 2012800029333A CN 201280002933 A CN201280002933 A CN 201280002933A CN 103229158 A CN103229158 A CN 103229158A
- Authority
- CN
- China
- Prior art keywords
- slave
- driving
- driving device
- master
- group
- 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
Images
Classifications
-
- 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/382—Information transfer, e.g. on bus using universal interface adapter
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Bus Control (AREA)
- Information Transfer Systems (AREA)
Abstract
本发明涉及I2C总线控制电路和控制方法,该电路包括:I2C主器件、多个I2C器件组;I2C器件组包括I2C驱动器件和多个I2C从器件;I2C主器件的I2C接口与I2C驱动器件连接;其IO接口与I2C驱动器件的使能端连接;I2C驱动器件的一端与多个I2C从器件连接;I2C主器件向I2C驱动器件发送使能信号;I2C主器件向使能状态的I2C驱动器件发送数据,I2C驱动器件对数据进行处理后向每个I2C从器件发送;如果I2C从器件的器件地址与地址码相同,I2C从器件与I2C主器件进行通信。因此,本发明实现了I2C主器件控制每一个I2C驱动器的打开或关闭状态,提高了该I2C总线控制电路的可靠性。
The present invention relates to an I2C bus control circuit and a control method. The circuit includes: an I2C master device and a plurality of I2C device groups; the I2C device group includes an I2C driver device and a plurality of I2C slave devices; the I2C interface of the I2C master device is connected to the I2C driver device ; Its IO interface is connected to the enable end of the I2C drive device; one end of the I2C drive device is connected to multiple I2C slave devices; the I2C master device sends an enable signal to the I2C drive device; To send data, the I2C driver device processes the data and sends it to each I2C slave device; if the device address of the I2C slave device is the same as the address code, the I2C slave device communicates with the I2C master device. Therefore, the present invention realizes that the I2C master device controls the opening or closing state of each I2C driver, and improves the reliability of the I2C bus control circuit.
Description
技术领域technical field
本发明涉及通信领域,尤其涉及一种内部整合电路总线控制电路和控制方法。The invention relates to the communication field, in particular to an internal integrated circuit bus control circuit and a control method.
背景技术Background technique
内部整合电路(Inter-Integrated Circuit,I2C)总线是当今电子设计中应用非常广泛的串行总线之一,主要用于电压、温度监控,电可擦可编程只读存储器(electrically erasable programable read-only memory,EEPROM)数据的读写,光模块的管理等。其中,一条I2C总线上可以连接多个I2C器件。The Inter-Integrated Circuit (I2C) bus is one of the most widely used serial buses in today's electronic design. It is mainly used for voltage and temperature monitoring, and electrically erasable programmable read-only memory, EEPROM) data reading and writing, optical module management, etc. Wherein, multiple I2C devices can be connected to one I2C bus.
现有技术中,当I2C总线上器件过多时,经常采用I2C驱动器来增强I2C总线的驱动能力,每一个I2C器件都有一个唯一的器件地址,其长度一般为7位。该I2C器件地址的前4位由该I2C器件的类型决定,比如,EEPROM器件地址的前4位为1010,温度传感器器件地址的前4位为1001,输入/输出(Input/Output,I/O)接口器件的器件地址的前4位为0100;该I2C器件地址的后3位,一般通过设置该I2C器件的地址管脚A2,A1,A0的高低电平状态来实现。比如,I2C总线有4个EEPROM器件的器件地址分别为1010100、1010101、1010110、1010111,其中,每个EEPROM器件的器件地址的后3位通过在器件的地址管脚A2,A1,A0连接上拉电阻或下拉电阻来控制A2,A1,A0的高低电平状态。In the prior art, when there are too many devices on the I2C bus, an I2C driver is often used to enhance the driving capability of the I2C bus. Each I2C device has a unique device address, and its length is generally 7 bits. The first 4 bits of the I2C device address are determined by the type of the I2C device. For example, the first 4 bits of the EEPROM device address are 1010, the first 4 bits of the temperature sensor device address are 1001, and the input/output (Input/Output, I/O ) The first 4 bits of the device address of the interface device are 0100; the last 3 bits of the I2C device address are generally realized by setting the high and low levels of the address pins A2, A1, and A0 of the I2C device. For example, there are 4 EEPROM devices on the I2C bus whose device addresses are 1010100, 1010101, 1010110, and 1010111 respectively. Among them, the last 3 bits of the device address of each EEPROM device are pulled up by connecting the address pins A2, A1, and A0 of the device. Resistor or pull-down resistor to control the high and low state of A2, A1, A0.
但是,若与地址管脚A2,A1,A0相连接的上拉电阻或下拉电阻中失效时,则该I2C器件的器件地址就发生变化,与其他I2C器件的器件地址就有可能出现冲突。当I2C主器件操作读写该I2C器件时,与该I2C器件的器件地址有冲突的其他I2C器件也会响应I2C主器件的操作,从而造成I2C主器件读写数据冲突,降低了该I2C总线控制电路的可靠性。However, if the pull-up resistors or pull-down resistors connected to the address pins A2, A1, and A0 fail, the device address of the I2C device will change, and may conflict with device addresses of other I2C devices. When the I2C master device operates to read and write the I2C device, other I2C devices that conflict with the device address of the I2C device will also respond to the operation of the I2C master device, thereby causing the I2C master device to read and write data conflicts, reducing the I2C bus control. circuit reliability.
发明内容Contents of the invention
本发明提供了一种的I2C总线控制电路和控制方法,解决了现有技术中当I2C主器件操作读写I2C器件时,与该器件的器件地址有冲突的其他器件也会响应I2C主器件的操作,从而造成I2C主器件读写数据出现冲突的问题,利用I2C主器件的输入/输出接口控制I2C驱动器的使能端,从而实现了I2C主器件控制每一个I2C驱动器的打开或关闭状态,提高了该I2C总线控制电路的可靠性。The present invention provides an I2C bus control circuit and control method, which solves the problem in the prior art that when the I2C master device operates to read and write the I2C device, other devices that conflict with the device address of the device will also respond to the I2C master device. operation, thus causing the I2C main device to read and write data conflicts, using the input/output interface of the I2C main device to control the enable terminal of the I2C driver, thereby realizing the I2C main device to control the open or close state of each I2C driver, and improving This ensures the reliability of the I2C bus control circuit.
在第一方面,本发明提供了一种I2C总线控制电路,所述电路包括:I2C主器件、多个I2C器件组;所述I2C器件组包括I2C驱动器件和多个I2C从器件;所述I2C主器件的I2C接口与所述多个I2C器件组中每个I2C驱动器件的第一端相连接;所述I2C主器件为所述每个I2C驱动器件分配的输入输出IO接口分别与对应的所述I2C驱动器件的使能端相连接;所述每个I2C驱动器件的第二端与所述每个I2C驱动器件所在的所述I2C器件组中的多个I2C从器件相连接;当所述I2C主器件需要与任一所述I2C器件组的所述I2C从器件进行通信时,通过所述I2C主器件为所述I2C器件组的所述I2C驱动器件分配的输入输出IO接口向所述I2C驱动器件发送使能信号,使得所述I2C驱动器件处于使能状态;所述I2C主器件通过所述I2C主器件的I2C接口向所述使能状态的I2C驱动器件发送数据,所述使能状态的I2C驱动器件对所述数据进行处理,将所述处理后的数据向所述I2C器件组中每个所述I2C从器件发送;所述每个I2C从器件将自身的器件地址与所述处理后的数据中的地址码进行比较,如果所述I2C从器件的器件地址与所述地址码相同,所述I2C从器件与所述I2C主器件进行通信。In a first aspect, the present invention provides an I2C bus control circuit, the circuit includes: an I2C master device, a plurality of I2C device groups; the I2C device group includes an I2C driver device and a plurality of I2C slave devices; the I2C The I2C interface of the main device is connected to the first end of each I2C driving device in the plurality of I2C device groups; the input and output IO interfaces assigned by the I2C main device to each I2C driving device are respectively connected to the corresponding The enabling end of the I2C driving device is connected; the second end of each I2C driving device is connected to a plurality of I2C slave devices in the I2C device group where each I2C driving device is located; when the When the I2C master device needs to communicate with the I2C slave device of any one of the I2C device groups, the I2C master device distributes the input and output IO interface for the I2C driver device of the I2C device group to the I2C The driving device sends an enable signal so that the I2C driving device is in an enabled state; the I2C master device sends data to the I2C driving device in the enabled state through the I2C interface of the I2C master device, and the enabled state The I2C driver device processes the data, and sends the processed data to each of the I2C slave devices in the I2C device group; each of the I2C slave devices communicates its own device address with the processed The address code in the subsequent data is compared, and if the device address of the I2C slave device is the same as the address code, the I2C slave device communicates with the I2C master device.
在第一方面的第一种可能的实现方式中,所述多个I2C器件组中的每个I2C从器件的种类不同。In a first possible implementation manner of the first aspect, each I2C slave device in the plurality of I2C device groups is of a different type.
结合第一方面的第一种可能的实现方式,在第二种可能的实现方式中,所述I2C器件组中每个I2C从器件均具有7位器件地址,所述器件地址不同。With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner, each I2C slave device in the I2C device group has a 7-bit device address, and the device addresses are different.
结合第一方面、第一方面的第一种可能的实现方式或第一方面的第二种可能的实现方式中,在第三种可能的实现方式中,所述I2C主器件具体用于向所述多个I2C器件组中的任一I2C器件组的I2C驱动器件发送使能信号,使得所述I2C驱动器件处于使能状态;其他I2C器件组的I2C驱动器件处于关闭状态。In combination with the first aspect, the first possible implementation of the first aspect, or the second possible implementation of the first aspect, in a third possible implementation, the I2C master device is specifically configured to provide The I2C driving device of any one of the multiple I2C device groups sends an enabling signal, so that the I2C driving device is in an enabled state; the I2C driving devices of other I2C device groups are in an off state.
在第二方面,本发明提供了一种I2C总线控制方法,所述方法包括:当所述I2C主器件需要与任一所述I2C器件组的所述I2C从器件进行通信时,通过所述I2C主器件为所述I2C器件组的所述I2C驱动器件分配的输入输出IO接口向所述I2C驱动器件发送使能信号,使得所述I2C驱动器件处于使能状态;所述I2C主器件通过所述I2C主器件的I2C接口向所述使能状态的I2C驱动器件发送数据,所述使能状态的I2C驱动器件对所述数据进行处理后,将所述处理后的数据向所述I2C器件组中每个所述I2C从器件发送;当所述每个I2C从器件将自身的器件地址与所述处理后的数据中的地址码进行比较后,如果所述I2C从器件的器件地址与所述地址码相同,所述I2C从器件与所述I2C主器件进行通信。In a second aspect, the present invention provides an I2C bus control method, the method comprising: when the I2C master device needs to communicate with any of the I2C slave devices of the I2C device group, through the I2C The main device sends an enabling signal to the I2C driving device for the input and output IO interface assigned to the I2C driving device of the I2C device group, so that the I2C driving device is in an enabled state; the I2C main device passes through the The I2C interface of the I2C master device sends data to the I2C driver device in the enabled state, and the I2C driver device in the enabled state processes the data and sends the processed data to the I2C device group Each of the I2C slave devices sends; when each of the I2C slave devices compares its own device address with the address code in the processed data, if the device address of the I2C slave device is consistent with the address The code is the same, and the I2C slave device communicates with the I2C master device.
在第二方面的第一种可能的实现方式中,所述向所述I2C器件组的所述I2C驱动器件发送使能信号,使得所述I2C驱动器件处于使能状态具体为:通过所述I2C主器件为所述I2C器件组的所述驱动器件分配的输入/输出I/O接口向所述I2C驱动器件发送使能信号,使得所述I2C驱动器件处于使能状态;当所述I2C驱动器件低电平触发使能时,则所述I2C主器件将与所述驱动器件对应的输入输出IO接口置为低电平,则所述I2C驱动器件的使能端也为低电平,从而使得所述I2C驱动器件处于使能状态;当所述I2C驱动器件高电平触发使能时,则所述I2C主器件将与所述驱动器件对应的输入输出IO接口置为高电平,则所述I2C驱动器件的使能端也为高电平,从而使得所述I2C驱动器件处于使能状态。In a first possible implementation manner of the second aspect, the sending an enabling signal to the I2C driving device of the I2C device group so that the I2C driving device is in an enabled state is specifically: through the I2C The master device sends an enabling signal to the I2C driving device for the input/output I/O interface assigned to the driving device of the I2C device group, so that the I2C driving device is in an enabled state; when the I2C driving device When the low-level trigger is enabled, the I2C master device sets the input and output IO interface corresponding to the drive device to a low level, and the enable end of the I2C drive device is also low, so that The I2C driving device is in an enabled state; when the high level trigger of the I2C driving device is enabled, the I2C master device sets the input and output IO interface corresponding to the driving device to a high level, and the The enabling terminal of the I2C driving device is also at a high level, so that the I2C driving device is in an enabled state.
结合第二方面或第二方面的第一种可能的实现方式,在第二种可能的实现方式中,所述向所述I2C器件组的所述I2C驱动器件发送使能信号,使得所述I2C驱动器件处于使能状态还包括:所述I2C主器件控制所述处于使能状态的I2C驱动器件所在的所述I2C器件组之外的其他所述I2C器件组的I2C驱动器件处于关闭状态。With reference to the second aspect or the first possible implementation of the second aspect, in a second possible implementation, the sending an enable signal to the I2C driving device of the I2C device group, so that the I2C The enabling state of the driving device further includes: the I2C master device controlling the I2C driving devices of other I2C device groups other than the I2C device group where the I2C driving device in the enabled state is in the off state.
结合第二方面或第二方面的第一种可能的实现方式,在第三种可能的实现方式中,对所述数据进行电平转换和缓存。With reference to the second aspect or the first possible implementation manner of the second aspect, in a third possible implementation manner, level conversion and buffering are performed on the data.
通过应用上述的I2C总线控制电路和I2C总线控制方法,利用I2C主器件的输入输出接口控制I2C驱动器的使能端,从而实现了I2C主器件控制每一个I2C驱动器的打开或关闭状态,提高了该I2C总线控制电路的可靠性。By applying the above-mentioned I2C bus control circuit and I2C bus control method, the input and output interfaces of the I2C master device are used to control the enable end of the I2C driver, so that the I2C master device controls the on or off state of each I2C driver, improving the performance of the I2C master device. The reliability of the I2C bus control circuit.
附图说明Description of drawings
图1为本发明实施例一提供的I2C总线控制电路的示意图;FIG. 1 is a schematic diagram of an I2C bus control circuit provided by Embodiment 1 of the present invention;
图2为本发明实施例二提供的I2C总线控制方法的流程图。FIG. 2 is a flow chart of an I2C bus control method provided by Embodiment 2 of the present invention.
具体实施方式Detailed ways
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments It is a part of embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.
本发明实施例提供的I2C总线控制电路和控制方法,通过I2C主器件为I2C器件组的I2C驱动器件分配的输入输出IO接口向I2C驱动器件发送使能信号,使得I2C驱动器件处于使能状态,而其他I2C驱动器件处于关闭状态,通过I2C主器件的I2C接口向使能状态的I2C驱动器件发送数据,使能状态的I2C驱动器件对数据进行处理后,将处理后的数据向I2C器件组中每个不同种类的I2C从器件发送;每个I2C从器件接收到处理后的数据后,将I2C从器件的器件地址与处理后的数据中的地址码进行比较;当I2C从器件的器件地址与所述地址码相同时,则I2C从器件与所述I2C主器件进行通信,从而实现了利用I2C驱动器件将I2C主器件和I2C从器件进行隔离,提高了I2C总线的驱动能力,还实现了用一个IO接口控制一个I2C驱动器件的使能端,且一个I2C驱动器件驱动不同种类的I2C从器件,从而大大提高了该I2C总线控制电路的可靠性。The I2C bus control circuit and control method provided by the embodiments of the present invention send an enabling signal to the I2C driving device through the input and output IO interface assigned by the I2C master device to the I2C driving device of the I2C device group, so that the I2C driving device is in an enabled state, While other I2C driving devices are in the off state, they send data to the I2C driving device in the enabled state through the I2C interface of the I2C master device. After the I2C driving device in the enabled state processes the data, it sends the processed data to the I2C device group. Each different type of I2C slave device sends; after each I2C slave device receives the processed data, it compares the device address of the I2C slave device with the address code in the processed data; when the device address of the I2C slave device and When the address codes are the same, the I2C slave device communicates with the I2C master device, thereby realizing the isolation of the I2C master device and the I2C slave device by using the I2C drive device, improving the driving capability of the I2C bus, and realizing the use of One IO interface controls the enable terminal of one I2C driving device, and one I2C driving device drives different kinds of I2C slave devices, thereby greatly improving the reliability of the I2C bus control circuit.
图1为本发明实施例一提供的I2C总线控制电路的示意图。如图所示,本发明实施例具体包括:I2C主器件11、多个I2C器件组12。其中,每一个I2C器件组包括I2C驱动器件和多个I2C从器件。其中,每个I2C器件组12中的各个I2C从器件的种类不同。每个I2C从器件皆具有7位的器件地址,该器件地址各不相同。比如,有些从器件的前4位代表该I2C从器件的种类,则同一I2C器件组12中的各个I2C从器件的器件地址的前4位不同。FIG. 1 is a schematic diagram of an I2C bus control circuit provided by Embodiment 1 of the present invention. As shown in the figure, the embodiment of the present invention specifically includes: an I2C master device 11 and a plurality of
以I2C驱动器件121所在的I2C器件组12为例说明该I2C器件组12的组成,该I2C器件组12包括:I2C驱动器件121和a个I2C从器件。该a个I2C从器件分别为I2C从器件11、I2C从器件12、I2C从器件13、...和I2C从器件1a。另外,其余的I2C器件组12的组成与I2C驱动器件1所在的I2C器件组12的组成相同,在这里不再赘述。Taking the
在I2C驱动器件121所在的I2C器件组12中,I2C从器件11、I2C从器件12、I2C从器件13、...和I2C从器件1a的种类不同,即I2C从器件11、I2C从器件12、I2C从器件13、...和I2C从器件1a的器件地址的前4位不同。但是,不同的I2C器件组12之间的I2C从器件可以相同。比如,I2C从器件11、I2C从器件21、I2C从器件31、...、I2C从器件31可以皆为EEPROM器件。In the
第一,该I2C总线控制电路各部分之间的连接关系。First, the I2C bus controls the connection relationship between various parts of the circuit.
I2C主器件的I2C接口与每一个I2C器件组12中的I2C驱动器件的第一端1,即I2C驱动器件121、I2C驱动器件122、I2C驱动器件123、...、I2C驱动器件12n的第一端1相连接。其中,该I2C接口具体包括两根信号线:双向数据线SDA和时钟线SCL。另外,I2C主器件的I2C接口与每一个I2C器件组12中的I2C驱动器件之间还包括:I2C总线电阻R13。The I2C interface of the I2C master device is connected to the first end 1 of the I2C driving device in each
I2C主器件为每一个I2C器件组12中的I2C驱动器件,即I2C驱动器件121、I2C驱动器件122、I2C驱动器件123、...、I2C驱动器件12n分配一个输入/输出I/O接口,且I2C主器件为I2C驱动器件121、I2C驱动器件122、I2C驱动器件123、...、I2C驱动器件12n分配的输入输出IO接口分别I2C驱动器件121、I2C驱动器件122、I2C驱动器件123、...、I2C驱动器件12n的使能端EN相连接。在图1中,I2C主器件IO_1接口与I2C驱动器件121的使能端EN相连接,I2C主器件IO_2接口与I2C驱动器件122的使能端EN相连接,I2C主器件IO_3接口与I2C驱动器件123的使能端EN相连接,I2C主器件IO_4接口与I2C驱动器件12n的使能端EN相连接。另外,I2C主器件还可以为I2C驱动器件121、I2C驱动器件122、I2C驱动器件123和I2C驱动器件12n分配其他的IO接口。在本发明实施例中,只要保证每一个I2C器件组12中的I2C驱动器件的使能端EN与一个IO接口相连接,而且与每一个I2C器件组12中的I2C驱动器件的使能端EN相连接的IO接口皆不同,就能达到I2C主器件利用其IO接口分别控制每一个I2C器件组12中的I2C驱动器件的打开或关闭状态。The I2C master device allocates an input/output I/O interface for each I2C driver device in the
每一个I2C器件组12中的I2C驱动器件的第二端2与该I2C器件组12中每一个I2C从器件的一端相连接。以I2C驱动器件121所在的I2C器件组12为例来说明该I2C器件组12的内部之间的连接。I2C驱动器件121的输出端2皆与I2C从器件11、I2C从器件12、I2C从器件13、...和I2C从器件1a的一端相连接。The
第二,该I2C总线控制电路各部分功能。Second, the I2C bus controls the functions of various parts of the circuit.
当I2C主器件11需要与任一个I2C器件组12的I2C从器件进行通信时,通过I2C主器件11为I2C器件组12的驱动器件分配的输入输出IO接口向I2C驱动器件发送使能信号,使得I2C驱动器件处于使能状态。When the I2C master device 11 needs to communicate with the I2C slave device of any
I2C主器件通过I2C主器件的I2C接口向使能状态的I2C驱动器件发送数据,使能状态的I2C驱动器件对数据进行处理,将处理后的数据向I2C器件组每一个I2C从器件发送。其中,I2C驱动器件对数据进行处理包括电平转换和缓存。The I2C master device sends data to the I2C driver device in the enabled state through the I2C interface of the I2C master device, and the I2C driver device in the enabled state processes the data and sends the processed data to each I2C slave device in the I2C device group. Wherein, the I2C driving device processes data including level shifting and buffering.
当每一个I2C从器件接收到处理后的数据后,将处理后的数据中的地址码与自身的器件地址相比较;只有I2C从器件的器件地址与接收到的地址码相同时,该I2C从器件才与I2C主器件进行通信。When each I2C slave receives the processed data, it compares the address code in the processed data with its own device address; only when the device address of the I2C slave is the same as the received address code, the I2C slave The device communicates with the I2C master.
下面以I2C主器件11需要与I2C驱动器件121所在的I2C器件组12中的I2C从器件11进行通信为例来具体说明该I2C总线控制电路各部分功能。The function of each part of the I2C bus control circuit will be specifically described below by taking the I2C master device 11 needing to communicate with the I2C slave device 11 in the
首先I2C主器件11通过与I2C驱动器件121的使能端EN相连接的IO_1接口向I2C驱动器件121发送使能信号,使得I2C驱动器件处于使能状态。而其他I2C器件组12中的I2C驱动器件,I2C驱动器件121、I2C驱动器件122、I2C驱动器件123、...、I2C驱动器件12n处于关闭状态。在本发明实施例中I2C主器件11只能向一个I2C驱动器件发送使能信号,不能同时向两个以上的I2C驱动器件发送使能信号。也就是说,只有一个接收使能信号的I2C驱动器件处于使能状态,而其他I2C驱动器件处于关闭状态。First, the I2C master device 11 sends an enabling signal to the
当I2C驱动器件121低电平触发使能时,则I2C主器件11将与I2C驱动器件121对应的输入输出IO接口即IO_1接口置为低电平,则I2C驱动器件121的使能端也为低电平,从而使得I2C驱动器件121处于使能状态;当I2C驱动器件121高电平触发使能时,则所述I2C主器件将与所述驱动器件对应的输入输出IO接口即IO_1置为高电平,则I2C驱动器件121的使能端也为高电平,从而使得I2C驱动器件121处于使能状态。When the
然后,I2C主器件11通过I2C主器件的I2C接口向使能状态的I2C驱动器件121发送数据,该数据包括地址码,使能状态的I2C驱动器件对数据进行处理后,将处理后的数据发送至与I2C驱动器件的输出端相连接的每一个I2C从器件,即I2C从器件11、I2C从器件12、I2C从器件13、...和I2C从器件1a。Then, the I2C master device 11 sends data to the
最后,当每一个I2C从器件,即I2C从器件11、I2C从器件12、I2C从器件13、...和I2C从器件1a接收到处理后的数据后,将处理后的数据中的地址码与自身的器件地址进行比较。当其中一个I2C从器件的器件地址与地址码相同时,则该I2C从器件才与I2C主器件进行通信。比如,I2C从器件11的器件地址与接收到的地址码相同,则I2C主器件对I2C从器件11进行读操作或写操作。Finally, when each I2C slave device, that is, I2C slave device 11,
另外,I2C主器件11需要与其他的I2C器件组12中的I2C从器件进行通信时,与I2C主器件11需要与I2C驱动器件121所在的I2C器件组12中的I2C从器件11进行通信的过程大致相同,只是使能I2C驱动器件的IO不同而已,在这里不再赘述。In addition, when the I2C master device 11 needs to communicate with other I2C slave devices in the
因此,本发明实施例提供的内部整合电路I2C总线控制电路,通过I2C主器件为I2C器件组的I2C驱动器件分配的输入输出IO接口向I2C驱动器件发送使能信号,使得I2C驱动器件处于使能状态,而其他I2C驱动器件处于关闭状态,通过I2C主器件的I2C接口向使能状态的I2C驱动器件发送数据,使能状态的I2C驱动器件对数据进行处理后,将处理后的数据向I2C器件组中每个不同种类的I2C从器件发送;每个I2C从器件接收到处理后的数据后,将I2C从器件的器件地址与处理后的数据中的地址码进行比较;当I2C从器件的器件地址与所述地址码相同时,则I2C从器件与所述I2C主器件进行通信,从而实现了利用I2C驱动器件将I2C主器件和I2C从器件进行隔离,提高了I2C总线的驱动能力,还实现了用一个IO接口控制一个I2C驱动器件的使能端,且一个I2C驱动器件驱动不同种类的I2C从器件,从而大大提高了该I2C总线控制电路的可靠性。Therefore, the internal integrated circuit I2C bus control circuit provided by the embodiment of the present invention sends an enabling signal to the I2C driving device through the I2C master device for the input and output IO interface allocated by the I2C driving device of the I2C device group, so that the I2C driving device is enabled state, while other I2C driving devices are in the off state, send data to the I2C driving device in the enabled state through the I2C interface of the I2C master device, and after the I2C driving device in the enabled state processes the data, it sends the processed data to the I2C device Each different type of I2C slave device in the group sends; after each I2C slave device receives the processed data, it compares the device address of the I2C slave device with the address code in the processed data; when the device of the I2C slave device When the address is the same as the address code, the I2C slave device communicates with the I2C master device, thereby realizing the isolation of the I2C master device and the I2C slave device by using the I2C driver device, improving the driving capability of the I2C bus, and realizing In order to use one IO interface to control the enabling terminal of one I2C driving device, and one I2C driving device drives different kinds of I2C slave devices, thereby greatly improving the reliability of the I2C bus control circuit.
图2为本发明实施例二提供的I2C总线控制方法的流程图。该方法用于本发明实施例一提供的I2C总线控制电路。如图所示,本发明实施例具体包括:FIG. 2 is a flow chart of an I2C bus control method provided by
步骤210,当I2C主器件需要与任一个I2C器件组的I2C从器件进行通信时,通过I2C主器件为该I2C器件组的I2C驱动器件分配的输入输出IO接口向I2C驱动器件发送使能信号,使得该I2C驱动器件处于使能状态。除了该I2C器件组以外的其他I2C器件组的I2C驱动器件处于关闭状态。
具体地,通过I2C主器件为I2C器件组的驱动器件分配的输入输出IO接口向I2C驱动器件发送使能信号,使得I2C驱动器件处于使能状态;Specifically, an enable signal is sent to the I2C drive device through the input and output IO interface assigned by the I2C master device to the drive device of the I2C device group, so that the I2C drive device is in an enabled state;
当I2C驱动器件低电平触发使能时,则I2C主器件将与驱动器件对应的输入输出IO接口置为低电平,则I2C驱动器件的使能端也为低电平,从而使得I2C驱动器件处于使能状态;当I2C驱动器件高电平触发使能时,则I2C主器件将与驱动器件对应的输入输出IO接口置为高电平,则I2C驱动器件的使能端也为高电平,从而使得I2C驱动器件处于使能状态。When the low-level trigger of the I2C drive device is enabled, the I2C master device will set the input and output IO interfaces corresponding to the drive device to low level, and the enable terminal of the I2C drive device will also be low level, so that the I2C drive The device is in the enable state; when the I2C drive device triggers the enable at a high level, the I2C master device sets the input and output IO interface corresponding to the drive device to a high level, and the enable terminal of the I2C drive device is also at a high level. Level, so that the I2C drive device is enabled.
步骤220,I2C主器件通过I2C主器件的I2C接口向使能状态的I2C驱动器件发送数据,使能状态的I2C驱动器件对数据进行处理后,将处理后的数据向I2C器件组中每个I2C从器件发送。其中,每个I2C从器件的种类不同。其中,I2C驱动器件对数据进行处理具体包括对该数据进行电平转换和缓存。
具体地,每个I2C从器件皆具有7位的器件地址,则属于同一个I2C从器件组的每个I2C从器件的器件地址各不相同。比如,每个I2C从器件皆的器件地址的前4位代表该I2C从器件的种类,则属于同一I2C器件组中的各个I2C从器件的器件地址的前4位不同。Specifically, each I2C slave device has a 7-bit device address, and the device addresses of each I2C slave device belonging to the same I2C slave device group are different. For example, the first 4 bits of the device address of each I2C slave device represent the type of the I2C slave device, and the first 4 bits of the device address of each I2C slave device belonging to the same I2C device group are different.
步骤230,每个I2C从器件接收到处理后的数据后,将每个I2C从器件的器件地址与处理后的数据中的地址码进行比较后,如果I2C从器件的器件地址与地址码相同时,则该I2C从器件才与I2C主器件进行通信。
因此,本发明实施例提供的内部整合电路I2C总线控制方法,通过I2C主器件为I2C器件组的I2C驱动器件分配的输入输出IO接口向I2C驱动器件发送使能信号,使得I2C驱动器件处于使能状态,而其他I2C驱动器件处于关闭状态,通过I2C主器件的I2C接口向使能状态的I2C驱动器件发送数据,使能状态的I2C驱动器件对数据进行处理后,将处理后的数据向I2C器件组中每个不同种类的I2C从器件发送;每个I2C从器件接收到处理后的数据后,将I2C从器件的器件地址与处理后的数据中的地址码进行比较;当I2C从器件的器件地址与所述地址码相同时,则I2C从器件与所述I2C主器件进行通信,从而实现了利用I2C驱动器件将I2C主器件和I2C从器件进行隔离,提高了I2C总线的驱动能力,还实现了用一个IO接口控制一个I2C驱动器件的使能端,且一个I2C驱动器件驱动不同种类的I2C从器件,从而大大提高了该I2C总线控制电路的可靠性。Therefore, the internal integrated circuit I2C bus control method provided by the embodiment of the present invention sends an enabling signal to the I2C driving device through the input and output IO interface allocated by the I2C master device to the I2C driving device of the I2C device group, so that the I2C driving device is enabled state, while other I2C driving devices are in the off state, send data to the I2C driving device in the enabled state through the I2C interface of the I2C master device, and after the I2C driving device in the enabled state processes the data, it sends the processed data to the I2C device Each different type of I2C slave device in the group sends; after each I2C slave device receives the processed data, it compares the device address of the I2C slave device with the address code in the processed data; when the device of the I2C slave device When the address is the same as the address code, the I2C slave device communicates with the I2C master device, thereby realizing the isolation of the I2C master device and the I2C slave device by using the I2C driver device, improving the driving capability of the I2C bus, and realizing In order to use one IO interface to control the enabling terminal of one I2C driving device, and one I2C driving device drives different kinds of I2C slave devices, thereby greatly improving the reliability of the I2C bus control circuit.
以上所述的具体实施方式,对本发明的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上所述仅为本发明的具体实施方式而已,并不用于限定本发明的保护范围,凡在本发明的技术方案范围之内,所做的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The specific embodiments described above have further described the purpose, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above descriptions are only specific embodiments of the present invention and are not intended to limit the scope of the present invention. Protection scope, within the scope of the technical solution of the present invention, any modification, equivalent replacement, improvement, etc., shall be included in the protection scope of the present invention.
Claims (10)
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2012/085131 WO2014079034A1 (en) | 2012-11-23 | 2012-11-23 | Control circuit and control method for inter-integrated circuit bus |
Publications (1)
Publication Number | Publication Date |
---|---|
CN103229158A true CN103229158A (en) | 2013-07-31 |
Family
ID=48838331
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2012800029333A Pending CN103229158A (en) | 2012-11-23 | 2012-11-23 | Control circuit and control method for inter-integrated circuit bus |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN103229158A (en) |
WO (1) | WO2014079034A1 (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109557453A (en) * | 2018-11-28 | 2019-04-02 | 郑州云海信息技术有限公司 | A kind of more main control chip identifying processing method and system |
CN111221765A (en) * | 2019-12-31 | 2020-06-02 | 苏州浪潮智能科技有限公司 | Communication method and communication system for preventing I2C bus address conflict |
CN111786864A (en) * | 2020-06-09 | 2020-10-16 | 许昌许继风电科技有限公司 | Dual-drive pitch system and switching method supporting automatic switching function of master-slave mode |
CN112667126A (en) * | 2021-01-22 | 2021-04-16 | 深圳市绘王动漫科技有限公司 | Handwriting screen and method for adjusting closed screen menu thereof |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040006661A1 (en) * | 2002-07-05 | 2004-01-08 | Chih-Wei Hu | Method and device of minimizing the number of LDRQ signal pin of LPC host and LPC host employing the same |
US20070150684A1 (en) * | 2005-12-22 | 2007-06-28 | Fujitsu Limited | Apparatus for transmitting data via the I2C bus, method of transmitting data via the I2C bus, and program for transmitting data via the I2C bus |
CN101295283A (en) * | 2008-05-30 | 2008-10-29 | 北京星网锐捷网络技术有限公司 | Bus device and data transmission method thereof |
CN102023954A (en) * | 2009-09-17 | 2011-04-20 | 研祥智能科技股份有限公司 | Device with multiple I2C buses, processor, system main board and industrial controlled computer |
TW201201023A (en) * | 2010-06-30 | 2012-01-01 | Hon Hai Prec Ind Co Ltd | Inter-Integrated Circuit device communication circuit |
-
2012
- 2012-11-23 WO PCT/CN2012/085131 patent/WO2014079034A1/en active Application Filing
- 2012-11-23 CN CN2012800029333A patent/CN103229158A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040006661A1 (en) * | 2002-07-05 | 2004-01-08 | Chih-Wei Hu | Method and device of minimizing the number of LDRQ signal pin of LPC host and LPC host employing the same |
US20070150684A1 (en) * | 2005-12-22 | 2007-06-28 | Fujitsu Limited | Apparatus for transmitting data via the I2C bus, method of transmitting data via the I2C bus, and program for transmitting data via the I2C bus |
CN101295283A (en) * | 2008-05-30 | 2008-10-29 | 北京星网锐捷网络技术有限公司 | Bus device and data transmission method thereof |
CN102023954A (en) * | 2009-09-17 | 2011-04-20 | 研祥智能科技股份有限公司 | Device with multiple I2C buses, processor, system main board and industrial controlled computer |
TW201201023A (en) * | 2010-06-30 | 2012-01-01 | Hon Hai Prec Ind Co Ltd | Inter-Integrated Circuit device communication circuit |
Non-Patent Citations (1)
Title |
---|
宋浩: "I2C总线在工业仪表中的应用", 《工业仪表与自动化装置》 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109557453A (en) * | 2018-11-28 | 2019-04-02 | 郑州云海信息技术有限公司 | A kind of more main control chip identifying processing method and system |
CN111221765A (en) * | 2019-12-31 | 2020-06-02 | 苏州浪潮智能科技有限公司 | Communication method and communication system for preventing I2C bus address conflict |
CN111786864A (en) * | 2020-06-09 | 2020-10-16 | 许昌许继风电科技有限公司 | Dual-drive pitch system and switching method supporting automatic switching function of master-slave mode |
CN112667126A (en) * | 2021-01-22 | 2021-04-16 | 深圳市绘王动漫科技有限公司 | Handwriting screen and method for adjusting closed screen menu thereof |
Also Published As
Publication number | Publication date |
---|---|
WO2014079034A1 (en) | 2014-05-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7603501B2 (en) | Communication circuit of serial peripheral interface devices | |
US6629172B1 (en) | Multi-chip addressing for the I2C bus | |
US8898358B2 (en) | Multi-protocol communication on an I2C bus | |
US10169282B2 (en) | Bus serialization for devices without multi-device support | |
EP3086236B1 (en) | Bus communications with multi-device messaging | |
CN102339267B (en) | I2C address is changed | |
US20080307154A1 (en) | System and Method for Dual-Ported I2C Flash Memory | |
CN109359073B (en) | Inter-device communication method and device based on SPI bus | |
US20090271557A1 (en) | Non-volatile memory storage device with high transmission rate | |
CN104102600B (en) | Memory controller | |
CN102724110A (en) | Single plate communication method, single plate communication system and single plate | |
CN103229158A (en) | Control circuit and control method for inter-integrated circuit bus | |
CN103092175A (en) | Controlling method and device for serial clock line (SCL) between inter-integrated circuit (I2C) master equipment and slave equipment | |
US20080270654A1 (en) | Bus System for Selectively Controlling a Plurality of Identical Slave Circuits Connected to the Bus and Method Therefore | |
US20100325326A1 (en) | Device information management system and device information management method | |
CN105988078B (en) | Method and system for realizing single-wire programmable circuit | |
CN1811480A (en) | Method and apparatus for real-time monitoring level signal | |
EP2725499A1 (en) | Method for assigning dynamically an identifier to a slave device in I2C data bus | |
CN1282932C (en) | A method for accessing small-package live-line swapping optical module by CPU | |
US10783101B1 (en) | Methods and system for communication between a host device and slave devices | |
EP4246900A1 (en) | Processing system, related integrated circuit, device and method | |
US11494329B2 (en) | NVMe-MI over SMBus multi-master controller with other SMBus and I2C masters in a single FPGA chip | |
EP3182295A1 (en) | Communication system with serial ports for automatically identifying device types and communication protocols and method thereof | |
US20080091788A1 (en) | Controller, address control method, and data transmission system using the same | |
JP2014186500A (en) | Device for i2c bus communication, i2c bus communication system, and i2c bus communication method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C12 | Rejection of a patent application after its publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20130731 |