KR0181596B1 - Data transmission device of 12c bus - Google Patents

Data transmission device of 12c bus Download PDF

Info

Publication number
KR0181596B1
KR0181596B1 KR1019960050266A KR19960050266A KR0181596B1 KR 0181596 B1 KR0181596 B1 KR 0181596B1 KR 1019960050266 A KR1019960050266 A KR 1019960050266A KR 19960050266 A KR19960050266 A KR 19960050266A KR 0181596 B1 KR0181596 B1 KR 0181596B1
Authority
KR
South Korea
Prior art keywords
data
bus
address
sda
data line
Prior art date
Application number
KR1019960050266A
Other languages
Korean (ko)
Other versions
KR19980030788A (en
Inventor
정성학
Original Assignee
대우전자주식회사
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 대우전자주식회사 filed Critical 대우전자주식회사
Priority to KR1019960050266A priority Critical patent/KR0181596B1/en
Publication of KR19980030788A publication Critical patent/KR19980030788A/en
Application granted granted Critical
Publication of KR0181596B1 publication Critical patent/KR0181596B1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0016Inter-integrated circuit (I2C)

Abstract

본 발명은 I2C 버스상의 다중 마스터(Multi-Master) 환경에서 데이터를 전송하는 데이터 전송 장치 및 방법에 관한 것으로, 특히 버스 사용권이 포기(Arbitration Loss)된 경우 즉시 슬레이브로 동작하여 마스터로부터 전송되는 데이터를 수신하는 데이터 전송 장치 및 방법에 관한 것이다.The present invention relates to a data transmission apparatus and method for transmitting data in a multi-master environment on an I 2 C bus. In particular, the present invention relates to a method of transmitting data from a master by operating as a slave immediately when a bus license is abandoned. A data transmission apparatus and method for receiving data.

본 발명은 버스 사용권이 상실된 경우 마스터에서 I2C 버스로 전송된 어드레스와 자신의 어드레스를 비교하고 동일하면 바로 슬레이브로 전환하여 마스터의 요구에 따라 데이터를 처리한다.The present invention compares its address with the address transmitted from the master to the I 2 C bus when the bus license is lost, and if it is the same, switches to the slave and processes data according to the request of the master.

따라서 본 발명은 I2C 버스 상에 다수의 마스터가 존재하여 버스 사용권의 상실이 발생했을 때 빠르게 마스터에서 슬레이브로 전환되므로 전송 효율을 높이는 효과가 있다.Therefore, the present invention has a large number of masters on the I 2 C bus, when the loss of bus use rights are quickly switched from the master to the slave has the effect of increasing the transmission efficiency.

Description

I2C 버스의 데이터 전송 장치 및 방법Apparatus and method for transmitting data on I2C bus

본 발명은 I2C 버스상의 다중 마스터(Multi-Master) 환경에서 데이터를 전송하는 데이터 전송 장치 및 방법에 관한 것으로, 특히 버스 사용권이 포기(Arbitration Loss)된 경우 즉시 슬레이브로 동작하여 마스터로부터 전송되는 데이터를 수신하는 데이터 전송 장치 및 방법에 관한 것이다.The present invention relates to a data transmission apparatus and method for transmitting data in a multi-master environment on an I 2 C bus. In particular, the present invention relates to a method of transmitting data from a master by operating as a slave immediately when a bus license is abandoned. A data transmission apparatus and method for receiving data.

일반적으로 I2C 버스는 도1에 도시한 바와 같이 각 부분(A, B, C, D), 예를 들어 CPU, 메모리, I/O 기기간의 데이타 전송을 위해 사용하는 데이타 선로로, 2개의 선, 즉 데이타와 클럭을 각각 전송하는 2개의 선으로 통신이 가능하다. 또한, I2C 버스에 연결된 기기는 소프트웨어적으로 접근이 가능하고 다중 마스터가 동시에 같은 버스에 존재할 수 있다. 즉, I2C 버스에 연결된 각 부분(A, B, C, D)은 클럭을 발생하게 되면 모두 마스터가 될 수 있다.In general, the I 2 C bus is a data line used to transfer data between parts (A, B, C, D), for example, CPU, memory, and I / O devices, as shown in FIG. Communication is possible with a line, two lines that transmit data and a clock respectively. In addition, devices connected to the I 2 C bus are software accessible and multiple masters can exist on the same bus at the same time. That is, each part (A, B, C, D) connected to the I 2 C bus may become a master when generating a clock.

예를 들어, 한 부분(A)이 클럭을 발생하여 마스터가 되면 나머지 부분(B, C, D)은 슬레이브가 되고, 다른 한 부분(B)이 클럭을 발생하여 마스터가 되면 나머지 부분(A, C, D)은 슬레이브가 되고, 또 다른 한 부분(C)이 클럭을 발생하여 마스터가 되면 나머지 부분(A, B, D)은 슬레이브가 되고, 또 다른 한 부분(D)이 클럭을 발생하여 마스터가 되면 나머지 부분(A, B, C)은 슬레이브가 된다.For example, if one part (A) generates a clock and becomes a master, the other part (B, C, D) becomes a slave, and the other part (B) generates a clock and becomes a master and the other part (A, C, D) becomes a slave, while another part (C) generates a clock and becomes a master, the remaining parts (A, B, D) become a slave, and another part (D) generates a clock. Once mastered, the remaining parts (A, B, C) become slaves.

또한, I2C 버스는 100Kbps에서 400Kbps까지 데이타 전송이 가능하며 캐패시터가 400pF을 초과하지 않는 한도내에서 다수의 기기(A, B, C, D)가 동일 버스에 연결될 수 있다.In addition, the I 2 C bus can transfer data from 100Kbps to 400Kbps and multiple devices (A, B, C, D) can be connected to the same bus as long as the capacitor does not exceed 400pF.

I2C 버스는 2개의 라인, 즉 데이타를 전송하는 하나의 데이타 라인(SDA)와 클럭을 전송하는 하나의 클럭 라인(SCL)으로 이루어진다. 따라서 마스터에서 클럭 라인(SCL)을 통해 클럭을 전송하고 테이타 라인(SDA)을 통해 데이터와 어드레스를 전송하면 슬레이브에서는 클럭 라인(SCL)을 통해 전송된 클럭에 동기되어 데이타 라인(SDA)을 통해 전송된 데이터와 어드레스를 수신하게 된다.The I 2 C bus consists of two lines, one data line (SDA) for transmitting data and one clock line (SCL) for transmitting a clock. Therefore, when the master transmits the clock through the clock line SCL and the data and the address through the data line SDA, the slave transmits the data through the data line SDA in synchronization with the clock transmitted through the clock line SCL. Received data and address.

종래의 I2C 버스를 이용한 데이터 전송 장치는 도2에 도시한 바와 같이 장치 전체의 동작을 제어하는 CPU(101), 상기 CPU(101)의 제어에 따라 시작 조건과 종결 조건을 발생시켜 데이터 라인(SDA)과 클럭 라인(SCL)을 통해 전송하는 시작 조건/종결 조건 발생부(102), 상기 CPU(101)의 제어에 따라 데이터 라인(SDA)과 클럭 라인(SCL)을 통해 데이터를 전송하고 타 장치로부터 전송되는 데이터를 처리하는 데이터 처리부(104), 및 상기 CPU(101)의 제어에 따라 장치와 I2C 버스를 통해 전송되는 어드레스를 비교하여 비교 결과를 상기 데이터 처리부(104)로 출력하는 어드레스 비교부(103)로 구성된다.In the conventional data transfer apparatus using the I 2 C bus, as shown in FIG. 2, the CPU 101 controls the operation of the entire apparatus, and generates a start condition and a termination condition under the control of the CPU 101. A start condition / end condition generator 102 which transmits through the SDA and the clock line SCL, and transmits data through the data line SDA and the clock line SCL under the control of the CPU 101. A data processor 104 for processing data transmitted from another device, and an address transmitted through an I 2 C bus with a device under the control of the CPU 101, and outputs a comparison result to the data processor 104. The address comparison section 103 is provided.

이와 같이 구성되는 종래의 I2C 버스의 데이터 전송 장치에서 이루어지는 데이터 송수신 동작을 도3을 참조하여 설명한다. 즉 다수의 마스터가 존재하는 I2C 버스에서 하나의 마스터가 데이터를 전송하고자 하는 경우를 도 3 및 도 4를 참조하여 설명한다.A data transmission / reception operation performed in the data transmission apparatus of the conventional I 2 C bus configured as described above will be described with reference to FIG. That is, a case in which one master intends to transmit data on an I 2 C bus in which a plurality of masters exist is described with reference to FIGS. 3 and 4.

마스터로 동작하기 위해서는 클럭을 발생시켜야 한다. 이를 위해 시작 조건/종결 조건을 발생하여야 한다. 즉, 데이터를 전송하려면 CPU(101)에서 시작 조건/종결 조건 발생부(102)를 동작시켜 시작 조건을 발생하도록 한다(120).To operate as a master, you must generate a clock. For this, a start condition / end condition must be generated. That is, to transmit data, the CPU 101 operates the start condition / end condition generator 102 to generate a start condition (120).

시작 조건은 도 3에 도시한 바와 같이 클럭 라인(SCL)을 통해 전송되는 클럭이 '1'인 상태에서 데이타 라인(SDA)이 '1'에서 '0'으로 천이하는 경우이고, 종결 조건은 클럭 라인(SCL)을 통해 전송되는 클럭이 '1'일때 데이타 라인(SCL)을 통해 전송되는 데이타가 '0'에서 '1'로 천이하는 경우이다.As shown in FIG. 3, the start condition is a case where the data line SDA transitions from '1' to '0' while the clock transmitted through the clock line SCL is '1', and the termination condition is the clock. When the clock transmitted through the line SCL is '1', the data transmitted through the data line SCL transitions from '0' to '1'.

이와 같이 시작 조건 검출부(102)에서 시작 조건을 I2C 버스의 클럭 라인(SCL)과 데이터 라인(SDA)을 통해 전송한후에는 어드레스를 전송하게 된다(121). 즉, CPU(101)의 제어에 따라 데이터를 전송하고자하는 장치에 해당하는 어드레스를 데이터 처리부(104)에서 I2C 버스의 데이터 라인(SDA)을 통해 전송하게 된다.As described above, after the start condition detector 102 transmits the start condition through the clock line SCL and the data line SDA of the I 2 C bus, the address is transmitted (121). That is, under the control of the CPU 101, the address corresponding to the device to which data is to be transmitted is transmitted from the data processor 104 through the data line SDA of the I 2 C bus.

이와 같이 어드레스를 전송한후에는 어드레스에 포함된 읽기/쓰기 데이터에 따라 읽기/쓰기를 수행한다(122). 즉, 어드레스에 포함된 읽기/쓰기 데이터가 읽기를 나타내면 슬레이브에서 데이터를 읽어와서 데이터 처리부(104)에서 읽어온 데이터를 처리하도록 하고, 어드레스에 포함된 읽기/쓰기 데이터가 쓰기를 나타내면 데이터 처리부(104)에서 슬레이브로 데이터를 전송하도록 한다.After the address is transmitted as described above, read / write is performed according to the read / write data included in the address (122). That is, if the read / write data included in the address indicates reading, the slave reads the data to process the data read from the data processing unit 104. If the read / write data contained in the address indicates writing, the data processing unit 104 ) To send data to the slave.

이와 같이 마스터의 제어에 따라 슬레이브에서 데이터를 수신하거나 슬레이브에 데이터를 전송한후에는 위의 종결 조건을 발생하여 I2C 버스의 사용을 종결한다(123). 즉, CPU(101)의 제어에 따라 시작 조건/종결 조건 발생부(102)에서 도3에 도시한 바와 같이 종결 조건을 발생하여 I2C 버스를 통해 전송하므로써 데이터의 전송을 마친다.As described above, after receiving data from the slave or transmitting data to the slave under the control of the master, the above termination condition is generated to terminate the use of the I 2 C bus (123). That is, under the control of the CPU 101, the start condition / end condition generator 102 generates the end condition as shown in FIG. 3 and transmits it through the I 2 C bus to complete the data transfer.

그러나 종래의 I2C 버스를 이용한 데이터 전송 장치는 마스터가 버스 사용권을 상실했을 경우에, 특히 그 마스터가 다른 마스터에서 지정한 슬레이브인 경우에는 데이터의 재전송이 필요하다.However, a data transmission apparatus using a conventional I 2 C bus requires retransmission of data when the master loses the bus right, especially when the master is a slave designated by another master.

즉, 두 개의 장치가 동시에 시작 조건을 발생하는 경우에 두 개의 장치중에서 하나의 장치만이 마스터가 되어 I2C 버스를 사용하게 되는데, 이때 버스 사용권을 획득하지 못하고 상실한 장치는 버스 사용권을 획득한 장치의 데이터 전송이 완료된후에 재전송을 수행해야 한다.In other words, when two devices simultaneously start condition, only one of the two devices becomes the master and uses the I 2 C bus. Retransmission must be performed after the data transmission of the device is completed.

특히, 버스 사용권을 획득하지 못하고 상실한 마스터가 버스 사용권을 획득한 마스터에 의해 지정된 슬레이브인 경우에도 재전송이 필요하다.In particular, retransmission is required even if the lost master fails to acquire the bus license and is the slave designated by the master who obtained the bus license.

이와 같은 경우를 도 1을 참조하여 설명하면 다음과 같다.Such a case will be described with reference to FIG. 1 as follows.

장치(A)가 장치(B)를 슬레이브로 지정하고 데이터 전송을 수행하려고 시작 조건을 발생시킴과 동시에 장치(B)가 장치(C)를 슬레이브로 지정하고 데이터 전송을 수행하려고 시작 조건을 발생시킬 때 시작 조건은 동일하므로, 장치(A, B)는 모두 마스터로써 어드레스를 전송하게 된다.While device A designates device B as a slave and generates a start condition to perform data transfer, device B designates device C as a slave and generates a start condition to perform data transfer. Since the starting conditions are the same, the devices A and B both transmit the address as the master.

즉, 장치(B)의 어드레스가 '1000000'이고, 장치(C)의 어드레스가 '1100000'인 경우 장치(A)는 장치(B)와의 데이터 전송을 위해 장치(B)에 해당하는 어드레스'1000000'를 데이터 라인(SDA)을 통해 전송하게 되고 장치(B)는 장치(C)와의 데이터 전송을 위해 장치(C)에 해당하는 어드레스'1100000'를 전송하게 된다. 그러면 I2C 버스의 데이터 라인(SDA)에서 충돌이 발생하게 되고 데이터 라인(SDA)에서는 어드레스 '1000000'를 선택하게 된다. 왜냐하면 I2C 버스는 와이어드 앤드(Wired AND)이므로 데이터 라인(SDA)에서 두 개의 데이터, 즉 '1'과 '0'이 전송되는 경우에는 '0'의 데이터가 선택되게 된다. 따라서 7비트의 어드레스 중에서 첫 번째 비트인 '1'이 전송된후 두 번째 비트'0'과 '1'이 전송되면 '0'이 선택되어 전송되고 '1'을 전송하는 장치(B)는 마스터로서 버스 사용권을 상실하게 된다.That is, when the address of the device B is' 1000000 'and the address of the device C is'1100000', the device A is the address' 1000000 corresponding to the device B for data transmission with the device B. 'Is transmitted through the data line SDA, and the device B transmits an address'1100000' corresponding to the device C for data transmission with the device C. Then, a collision occurs in the data line SDA of the I 2 C bus, and the address '1000000' is selected in the data line SDA. Because the I 2 C bus is a wired AND, when two data, '1' and '0' are transmitted in the data line SDA, '0' data is selected. Therefore, if the first bit of the 7-bit address '1' is transmitted and the second bits '0' and '1' are transmitted, '0' is selected and transmitted, and the device B transmitting '1' is master. As a result, the bus license will be forfeited.

이때, 장치(B)는 슬레이브로 동작해야 하는데 바로 슬레이브로의 전환이 어려우므로 장치(A)에서는 장치(B)로의 데이터 전송을 위해 재시도를 해야 한다.In this case, the device B should operate as a slave, but since it is difficult to switch to the slave, the device A must retry to transmit data to the device B.

따라서 종래의 I2C의 데이터 전송 장치는 버스 사용권 상실로 발생되는 재전송으로 인해 I2C 버스를 사용하는 시간이 길어지게 되어 전송 효율이 떨어지는 문제점이 있었다.Therefore, the conventional I 2 C data transmission device has a problem that the transmission efficiency decreases due to a long time to use the I 2 C bus due to retransmission caused by a loss of bus license.

상기 문제점을 개선하기 위한 본 발명은 I2C 버스에서 각 마스터간의 데이터 전송시 버스 사용권 상실이 일어난 경우 전송된 어드레스를 점검하고 바로 슬레이브로 전환하여 재전송으로 발생되는 버스 사용 시간을 줄이기 위한 I2C 버스의 데이터 전송 장치 및 방법을 제공함에 그 목적이 있다.Present invention to improve the above problems, I 2 C, if the bus happened to the data transfer bus use loss between each of the master checks the transmitted address and switch directly to the slave to reduce the bus using time generated in the retransmission I 2 C It is an object of the present invention to provide a data transmission apparatus and method for a bus.

도 1a는 일반적인 I2C 버스의 구조도1A is a structural diagram of a typical I 2 C bus

도 1b는 종래의 I2C 버스의 데이터 전송 장치의 구성도1B is a block diagram of a data transmission apparatus of a conventional I 2 C bus

도 2는 시작 조건 및 종결 조건을 설명하기 위한 신호 파형도2 is a signal waveform diagram for explaining a start condition and a end condition.

도 3은 도 2의 동작을 설명하기 위한 흐름도3 is a flow chart for explaining the operation of FIG.

도 4는 본 발명에 의한 I2C 버스의 데이터 전송 장치의 구성도4 is a block diagram of an apparatus for transmitting data of an I 2 C bus according to the present invention.

도 5a는 도 5의 어드레스 비교부의 세부 구성도5A is a detailed block diagram of the address comparison unit of FIG. 5.

도 5b는 도 5의 버스 사용권 점검부의 세부 구성도5B is a detailed block diagram of the bus license check unit of FIG. 5.

도 5c는 도5의 종결 조건 검출부의 세부 구성도5C is a detailed configuration diagram of the termination condition detection unit of FIG. 5;

도 6은 본 발명에 의한 I2C 버스의 데이터 전송 방법의 흐름도6 is a flowchart of a data transmission method of an I 2 C bus according to the present invention.

도면의 주요 부분에 대한 부호의 설명Explanation of symbols for the main parts of the drawings

201 : 제어부202 : 시작 조건/종결 조건 발생부201: control unit 202: start condition / end condition generator

203 : 어드레스 비교부204 : 데이터 처리부203: address comparison section 204: data processing section

205 : 버스 사용권 점검부206 : 종결 조건 검출부205: bus license check unit 206: termination condition detection unit

211 : 어드레스 레지스터212 : 쉬프트 레지스터211: address register 212: shift register

213, 220, 221 : 비교기215 : 배타적 오아 게이트213, 220, 221: comparator 215: exclusive ora gate

상기 목적을 달성하기 위해 본 발명에 의한 I2C버스의 데이터 전송 장치는 I2C 버스의 데이타 라인과 클럭 라인을 통해 데이터 전송의 시작과 종결 상태를 나타내는 시작 조건 및 종결 조건을 발생하는 시작 조건/종결 조건 발생부; 상기 I2C 버스의 데이타 라인과 클럭 라인을 통해 데이터를 전송하고 수신된 데이터를 처리하는 데이터 처리부; 상기 시작 조건/종결 조건 발생부에서 출력되는 신호에 따라 상기 데이터 처리부에서 출력되는 데이터와 상기 I2C 버스의 데이타 라인을 통해 수신되는 데이터를 비교하여 I2C 버스 사용권의 상실 여부를 점검하는 버스 사용권 점검부; 상기 시작 조건/종결 조건 발생부와 상기 데이터 처리부를 제어하고 상기 버스 사용권 점검부의 출력에 따라 마스터에서 슬레이브로 전환하도록 제어하는 제어부; 상기 제어부의 제어에 따라 I2C 버스의 데이터 라인을 통해 수신되는 어드레스를 자신의 어드레와 비교하여 상기 제어부로 인터럽트 신호를 출력하는 어드레스 비교부; 및 상기 I2C 버스의 데이터 라인과 클럭 라인을 통해 전송되는 신호를 입력으로 데이터 전송의 종결 상태를 나타내는 종결 조건을 검출하여 상기 데이터 처리부로 출력하는 종결 조건 검출부를 포함하여 구성됨을 특징으로 한다.The data transmission apparatus of the I 2 C bus in accordance with the present invention for achieving the above object is started for generating a start condition and termination condition that indicates the start and end status of the data transmitted over the data line and the clock line of the I 2 C bus condition Terminating condition generator; A data processor which transmits data through data lines and clock lines of the I 2 C bus and processes the received data; A bus for checking whether the I 2 C bus license is lost by comparing data output from the data processing unit with data received through the data line of the I 2 C bus according to the signal output from the start condition / end condition generator. License check; A controller for controlling the start condition / end condition generator and the data processor to switch from master to slave according to the output of the bus usage right checker; An address comparison unit for outputting an interrupt signal to the controller by comparing an address received through a data line of an I 2 C bus with an address thereof under the control of the controller; And a termination condition detector configured to detect a termination condition indicating a termination state of the data transmission by inputting a signal transmitted through the data line and the clock line of the I 2 C bus and output the signal to the data processor.

또한, 상기 목적을 달성하기 위해 본 발명에 의한 I2C 버스의 데이터 전송 방법은 I2C 버스의 데이타 라인(SDA)과 클럭 라인을 통해 데이터 전송의 시작 상태를 나타내는 시작 조건과 데이타를 전송하는 시작 조건 및 데이타 전송 단계; 상기 전송된 데이타와 상기 I2C 버스의 데이터 라인을 통해 수신되는 데이타를 비교하여 버스 사용권 상실 여부를 판단하는 버스 사용권 상실 판단 단계; 상기 판단 결과 버스 사용권을 상실한 경우에는 자신의 어드레스와 상기 I2C 버스의 데이터 라인을 통해 전송되는 어드레스를 비교하는 어드레스 비교 단계; 상기 어드레스 비교 결과 어드레스가 동일하지 않은 경우에는 상기 시작 조건 및 데이터 전송 단계로 진행하여 재시도하는 재시도 단계; 및 상기 어드레스 비교 결과 어드레스가 동일한 경우에는 슬레이브로 전환하여 마스터의 요구에 따라 데이터를 처리하는 데이터 처리 단계에 의해 수행됨을 특징으로 한다.Further, the data transmission method of the I 2 C bus in accordance with the present invention for achieving the above object is for transmitting a start condition and data that represents the start state of the data transmitted over the data line (SDA) and the clock line of the I 2 C bus, Start condition and data transfer step; A bus right loss determination step of determining whether to lose a bus right by comparing the transmitted data with data received through a data line of the I 2 C bus; An address comparison step of comparing an address transmitted through a data line of the I 2 C bus with its own address when the bus usage right is lost as a result of the determination; A retry step of proceeding to the start condition and data transfer step and retrying when the address comparison result is not the same; And performing a data processing step of switching to a slave and processing data according to a master's request when the address is the same as a result of the address comparison.

이하 첨부한 도면을 참조하여 본 발명의 실시예를 상세히 설명한다.Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings.

본 발명에 의한 I2C 버스의 데이터 전송 장치는 도5에 도시한 바와 같이 시작 조건/종결 조건 발생부(202), 버스 사용권 점검부(205), 제어부(201), 어드레스 비교부(203), 데이터 처리부(204), 및 종결 조건 검출부(206)로 구성된다.As shown in FIG. 5, a data transfer apparatus for an I 2 C bus according to the present invention includes a start condition / end condition generator 202, a bus license check unit 205, a controller 201, and an address comparison unit 203. , A data processing unit 204, and a termination condition detection unit 206.

상기 시작 조건/종결 조건 발생부(202)는 제어부(201)의 제어에 따라 I2C 버스의 데이타 라인(SDA)과 클럭 라인(SCL)을 통해 데이터 전송의 시작과 종결 상태를 나타내는 시작 조건 및 종결 조건을 발생한다.The start condition / end condition generator 202 is a start condition indicating a start and end state of data transmission through the data line SDA and the clock line SCL of the I 2 C bus under the control of the control unit 201; Raises the termination condition.

상기 데이터 처리부(204)는 제어부(201)의 제어에 따라 상기 I2C 버스의 데이타 라인(SDA)과 클럭 라인(SCL)을 통해 데이터를 전송하고 수신된 데이터를 처리한다.The data processor 204 transmits data through the data line SDA and the clock line SCL of the I 2 C bus under the control of the controller 201 and processes the received data.

상기 버스 사용권 점검부(205)는 상기 시작 조건/종결 조건 발생부(202)에서 출력되는 신호에 따라 상기 데이터 처리부(204)에서 출력되는 데이터와 상기 I2C 버스의 데이타 라인(SDA)을 통해 수신되는 데이터를 비교하여 I2C 버스 사용권의 상실 여부를 점검하여 상기 제어부(201)로 버스 사용권 상실시 인터럽트를 출력한다.The bus license checker 205 is configured to output the data from the data processor 204 and the data line SDA of the I 2 C bus according to a signal output from the start / end condition generator 202. The received data is compared to check whether the I 2 C bus license is lost, and a bus license loss interrupt is output to the controller 201.

상기 제어부(201)는 CPU로 이루어져 상기 시작 조건/종결 조건 발생부(202)와 상기 데이터 처리부(204)를 제어하고 상기 버스 사용권 점검부(205)의 출력에 따라 마스터에서 슬레이브로 전환하도록 제어한다.The controller 201 includes a CPU to control the start condition / end condition generator 202 and the data processor 204 and switch from the master to the slave according to the output of the bus usage right checker 205. .

상기 어드레스 비교부(203)는 상기 제어부(201)의 제어에 따라 I2C 버스의 데이터 라인(SDA)을 통해 수신되는 어드레스를 자신의 어드레스와 비교하여 상기 제어부(201)로 인터럽트 신호를 출력한다.The address comparison unit 203 outputs an interrupt signal to the controller 201 by comparing an address received through the data line SDA of the I 2 C bus with its own address under the control of the controller 201. .

상기 종결 조건 검출부(206)는 상기 I2C 버스의 데이터 라인(SDA)과 클럭 라인(SCL)을 통해 전송되는 신호를 입력으로 데이터 전송의 종결 상태를 나타내는 종결 조건을 검출하여 상기 데이터 처리부(204)로 출력한다.The termination condition detector 206 detects a termination condition indicating a termination state of the data transmission by inputting a signal transmitted through the data line SDA and the clock line SCL of the I 2 C bus and the data processor 204. )

이와 같이 구성되는 본 발명에 의한 I2C 버스의 데이터 전송 장치는 버스 사용권 포기 또는 상실이 일어난 경우에 마스터가 즉시 슬레이브로 전환되어 다른 마스터가 전송하는 데이터를 받고 다른 마스터로 데이터를 전송할 의무가 있는지를 판별하기 위해서 다른 마스터가 전송한 어드레스를 점검해야 하는데, 이러한 과정을 설명하면 다음과 같다.The data transmission device of the I 2 C bus according to the present invention configured as described above has a duty to transfer data from another master to another master by immediately switching to a slave when a bus license is waived or lost. In order to determine this, it is necessary to check the address transmitted from another master.

데이터의 전송을 위해 먼저 제어부(201)에서 상기 시작 조건/종결 조건 발생부(202)를 제어하여 상기 시작 조건/종결 조건 발생부(202)에서 시작 조건을 발생하도록 한다. 즉, 도 3에 도시한 바와 같이 클럭 라인(SCL)과 데이터 라인(SDA)으로 신호를 출력하여 클럭 라인(SCL)이 '1'인 상태에서 데이터 라인(SDA)이 '1'에서 '0'으로 천이하도록 한다.In order to transmit the data, the controller 201 first controls the start condition / end condition generator 202 so that the start condition / end condition generator 202 generates a start condition. That is, as shown in FIG. 3, the data line SDA is '1' to '0' while the clock line SCL is '1' by outputting signals to the clock line SCL and the data line SDA. To make a transition.

이와 같이 시작 조건을 전송한후에는 제어부(201)의 제어에 따라 데이터 처리부(204)에서 데이터 라인(SDA)를 구동시켜 어드레스에 해당하는 데이터를 전송하게 된다. 이때, 버스 사용권 점검부(205)에서는 데이터 라인(SDA)을 통해 수신되는 데이터와 상기 데이터 처리부(204)로부터 데이터 라인(SDA)으로 출력되는 데이터를 비교하여 버스 사용권이 상실되었는지를 판단하게 된다.After transmitting the start condition as described above, the data processor 204 drives the data line SDA under the control of the controller 201 to transmit data corresponding to the address. At this time, the bus license check unit 205 compares the data received through the data line SDA with the data output from the data processor 204 to the data line SDA to determine whether the bus license is lost.

즉, 버스 사용권 점검부(205)에서 하나의 장치가 구동하는 데이터의 상태와 실제의 데이터 라인(SDA)의 상태의 동일 여부를 검사한다. 이때, 동일하다면 현재까지는 버스 사용권을 점유하고 있는 것이다. 또한, 구동 데이터와 실제 데이터 라인(SDA)의 상태가 다르면 버스 사용권을 상실한 것으로 판단하고 버스 사용권을 포기해야 한다. 또한, 데이터 라인(SDA)에 타 장치가 인지 신호(ACKNOWLEDGE)를 구동한 경우에는 버스 사용권을 포기하고 나중에 재시도를 해야 한다.That is, the bus usage right checking unit 205 checks whether the state of the data driven by one device and the state of the actual data line SDA are the same. At this time, if they are the same, they occupy the right to use the bus. In addition, when the driving data and the actual data line SDA are different from each other, it is determined that the bus right has been lost and the bus right must be given up. In addition, when another device drives the acknowledgment signal ACKNOWLEDGE on the data line SDA, the user must give up the bus right and try again later.

이와 같이 버스 사용권 점검부(205)에서 버스 사용권 상실을 검출하게 되면 상기 제어부(201)로 버스 사용권 상실을 알리는 인터럽트를 출력하게 된다.When the bus license check unit 205 detects the loss of the bus license, the controller 201 outputs an interrupt indicating the loss of the bus license.

한편, 데이터 라인(SDA)으로 전송하는 전송 비트의 수가 8비트 미만인 경우 버스 사용권을 포기해야 하면 현재 데이터 라인의 어드레스가 지기 자신의 어드레스와 동일한지에 대해 검토가 있어야 한다. 이를 위해 8비트 이하의 데이터 전송 도중 버스 사용권을 포기해야 하는 경우가 발생하면 제어부(201)에서 어드레스 비교부(203)를 구동시킨다.On the other hand, if the number of transmission bits transmitted to the data line SDA is less than 8 bits, if the bus right to be given up must be examined, it is necessary to examine whether the address of the current data line is the same as the address of its own. To this end, if a case in which a bus right to be given up must be abandoned during data transmission of 8 bits or less occurs, the controller 201 drives the address comparison unit 203.

어드레스 비교부(203)에서는 하나의 장치가 구동하는 데이터와 실제 데이터가 달리지는 시점 바로 전까지의 데이터 라인(SDA)의 데이터를 버퍼에 저장해놓고 달라지는 시점 부터의 데이터를 데이터 라인(SDA)의 입력으로 사용하여 전송되는 어드레스를 발생시키고, 이를 자기 자신의 어드레스와 비교한다. 비교 결과 전송된 어드레스와 자신의 어드레스가 동일하면 제어부(201)로 인터럽트 신호를 출력한다.In the address comparison unit 203, the data of the data line SDA just before the time at which the data driven by one device is different from the actual data is stored in the buffer, and the data from the time at which the data is changed is input to the data line SDA. Generate an address to be transmitted and compare it with its own address. As a result of the comparison, if the transmitted address and the own address are the same, the interrupt signal is output to the control unit 201.

이때, 마스터의 지정 동작 방법, 즉 읽기/쓰기 데이터를 판별하여 인터럽트 발생시 제어부(201)로 인터럽트 신호와 같이 전송하게 된다. 즉, 읽기/쓰기 데이터는 1비트로 이루어져서 어드레스 전송후에 바로 전송되는데 어드레스가 7비트로 이루어지는 경우에는 바로 전송되는 8번째 비트가 읽기/쓰기 데이터가 된다.At this time, the designated operation method of the master, that is, read / write data is determined and transmitted to the control unit 201 as an interrupt signal when an interrupt occurs. That is, the read / write data consists of 1 bit and is transmitted immediately after the address transfer. When the address consists of 7 bits, the 8th bit immediately transmitted becomes read / write data.

어드레스 비교부(203)의 어드레스 비교 결과 동일한 어드레스로 인터럽트 신호가 출력되면 제어부(201)에서는 인터럽트 처리 함수를 마스터의 지정 조건, 즉 읽기/쓰기 조건에 따라서 데이터를 처리하도록 데이터 처리부(204)를 제어한다. 즉, 제어부(201)의 제어에 따라 일 장치를 마스터에서 슬레이브로 전환하고 데이터 처리부(204)에서는 마스터인 타장치의 요구에 따라 읽기인 경우 데이터 라인(SDA)과 클럭 라인(SCL)을 이용하여 전송되는 8비트의 데이터를 입력으로 사용하여 데이터를 출력하고, 쓰기인 경우 마스터로 부터 데이터 라인(SDA)과 클럭 라인(SCL)을 통해 전송되는 데이터를 수신하여 자기 장치, 즉 일장치에 쓰게 된다.When the interrupt signal is output to the same address as a result of the address comparison of the address comparison unit 203, the control unit 201 controls the data processing unit 204 to process the data according to the master's designated condition, that is, a read / write condition. do. That is, under the control of the control unit 201, one device is switched from the master to the slave, and the data processing unit 204 uses the data line SDA and the clock line SCL in the case of reading at the request of another device as the master. It outputs data using 8-bit data transmitted as input, and in writing, it receives data transmitted through data line (SDA) and clock line (SCL) from master and writes to magnetic device, that is, one device. .

다시말해서 읽기인 경우에는 슬레이브로 전환된 일장치의 데이터 처리부(204)에서 클럭 라인(SCL)이 하이 레벨인 상태에서 데이터 라인(SDA)을 통해 타장치인 마스터로 데이터를 전송하게 되고, 쓰기인 경우에는 마스터의 제어에 따라 마스터로부터 클럭 라인(SCL)과 데이터 라인(SDA)을 통해 전송되는 데이터를 슬레이브로 전환된 일장치에 데이터 처리부(204)의 동작에 따라 쓰게 된다.In other words, in the case of reading, the data processing unit 204 of the one device that is switched to the slave transfers data to the master, which is another device, through the data line SDA while the clock line SCL is at a high level. In this case, under the control of the master, data transmitted from the master through the clock line SCL and the data line SDA is written to one device switched to the slave according to the operation of the data processor 204.

인터럽트 처리 함수에는 인터럽트가 발생하기전인 응용 프로그램으로 환원하기 전에 소위 이벤트 루틴(Event Routine)이라고 불리는 특정한 루팅을 수행하여 전송하거나 전송된 데이터를 간단하게 처리하도록 한다.Interrupt handling functions allow you to perform specific routing, called event routines, before processing back to the application before the interrupt occurred, and to simply process the transmitted or transmitted data.

이와 같이 데이터 처리부(204)의 데이터 처리후에 종결 조검 검출부(206)에서 종결조건이 검출되면 데이터 처리부(204)의 동작을 중단시킨다. 즉, 종결 조건 검출부(206)에서는 클럭 라인(SCL)이 '1'인 상태에서 데이터 라인(SDA)이 '0'에서 '1'로 변하는 시점을 검출하여 데이터 처리부(204)로 출력한다.As described above, when the termination condition detection unit 206 detects the termination condition after the data processing unit 204 processes the data, the operation of the data processing unit 204 is stopped. That is, the termination condition detector 206 detects a time point at which the data line SDA changes from '0' to '1' while the clock line SCL is '1' and outputs it to the data processor 204.

또한, 어드레스 비교부(203)의 어드레스 비교 결과 동일한 어드레스가 아니면 재시도를 수행할 수 있도록 제어부(201)에서 제어하게 된다.In addition, if the address comparison result of the address comparison unit 203 is not the same address, the control unit 201 is to control to perform a retry.

한편, 버스 사용권 점검부(205)는 버스 사용권에 대한 포기 또는 상실 여부를 데이터를 전송하고 종결 조건을 전송할때까지 계속 수행해야 한다.On the other hand, the bus license check unit 205 should continue to carry out until the transfer of the data and whether the termination conditions for the transfer or loss of the bus license.

다음으로, 도 6, 도 7, 및 도 8을 참조하여 본 발명을 구성하는 어드레스 비교부(203), 버스 사용권 점검부(205), 및 종결 조건 검출부(206)의 세부 구성 및 동작을 설명한다.Next, with reference to Figs. 6, 7, and 8, detailed configurations and operations of the address comparison unit 203, the bus usage right checking unit 205, and the termination condition detecting unit 206 constituting the present invention will be described. .

상기 어드레스 비교부(203)는 도 6에 도시한 바와 같이 자신의 어드레스를 저장하는 어드레스 레지스터(211), 상기 I2C 버스의 데이터 라인(SDA)을 통해 수신되는 어드레스를 쉬프트시켜 출력하는 쉬프트 레지스터(212), 및 상기 어드레스 레지스터(211)로부터 출력되는 어드레스와 상기 어드레스 레지스터(211)에 저장된 어드레스를 비교하여 상기 제어부(201)로 출력하는 비교기(213)로 구성된다.As illustrated in FIG. 6, the address comparison unit 203 shifts and outputs an address register 211 storing its own address and an address received through the data line SDA of the I 2 C bus. 212 and a comparator 213 for comparing the address output from the address register 211 with the address stored in the address register 211 and outputting the same to the control unit 201.

이와 같이 구성되는 어드레스 비교부(203)의 동작을 설명한다.The operation of the address comparison section 203 configured in this manner will be described.

버스 사용권을 상실한 경우 어드레스 비교부(203)는 비교 동작을 수행하게 된다. 즉, 어드레스 비교부(203)에서는 데이터 처리부(204)로부터 데이터 라인(SDA)으로 버스 사용권 상실 시점까지 전송된 데이터와 이후의 데이터 라인(SDA)의 상태에 따라 다른 마스터가 자기 자신을 슬레이브로 지정했는가를 검사하게 된다.When the bus right to use is lost, the address comparison unit 203 performs a comparison operation. That is, in the address comparison unit 203, another master designates itself as a slave according to the data transmitted from the data processing unit 204 to the data line SDA until the bus license loss point and the state of the subsequent data line SDA. Will be checked.

쉬프트 레지스터(212)에서는 제어부(201)의 제어에 따라 시작 조건 발생 이후 데이터 라인(SDA)으로 전송된 데이터와 데이터 라인(SDA)의 상태를 저장하고 쉬프트시켜 비교기(213)로 출력한다. 한편, 어드레스 레지스터(211)에는 자신의 어드레스가 저장되어 있어 어드레스 비교 동작이 수행되어 쉬프트 레지스터(212)에서 전송된 데이터가 비교기(213)로 출력되면 자기 자신의 어드레스를 비교기(213)로 출력하게 된다.The shift register 212 stores and shifts the data transmitted to the data line SDA and the state of the data line SDA after the start condition is generated under the control of the controller 201, and outputs the shifted data to the comparator 213. On the other hand, the address register 211 stores its own address so that when the address comparison operation is performed and the data transmitted from the shift register 212 is output to the comparator 213 to output its own address to the comparator 213 do.

비교기(213)에서는 어드레스 레지스터(211)로부터 출력되는 자기 자신의 어드레스와 쉬프트 레지스터(212)로부터 출력되는 데이터 라인(SDA)으로 전송된 어드레스를 비교하여 동일한 경우에는 타 마스터가 자기 자신을 슬레이브로 지정한 것으로 판단하여 제어부(201)로 인터럽트 신호를 출력하게 된다.The comparator 213 compares its own address output from the address register 211 with the address transferred to the data line SDA output from the shift register 212 and, in the same case, designates itself as a slave. In response to the determination, the controller 201 outputs an interrupt signal.

한편, 어드레스 비교부(203)에서 마스터의 지정 조건을 검출하여 읽기/쓰기 동작을 제어부(201)로 알리기도 하는데, 이는 어드레스 레지스터(211)에 자기 자신의 어드레스와 함께 특정 동작 조건, 예를 들어 읽기 조건에 해당하는 데이터를 저장하고 있도록하여 비교기(213)에서 쉬프트 레지스터(212)로부터 출력되는 마스터의 지정 조건 신호와 비교하여 이루어지도록 한다.On the other hand, the address comparison unit 203 detects the master's designated condition and informs the control unit 201 of the read / write operation, which is specified in the address register 211 together with its own address. The data corresponding to the read condition is stored so that the comparator 213 compares the master condition signal output from the shift register 212.

예를 들어, 어드레스 레지스터(211)에 읽기 동작 조건으로 '1'을 저장한 경우 쉬프트 레지스터(212)에서 '1'이 출력되면 마스터의 지정 조건이 읽기가 되는 것이고, 쉬프트 레비스터(212)에서 '0'이 출력되면 마스터의 지정 조건이 쓰기가 되는 것이다.For example, when '1' is stored in the address register 211 as a read operation condition, when '1' is output from the shift register 212, the designated condition of the master is read, and the shift register 212 If '0' is outputted, the designated condition of master is written.

상기 버스 사용권 점검부(205)는 도 7에 도시한 바와 같이 상기 데이터 처리부(204)에서 I2C 버스의 데이타 라인(SDA)을 통해 출력되는 데이터와 상기 I2C 버스의 데이타 라인(SDA)을 통해 수신되는 데이터를 입력으로 배타적 논리합하는 배타적 오아 게이트(215)로 구성된다.The bus use check unit 205 one the data processing unit 204 from the data lines of the data and the I 2 C bus to be output through the data line (SDA) of the I 2 C bus, as shown in Figure 7 (SDA) It consists of an exclusive OR gate 215 exclusively ORing the data received through the input.

상기 데이터 처리부(204)에서 I2C 버스의 데이타 라인(SDA)을 통해 출력되는 데이터와 상기 I2C 버스의 데이타 라인(SDA)을 통해 수신되는 데이터가 동일한 경우에는 배타적 오아 게이트(215)에서 '0'을 출력하게 되고, 상기 데이터 처리부(204)에서 I2C 버스의 데이타 라인(SDA)을 통해 출력되는 데이터와 상기 I2C 버스의 데이타 라인(SDA)을 통해 수신되는 데이터가 동일하지 않은 경우에는 배타적 오아 게이트(215)에서 '1'을 출력하여 인터럽트를 발생하므로써 제어부(201)로 버스 사용권의 상실을 알리게 된다.If the data received through the data processing unit 204, data and the I 2 data lines of the C bus (SDA), which is output through the data line (SDA) of the I 2 C bus in the same, in the exclusive Iowa gate 215 and outputs "0", the data received through the data processing unit 204, the data line (SDA) of the data and the I 2 C bus to be output through the data line (SDA) of the I 2 C bus is not the same If not, the exclusive OR gate 215 outputs '1' to generate an interrupt, thereby notifying the control unit 201 of the loss of bus usage rights.

또한, 상기 종결 조건 검출부(206)는 도 8에 도시한 바와 같이 상기 I2C 버스의 클럭 라인(SCL)을 통해 전송되는 신호에 따라 인에이블되어 상기 데이터 라인(SDA)을 통해 전송되는 신호와 '0'을 비교하는 비교기(220); 및 상기 I2C 버스의 클럭 라인(SCL)을 통해 전송되는 신호에 따라 인에이블되어 상기 비교기(220)의 출력 신호와 상기 데이터 라인(SDA)을 통해 전송되는 신호를 비교하여 상기 데이터 처리부(204)로 출력하는 비교기(221)로 구성된다.In addition, as shown in FIG. 8, the termination condition detector 206 is enabled according to a signal transmitted through the clock line SCL of the I 2 C bus and is transmitted through the data line SDA. A comparator 220 for comparing '0'; And the data processor 204 by comparing the output signal of the comparator 220 with the signal transmitted through the data line SDA and enabled according to a signal transmitted through the clock line SCL of the I 2 C bus. It consists of a comparator 221 to output to.

이와 같이 구성되는 종결 조건 검출부(206)의 동작을 설명한다.The operation of the termination condition detection unit 206 configured as described above will be described.

I2C 버스의 클럭 라인(SCL)을 통해 전송되는 클럭이 '1'인 경우 비교기(220, 221)가 인에이블된다.When the clock transmitted through the clock line SCL of the I 2 C bus is '1', the comparators 220 and 221 are enabled.

이때, 종결 조건을 검출하기 위해 I2C 버스의 데이타 라인(SDA)을 통해 전송되는 데이타와 '0'을 비교기(220)에서 비교하여 출력한다.At this time, the comparator 220 compares the data transmitted through the data line SDA of the I 2 C bus and '0' to output the termination condition.

여기서, I2C 버스의 데이타 라인(SDA)을 통해 전송되는 데이타가 '0'인 경우에는 비교기(220)에서 '1'을 출력하게 되고 비교기(220)에서 출력된 신호는 다시 비교기(221)에서 I2C 버스의 데이타 라인(SDA)을 통해 전송되는 데이타와 비교되어 데이터 처리부(204)로 출력되게 된다.Here, when the data transmitted through the data line SDA of the I 2 C bus is '0', the comparator 220 outputs '1', and the signal output from the comparator 220 is again the comparator 221. In comparison with the data transmitted through the data line (SDA) of the I 2 C bus is output to the data processor 204.

여기서, I2C 버스의 데이타 라인(SDA)을 통해 전송되는 데이타가 '1'인 경우에는 비교기(221)에서 '1'을 출력하게 되어 종결 조건임을 데이터 처리부(204)에 알리고 데이터 처리부(204)에서는 모든 데이터의 처리를 중단하게 된다.Here, when the data transmitted through the data line SDA of the I 2 C bus is '1', the comparator 221 outputs '1' to inform the data processor 204 of the termination condition and the data processor 204. ) Will stop processing all data.

한편, I2C 버스의 클럭 라인(SCL)을 통해 전송되는 클럭이 '1'이 아닌 경우에는 종결 조건을 만족하지 않으므로 비교기(220, 221)가 디스에이블되어 시작 조건 및 종결 조건을 검출하지 않게 된다.On the other hand, when the clock transmitted through the clock line SCL of the I 2 C bus is not '1', the termination condition is not satisfied, so that the comparators 220 and 221 are disabled so that the start condition and the termination condition are not detected. do.

또한, I2C 버스의 데이터 전송 방법은 도 9에 도시한 바와 같이 시작 조건 및 데이터 전송 단계(300), 버스 사용권 상실 판단 단계(301), 어드레스 비교 단계(303), 재시도 단계(306), 및 데이터 처리 단계(304, 305)에 의해 수행된다.In addition, the data transmission method of the I 2 C bus, as shown in Figure 9, the start condition and data transmission step 300, the bus license loss determination step 301, the address comparison step 303, retry step 306 , And data processing steps 304 and 305.

상기 시작 조건 및 데이터 전송 단계(300)는 I2C 버스의 데이타 라인(SDA)과 클럭 라인(SCL)을 통해 데이터 전송의 시작 상태를 나타내는 시작 조건과 데이타를 전송하는 단계이다.The start condition and data transmission step 300 is a step of transmitting data and a start condition indicating a start state of data transmission through the data line SDA and the clock line SCL of the I 2 C bus.

상기 버스 사용권 상실 판단 단계(301)는 상기 전송된 데이타와 상기 I2C 버스의 데이터 라인(SDA)을 통해 수신되는 데이타를 비교하여 버스 사용권 상실 여부를 판단하는 단계이다.The bus license determination step 301 is a step of determining whether the bus license is lost by comparing the transmitted data with data received through the data line SDA of the I 2 C bus.

상기 어드레스 비교 단계(303)는 상기 버스 사용권 상실 판단 단계(301)의 수행 결과 버스 사용권을 상실한 경우에는 자신의 어드레스와 상기 I2C 버스의 데이터 라인(SDA)을 통해 전송되는 어드레스를 비교하는 단계이다.The address comparing step 303 compares its own address with an address transmitted through the data line SDA of the I 2 C bus when the bus right is lost as a result of performing the bus right loss determination step 301. to be.

상기 재시도 단계(306)는 상기 어드레스 비교 결과 어드레스가 동일하지 않은 경우에는 상기 시작 조건 및 데이터 전송 단계(300)로 진행하여 재시도하는 단계이다.The retry step 306 proceeds to the start condition and the data transfer step 300 and retries when the address comparison result is not the same.

상기 데이터 처리 단계(304, 305)는 상기 어드레스 비교 결과 어드레스가 동일한 경우에는 슬레이브로 전환하여 마스터의 요구에 따라 데이터를 처리하는 단계이다.In the data processing steps 304 and 305, when the address comparison results in the same address, the data processing step switches to a slave and processes data according to a request of the master.

이와 같이 이루어지는 I2C 버스의 데이터 전송 방법의 수행 과정을 설명한다.The process of performing the data transmission method of the I 2 C bus is described.

I2C 버스를 통해 데이터를 전송하기 위해서는 먼저 시작 조건과 어드레스를 전송해야 한다(300). 즉, I2C 버스의 클럭 라인(SCL)이 하이 레벨로 구동하는 동안 데이터 라인(SDA)을 하이 레벨에서 로우 레벨로 천이시켜 데이터 전송의 시작임을 다른 장치, 즉 슬레이브로 전송한후에는 원하는 슬레이브를 선택하기 위해 어드레스를 전송한다.In order to transmit data through the I 2 C bus, a start condition and an address must first be transmitted (300). In other words, while the clock line SCL of the I 2 C bus is driven at the high level, the data line SDA is shifted from the high level to the low level to transmit the start of data transmission to another device, that is, the slave, after transferring the desired slave. Send the address to select.

이와 같이 시작 조건과 어드레스 전송후에는 버스 사용권 상실 여부를 판단한다(301). 즉, I2C 버스의 데이터 라인에 실려 전송되는 데이터와 자신의 장치가 전송한 데이터가 동일한지 비교한다.In this manner, after the start condition and the address transmission, it is determined whether the bus right is lost (301). That is, it compares whether the data transmitted on the data line of the I 2 C bus and the data transmitted by the device are the same.

이때, 동일하면 버스 사용권이 포기되지 않은 것으로 판단하고 계속해서 슬레이브와 데이터를 처리하게 된다(307). 또한, 동일하지 않으면 버스 사용권이 포기된 것으로 판단하고 I2C 버스의 데이터 라인에 실려 전송되는 어드레스와 자신의 장치에 해당하는 어드레스가 동일한지를 비교한다(302).At this time, if it is the same, it is determined that the bus right has not been abandoned and continues to process data with the slave (307). In addition, if it is not the same, it is determined that the bus right has been waived and compares whether the address carried on the data line of the I 2 C bus and the address corresponding to the device are the same (302).

이때 비교 결과 I2C 버스의 데이터 라인에 실려 전송되는 어드레스와 자신의 어드레스가 동일하지 않으면 재시도를 위해 일정 시간 경과후 시작 조건과 어드레스를 전송하는 단계(300)로 진행한다(306). 또한, 비교 결과 I2C 버스의 데이터 라인에 실려 전송되는 어드레스와 자신의 어드레스가 동일하면 슬레이브로 전환하여 마스터인 다른 장치, 즉 버스 사용권을 가지고 있는 장치의 요구에 따라 데이터를 처리한다(304).At this time, if the address transmitted on the data line of the I 2 C bus and its own address are not the same, the process proceeds to step 300 in which the start condition and the address are transmitted 300 after a predetermined time for retrying (306). In addition, if the address transmitted on the data line of the I 2 C bus and its own address are the same, the slave device switches to the slave and processes data according to a request of another device that is a master, that is, a device having a bus right (304). .

데이터 처리후 종결 조건이 마스터로부터 전송되면 슬레이브에서는 이를 검출하여 데이터 전송을 마친후(305) 다시 처음의 데이터 처리를 위해 재시도를 수행한다.When the termination condition is transmitted from the master after the data processing, the slave detects this and finishes the data transmission (305), and then retries for the first data processing.

이상에서 설명한 바와 같이 본 발명에 의한 I2C 버스의 데이터 전송 장치 및 방법은 I2C 버스 상에 다수의 마스터가 존재하여 버스 사용권의 상실이 발생했을 때 빠르게 마스터에서 슬레이브로 전환되어 전송 효율을 높이는 효과가 있다.As described above, an apparatus and method for transmitting data on an I 2 C bus according to the present invention are quickly switched from a master to a slave when a plurality of masters exist on an I 2 C bus and loss of bus license occurs, thereby improving transmission efficiency. The height is effective.

Claims (5)

I2C 버스의 데이타 라인(SDA)과 클럭 라인(SCL)을 통해 데이터 전송의 시작과 종결 상태를 나타내는 시작 조건 및 종결 조건을 발생하는 시작 조건/종결 조건 발생부(202);A start condition / termination condition generator 202 for generating a start condition and a termination condition indicating a start and end state of data transmission through the data line SDA and the clock line SCL of the I 2 C bus; 상기 I2C 버스의 데이타 라인(SDA)과 클럭 라인(SCL)을 통해 데이터를 전송하고 수신된 데이터를 처리하는 데이터 처리부(204);A data processor 204 for transmitting data through the data line SDA and the clock line SCL of the I 2 C bus and processing the received data; 상기 시작 조건/종결 조건 발생부(202)에서 출력되는 신호에 따라 상기 데이터 처리부(204)에서 출력되는 데이터와 상기 I2C 버스의 데이타 라인(SDA)을 통해 수신되는 데이터를 비교하여 I2C 버스 사용권의 상실 여부를 점검하는 버스 사용권 점검부(205);According to the signal output from the start condition / end condition generator 202, the data output from the data processor 204 is compared with the data received through the data line SDA of the I 2 C bus, thereby obtaining I 2 C. A bus license check unit 205 for checking whether a bus license is lost; 상기 시작 조건/종결 조건 발생부(202)와 상기 데이터 처리부(204)를 제어하고 상기 버스 사용권 점검부(205)의 출력에 따라 마스터에서 슬레이브로 전환하도록 제어하는 제어부(201);A controller 201 controlling the start condition / end condition generator 202 and the data processor 204 and switching from the master to the slave according to the output of the bus license check unit 205; 상기 제어부(201)의 제어에 따라 I2C 버스의 데이터 라인(SDA)을 통해 수신되는 어드레스를 자신의 어드레와 비교하여 상기 제어부(201)로 인터럽트 신호를 출력하는 어드레스 비교부(203); 및An address comparison unit 203 for outputting an interrupt signal to the controller 201 by comparing an address received through a data line SDA of an I 2 C bus with an address thereof under the control of the controller 201; And 상기 I2C 버스의 데이터 라인(SDA)과 클럭 라인(SCL)을 통해 전송되는 신호를 입력으로 데이터 전송의 종결 상태를 나타내는 종결 조건을 검출하여 상기 데이터 처리부(204)로 출력하는 종결 조건 검출부(206)를 포함하여 구성됨을 특징으로 하는 I2C 버스의 데이터 전송 장치.Termination condition detection unit for detecting the termination condition indicating the termination state of the data transmission to the data processing unit 204 as a signal transmitted through the data line (SDA) and the clock line (SCL) of the I 2 C bus ( Data transmission apparatus of an I 2 C bus, characterized in that it comprises a. 제1항에 있어서, 상기 어드레스 비교부(203)는 자신의 어드레스를 저장하는 어드레스 레지스터(211); 상기 I2C 버스의 데이터 라인(SDA)을 통해 수신되는 어드레스를 쉬프트시켜 출력하는 쉬프트 레지스터(212); 및 상기 어드레스 레지스터(211)로부터 출력되는 어드레스와 상기 어드레스 레지스터(211)에 저장된 어드레스를 비교하여 상기 제어부(201)로 출력하는 비교기(213)로 구성됨을 특징으로 하는 I2C 버스의 데이터 전송 장치.The apparatus of claim 1, wherein the address comparison unit comprises: an address register 211 for storing its address; A shift register 212 for shifting and outputting an address received through a data line SDA of the I 2 C bus; And a data transfer unit between the address and the address I 2 C bus, by comparing the stored address in the register (211), characterized by consisting of a comparator 213, which outputs to the controller 201 which is output from the address register 211 . 제 1 항에 있어서, 상기 버스 사용권 점검부(205)는 상기 데이터 처리부(204)에서 I2C 버스의 데이타 라인(SDA)을 통해 출력되는 데이터와 상기 I2C 버스의 데이타 라인(SDA)을 통해 수신되는 데이터를 입력으로 배타적 논리합하는 배타적 오아 게이트(215)로 구성됨을 특징으로 하는 I2C 버스의 데이터 전송 장치.The method of claim 1, wherein the bus use check unit 205 to the data processing unit 204, the data line (SDA) of the data and the I 2 C bus to be output through the data line (SDA) of the I 2 C bus in I 2 C bus of a data transmission device characterized in that the data adapted to be received in the exclusive Iowa gate 215 to the exclusive-OR as an input through. 제 1 항에 있어서, 상기 종결 조건 검출부(206)는 상기 I2C 버스의 클럭 라인(SCL)을 통해 전송되는 신호에 따라 인에이블되어 상기 데이터 라인(SDA)을 통해 전송되는 신호와 '0'을 비교하는 제1 비교기(220); 및 상기 I2C 버스의 클럭 라인(SCL)을 통해 전송되는 신호에 따라 인에이블되어 상기 제1 비교기(220)의 출력 신호와 상기 데이터 라인(SDA)을 통해 전송되는 신호를 비교하여 상기 데이터 처리부(204)로 출력하는 제2 비교기(221)로 구성됨을 특징으로 하는 I2C 버스의 데이터 전송 장치.The terminal of claim 1, wherein the termination condition detection unit 206 is enabled according to a signal transmitted through the clock line SCL of the I 2 C bus and is transmitted through the data line SDA. The first comparator 220 to compare the; And a data processor configured to compare the output signal of the first comparator 220 with the signal transmitted through the data line SDA, enabled according to a signal transmitted through the clock line SCL of the I 2 C bus. 204. the data transfer apparatus of the I 2 C bus, characterized by consisting of a second comparator 221 for outputting a. I2C 버스의 데이타 라인(SDA)과 클럭 라인(SCL)을 통해 데이터 전송의 시작 상태를 나타내는 시작 조건과 데이타를 전송하는 시작 조건 및 데이타 전송 단계(300);A start condition indicating a start state of data transfer through a data line SDA and a clock line SCL of the I 2 C bus, a start condition for transferring data, and a data transfer step 300; 상기 전송된 데이타와 상기 I2C 버스의 데이터 라인(SDA)을 통해 수신되는 데이타를 비교하여 버스 사용권 상실 여부를 판단하는 버스 사용권 상실 판단 단계(301);A bus right loss determination step (301) of determining whether a bus right is lost by comparing the transmitted data with data received through a data line (SDA) of the I 2 C bus; 상기 판단 결과 버스 사용권을 상실한 경우에는 자신의 어드레스와 상기 I2C 버스의 데이터 라인(SDA)을 통해 전송되는 어드레스를 비교하는 어드레스 비교 단계(303);An address comparison step (303) of comparing an address transmitted through a data line (SDA) of the I 2 C bus with its own address when the bus usage right is lost as a result of the determination; 상기 어드레스 비교 결과 어드레스가 동일하지 않은 경우에는 상기 시작 조건 및 데이터 전송 단계(300)로 진행하여 재시도하는 재시도 단계(306); 및A retry step (306) of proceeding to the start condition and data transfer step (300) and retrying when the address comparison result is not the same; And 상기 어드레스 비교 결과 어드레스가 동일한 경우에는 슬레이브로 전환하여 마스터의 요구에 따라 데이터를 처리하는 데이터 처리 단계(304, 305)에 의해 수행됨을 특징으로 하는 I2C 버스의 데이터 전송 방법.When the address comparison result, the same address and switch to the slave data processing step (304, 305) I 2 C bus of a data transmission method which is characterized in that processes are executed by the data in accordance with the master request.
KR1019960050266A 1996-10-30 1996-10-30 Data transmission device of 12c bus KR0181596B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1019960050266A KR0181596B1 (en) 1996-10-30 1996-10-30 Data transmission device of 12c bus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1019960050266A KR0181596B1 (en) 1996-10-30 1996-10-30 Data transmission device of 12c bus

Publications (2)

Publication Number Publication Date
KR19980030788A KR19980030788A (en) 1998-07-25
KR0181596B1 true KR0181596B1 (en) 1999-05-15

Family

ID=19479831

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1019960050266A KR0181596B1 (en) 1996-10-30 1996-10-30 Data transmission device of 12c bus

Country Status (1)

Country Link
KR (1) KR0181596B1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20020066636A (en) * 2001-02-13 2002-08-21 엘지이노텍 주식회사 Communicating method between processor and processor in digital set top box

Also Published As

Publication number Publication date
KR19980030788A (en) 1998-07-25

Similar Documents

Publication Publication Date Title
KR960006506B1 (en) Computer system and system expansion unit and bus linkage unit and bus access arbitration method
US20080086578A1 (en) Integrated circuit device having send/receive macro for serial transfer bus
US5068785A (en) Bus control for small computer system interface with transfer indication preceding final word transfer and buffer empty indication preceding receipt acknowledgement
WO2012046634A1 (en) Electronic device and serial data communication method
JP4160068B2 (en) Digital programming interface between baseband processor and radio frequency integrated module
KR0181596B1 (en) Data transmission device of 12c bus
US5765019A (en) Microcomputer with built-in serial input-output circuit and collision detection circuit responsive to common input-output line being occupied
WO2017199759A1 (en) Communication apparatus, communication method, program, and communication system
KR20050046932A (en) System for checking state of slave devices using i2c bus
KR0184402B1 (en) Interrupt generating apparatus for i bus
CN112445744A (en) I2C communication
KR100217819B1 (en) Iic bus using control method
JPH10207834A (en) Serial input/output circuit
KR100209199B1 (en) I2c bus usage checking device and method thereof
EP0629954A1 (en) Adapter for transferring blocks of data having a variable length on a system bus
JP2702832B2 (en) Relief controller for low priority adapter
JP2000299694A (en) Data transfer system and transfer error detecting method
KR19980057209A (en) Interrupt Generator on the I²C Bus
JP2004046891A (en) Data processing system, data processor, external device, and data transmission method
KR100259585B1 (en) Dma controller
KR100209192B1 (en) Interrupt generating apparatus of i2c bus
KR960015586B1 (en) Asserting scheme of transfer failure interrupt in a multiprocessor interrupt requester
KR100962306B1 (en) Bidirectional data transmission apparatus and the method thereof for embedded system
JPH03156553A (en) Dma controller and information processing system
JPH1174893A (en) Data communication equipment and its communication method

Legal Events

Date Code Title Description
A201 Request for examination
E701 Decision to grant or registration of patent right
GRNT Written decision to grant
FPAY Annual fee payment

Payment date: 20121203

Year of fee payment: 15

LAPS Lapse due to unpaid annual fee