WO2013077012A1 - 通信装置、通信方法、及び通信システム - Google Patents

通信装置、通信方法、及び通信システム Download PDF

Info

Publication number
WO2013077012A1
WO2013077012A1 PCT/JP2012/063115 JP2012063115W WO2013077012A1 WO 2013077012 A1 WO2013077012 A1 WO 2013077012A1 JP 2012063115 W JP2012063115 W JP 2012063115W WO 2013077012 A1 WO2013077012 A1 WO 2013077012A1
Authority
WO
WIPO (PCT)
Prior art keywords
control unit
data
master device
timer
command
Prior art date
Application number
PCT/JP2012/063115
Other languages
English (en)
French (fr)
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 US14/352,110 priority Critical patent/US9671820B2/en
Priority to JP2013545808A priority patent/JP5762561B2/ja
Publication of WO2013077012A1 publication Critical patent/WO2013077012A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/04Generating or distributing clock signals or signals derived directly therefrom
    • G06F1/12Synchronisation of different clock signals provided by a plurality of clock generators
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers
    • 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
    • G06F13/4291Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus using a clocked protocol
    • 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
    • G06F13/4295Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus using an embedded synchronisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/28Timers or timing mechanisms used in protocols

Definitions

  • the present invention relates to a communication device, a communication method, and a communication system.
  • IIC Inter Integrated Circuit
  • SCL serial clock
  • SDA serial data
  • the plurality of devices connected to the IIC bus include a master device that can control other devices by controlling the SCL signal and the SDA signal, and a slave device controlled by the master device. Has a unique address.
  • a plurality of master devices and a plurality of slave devices can be connected to one IIC bus.
  • the master device operates as follows, for example.
  • the master device checks whether another device is accessing the IIC bus. Confirmation that there is no access can be made by detecting that the state of both the SCL signal line and the SDA signal line of the IIC bus is high.
  • the master device issues a start condition in IIC, sends information specifying the address and read / write direction of the other party to communicate with, and sends the information from the other slave device. If the response is received, next, the necessary data is transmitted to the partner slave device. This necessary data can be determined based on the protocol between the devices.
  • the master device at the end of communication, the master device generates a stop condition and sets the states of both the SCL signal line and the SDA signal line to high.
  • the master device can also be configured to transmit data to the slave device, and the slave device returns a response indicating whether or not the data has been received correctly to the master device.
  • the master device issues a start condition, transmits the address of the slave device and information specifying the write direction, and then transmits data.
  • the master device issues a start condition again to transmit information specifying a slave address and a read direction, and the slave device transmits a response indicating whether or not the data has been correctly received to the master device.
  • the master device can confirm that data can be reliably transmitted to the slave device (see, for example, Patent Document 1).
  • the slave device cannot normally receive a signal from the master device for some reason, or the state of either the SCL signal line or the SDA signal line is fixed to low, and the communication is disabled. You may fall.
  • a method has been proposed in which a slave device that has become incapable of communication is reset using a signal line different from the IIC bus (see, for example, Patent Document 2).
  • JP 2009-244991 paragraphs 0050-0051, FIG. 1
  • Japanese Patent Laid-Open No. 2008-197752 paragraphs 0206-0208, FIG. 1
  • the slave device since it is not preferable in the system that the IIC bus is occupied for a long period due to communication between a specific master device and a slave device, the slave device is separated by another signal line as in Patent Document 2. It is also possible to release the occupation of the IIC bus by resetting. However, when the slave device is reset by a signal through an external signal line, the reset slave device is restarted and the startup process is completed (may be a long period), IIC Since the communication error is caused and the operation of the communication system is stopped, there is a problem that the period during which other communication devices on the IIC bus cannot communicate may become long.
  • An object of the present invention is to provide a communication device, a communication method, and a communication system that can shorten the period of occupying a bus for synchronous serial communication including a clock signal line and a data signal line. To do.
  • a communication apparatus is a communication apparatus that operates in a master mode using a synchronous serial communication bus including a clock signal line for transmitting a clock signal and a data signal line for transmitting data.
  • a communication device that operates in a slave mode, receives a command transmitted from a master device, analyzes the command, and returns a result of the analysis to the master device using the bus, and the master device includes the slave device.
  • a timer that starts by starting communication with a communication device that operates in a mode, a timer threshold value storage unit that stores a predetermined threshold value, the clock signal from the master device is received through the clock signal line, and Control to stop the clock signal from the master device
  • a clock control unit to perform, a data control unit for transmitting and receiving data to and from the master device through the data signal line, a transmission temporary storage unit for temporarily storing data transmitted by the data control unit, and the master device
  • a command analysis unit for analyzing the transmitted command; and a control unit, wherein the control unit requests the command analysis unit to return the analysis result of the command analysis unit.
  • the master device controls the clock control unit so as to stop the clock signal during the period of analyzing the timer, compares the value of the timer with the threshold value stored in the timer threshold value storage unit, As a result, if the value of the timer is less than or equal to the threshold, the data to be transmitted is stored in the temporary storage unit for transmission.
  • the control for stopping the clock signal by the clock control unit is released, and the data control unit is stored in the temporary storage unit for transmission in synchronization with the clock signal received by the clock control unit.
  • Data is transmitted to the master device, and if the value of the timer exceeds the threshold value as a result of the comparison, control to stop the clock signal by the clock control unit is canceled and the clock control unit is A signal reception state is set, and the data control unit is set to a slave address indicating a communication device operating in a slave mode.
  • the communication method is a communication device that operates in a master mode using a synchronous serial communication bus including a clock signal line for transmitting a clock signal and a data signal line for transmitting data.
  • a communication method in a communication apparatus operating in a slave mode which receives a command transmitted from a master device, analyzes the command, and returns the result of the analysis to the master device using the bus, wherein the master device Starting a timer by starting communication with the communication device operating in the slave mode, and the clock control unit receives the clock signal from the master device through the clock signal line, or from the master device Control to stop the clock signal
  • the timer value is compared with a threshold value stored in advance in a timer threshold value storage unit, and if the result of the comparison is that the timer value is less than or equal to the threshold value, the data to be transmitted is Save to the temporary storage unit for transmission, cancel the control to stop the clock signal, and receive the In synchronization with the clock signal, the data stored in the temporary storage unit for transmission is transmitted to the master device.
  • the clock control unit The control for stopping the clock signal is released, the clock control unit is set to receive the clock signal, and the data control unit is set to receive a slave address indicating a communication device operating in the slave mode. It is characterized by.
  • the period of occupying the bus for the synchronous serial communication including the clock signal line and the data signal line can be shortened. There is an effect that the period during which other communication devices on the communication bus cannot communicate can be reduced.
  • FIG. 1 is a block diagram schematically showing a configuration of a communication device and a communication system according to Embodiment 1 of the present invention.
  • 3 is a diagram illustrating IIC communication between a master device and a slave device in the first embodiment.
  • FIG. (A)-(c) is a timing diagram which shows an example of the waveform in the IIC communication of FIG. 3 is a flowchart showing processing of a master device in the first embodiment.
  • 3 is a flowchart (part 1) illustrating processing of a slave device according to the first embodiment.
  • 6 is a flowchart (part 2) illustrating processing of the slave device according to the first embodiment. It is a flowchart which shows the content of the reception process routine of FIG.
  • FIG. 1 is a block diagram schematically showing a configuration of a communication apparatus and a communication system according to Embodiment 1 of the present invention.
  • the communication system includes a master device 10 as a communication device that operates in a master mode and a slave device 20 as a communication device that operates in a slave mode.
  • the master device 10 is a master device compliant with a synchronous serial communication standard (IIC standard in the present embodiment)
  • the slave device 20 is a synchronous serial communication standard (IIC standard in the present embodiment). It is a slave device conforming to.
  • the master device 10 and the slave device 20 have an SCL signal line (clock signal line in the synchronous serial communication standard) 30 that transmits an SCL signal that is an IIC clock signal, and an SDA signal that transmits an SDA signal that is an IIC data signal. And a line (data signal line in the synchronous serial communication standard) 31.
  • the master device 10 and the slave device 20 can communicate with each other by using the SCL signal line 30 and the SDA signal line 31. Since the SCL signal and the SDA signal are open collector signals, the SCL signal line 30 and the SDA signal line 31 are pulled up to the power supply voltage via the resistors 32 and 33, respectively.
  • the power supply voltage + 3.3V or + 5V is generally used, but another voltage may be used.
  • FIG. 1 shows a case where one master device 10 and one slave device 20 are connected to one IIC bus (consisting of an SCL signal line and an SDA signal line). A plurality of master devices and a plurality of slave devices can be connected to the bus.
  • the slave device 20 that is the communication apparatus illustrated in FIG. 1 is an apparatus that can implement the communication method according to the first embodiment.
  • the master device 10 includes an SCL control unit 101 as a clock control unit, an SDA control unit 102 as a data control unit, a transmission FIFO 103 as a transmission data temporary storage unit, and a reception data temporary unit.
  • Reception FIFO 104 as a storage unit
  • IIC control unit 105 as a transmission / reception control unit
  • timer 106 timer threshold storage unit 107
  • CPU central processing unit
  • ROM read-only memory
  • RAM random An access memory
  • the configuration including the CPU 110 and the IIC control unit 105 is also referred to as a “control unit” 120 of the master device 10.
  • the SCL control unit 101 performs high / low control of the SCL signal line (control to drive high or low) and reading the status of the SCL signal line 30 (whether it is high or low).
  • the SDA control unit 102 performs high / low control of the SDA signal (control to drive high or low) and reading the status of the SDA signal line 31 (whether it is high or low).
  • the transmission FIFO 103 When the transmission FIFO 103 transmits data from the SDA control unit 102, the transmission FIFO 103 temporarily stores the data.
  • the reception FIFO 104 temporarily stores data received by the SDA control unit 102.
  • the IIC control unit 105 controls the SCL control unit 101, the SDA control unit 102, the transmission FIFO 103, and the reception FIFO 104.
  • the IIC control unit 105 performs communication by controlling these when transmitting and receiving IIC.
  • the timer threshold value storage unit 107 stores a threshold value for comparison with the value of the timer 106.
  • the IIC control unit 105 controls the start, stop, and initialization of the timer 106, and refers to the threshold value stored in the timer threshold value storage unit 107.
  • the CPU 110 controls the master device 10.
  • the CPU 110 controls the operation of the master device 10 together with the ROM 111 that stores the program, the RAM 112 for executing the program, and the arithmetic processing unit 113 that performs arithmetic processing.
  • the CPU 110 executes a program recorded in the ROM 111 by using the RAM 112 and controls the IIC control unit 105 to write data to the IIC bus and read data from the IIC bus.
  • the arithmetic processing unit 113 performs, for example, graphics processing, encoding processing and decoding processing of a compressed video signal, and the like.
  • the slave device 20 includes an SCL control unit 201 as a clock control unit, an SDA control unit 202 as a data control unit, a transmission FIFO 203 as a transmission data temporary storage unit, and reception data.
  • Reception FIFO 204 as a temporary storage unit
  • IIC control unit 205 as a transmission / reception control unit
  • timer 206 timer threshold storage unit 207
  • CPU 210 ROM 211
  • RAM 212 arithmetic processing unit 213
  • command analysis unit 214 And a slave address storage unit 215.
  • a configuration including the CPU 210 and the IIC control unit 205 is also referred to as a “control unit” 220 of the slave device 20.
  • the SCL control unit 201 performs high / low control of the SCL signal line (control to drive high or low) and reading of the status of the SCL signal line 30 (whether it is high or low).
  • the SDA control unit 202 performs high / low control of the SDA signal (control to drive high or low) and reading the status of the SDA signal line 31 (whether it is high or low).
  • the transmission FIFO 203 When the transmission FIFO 203 transmits data from the SDA control unit 202, the transmission FIFO 203 temporarily stores the data.
  • the reception FIFO 204 temporarily stores data received by the SDA control unit 202.
  • the slave address storage unit 215 stores the address of the slave device 20 (referred to as “slave address”).
  • the SDA control unit 202 receives the slave address transmitted from the master device 10, the SDA control unit 202 determines whether or not the received slave address matches the slave address stored in the slave address storage unit 215.
  • the IIC control unit 205 controls the SCL control unit 201, the SDA control unit 202, the transmission FIFO 203, and the reception FIFO 204.
  • the IIC control unit 205 performs communication by controlling these when transmitting and receiving IIC.
  • the timer threshold value storage unit 207 stores a threshold value to be compared with the value of the timer 206 (a value corresponding to the elapsed time from the start of timer operation).
  • the IIC control unit 205 starts and stops the operation of the timer 206, initializes it, and refers to the threshold value stored in the timer threshold value storage unit 207.
  • the CPU 210 controls the slave device 20.
  • the CPU 210 controls the slave device 20 together with the ROM 211 storing the program, the RAM 212 for executing the program, and the arithmetic processing unit 213 that performs arithmetic processing.
  • the CPU 210 executes the program recorded in the ROM 211 by using the RAM 212 and controls the IIC control unit 205 to write data to the IIC bus and read data from the IIC bus.
  • the arithmetic processing unit 213 performs, for example, graphics processing, encoding processing and decoding processing of a compressed video signal, and the like.
  • the command analysis unit 214 analyzes a command transmitted from the master device 10 to the slave device 20, and, as a result of the analysis, OK data (data indicating that the command has been correctly interpreted) or NG data (command interpretation). (Data indicating failure to).
  • the master device 10 transmits a command composed of 3-byte data to the slave device 20 (that is, performs a write process by the master device 10), and the slave device 20 receives the command, interprets the command content, If the command can be correctly interpreted, OK data is returned. If the command interpretation fails, NG data is returned (that is, read processing by the master device 10 is performed).
  • FIG. 2 is a diagram showing a flow of IIC communication between the master device 10 and the slave device 20 in the first embodiment.
  • the master device 10 has an 8-bit value including 7 bits of the slave address of the slave device 20 and a bit indicating that write control is performed (also referred to as a “write control bit”). Data is transmitted to the slave device 20 (step S301).
  • the device when a device as a communication apparatus receives a slave address that matches its own address, the device returns an ACK (ACKnowledgement) signal to operate as a slave device (step S302).
  • the master device 10 transmits 8-bit data 1 (step S303), and if the slave device 20 can correctly receive the 8-bit data, it returns an ACK signal (step S304). Similarly, the master device 10 transmits data 2, receives an ACK signal from the slave device 20, further transmits data 3, and receives an ACK signal from the slave device 20 (steps S305 to S308). With the above processing, the command transmission for the write processing from the master device 10 to the slave device 20 is completed.
  • the master device 10 again reads the slave address 7 bits of the slave address 20 and the read control in order to perform a read process for confirming the response of the slave device 20 to the command transmitted in the previous write process.
  • 8-bit data including a bit indicating that the data is to be executed (also referred to as “read control bit”) is transmitted to the slave device (step S309).
  • Step S310 the slave device 20 returns an ACK signal (step S310), and further transmits OK data or NG data to the master device 10.
  • Step S311 This process is a read process in which the master device 10 reads the data of the slave device 20.
  • the slave device 20 returns OK data as “0x05” and NG data as “0xA0”.
  • the master device 10 receives “0x05” as OK data or “0xA0” as NG data, returns an ACK signal to the slave device 20, and ends the communication process (step S312).
  • FIGS. 3A to 3C are timing diagrams showing examples of waveforms in the IIC communication of FIG. 3A corresponds to steps S301 to S304 in FIG. 2
  • FIG. 3B corresponds to steps S305 to S308 in FIG. 2
  • FIG. 3C corresponds to steps S309 to S312 in FIG.
  • the initial state of IIC is a state in which both the SCL signal line 30 and the SDA signal line 31 are high (state 330 in FIG. 3A).
  • the SCL control unit 101 and the SDA control unit 102 check the states of the SCL signal line 30 and the SDA signal line 31, respectively, and access the IIC bus. Make sure there are no devices.
  • the SDA control unit 102 sets the SDA signal line 31 to low, and the SCL control unit 101 sets the SCL signal line 30 to low.
  • the IIC bus becomes a start condition (331 in FIG. 3A).
  • the SCL control unit 101 supplies a clock waveform by performing high / low control of the SCL signal line 30, and the SDA control unit 102 synchronizes with the control of the SCL signal line 30, and slaves of the communication partner device 7-bit data indicating the address is transmitted (332 in FIG. 3A).
  • the master device 10 transmits a write control bit (low signal, 333 in FIG. 3A).
  • the slave device 20 whose slave address matches returns an ACK signal when the SCL signal line 30 next becomes high (334 in FIG. 3A).
  • the ACK signal is a low signal.
  • the IIC signal is an open collector signal that has been pulled up, if there is no device (communication device) having a slave address that matches the slave address transmitted by the master device 10, both devices will drive the SDA signal line 31 low. So that the SDA signal line 31 goes high. If there is a device with an address that matches the slave address (eg, slave device 20), the device drives the SDA signal line 31 low, so the master device 10 confirms that the slave device 20 exists on the IIC bus. can do.
  • the slave device 20 transmits an ACK signal when the SDA control unit 202 receives the slave address from the master device 10 and the received slave address matches the slave address stored in the slave address storage unit 215. (Ie, the SDA signal line 31 is set to low), and if they do not match, nothing is transmitted (nothing is done to the SDA signal line 31).
  • the master device 10 transmits data 1 as a write process (341 in FIG. 3A), and the slave device 20 that has received the data 1 returns an ACK signal (342 in FIG. 3A). .
  • the master device 10 transmits data 2 (351 in FIG. 3B), the slave device 20 returns an ACK signal (352 in FIG. 3B), and the master device 10 transmits data 3 Then, the slave device 20 returns an ACK signal (362 in FIG. 3B).
  • the transmission of data from the master device 10 is completed, and the master device 10 once performs a read condition for receiving a reply of OK data or NG data from the slave device 20, and then once the start condition (“restart (Also referred to as “condition”) (371 in FIG. 3C).
  • the master device 10 again transmits 7-bit data indicating the slave address (381 in FIG. 3C), and the master device 10 transmits a read control bit (high signal, 382 in FIG. 3C). . Since the slave device 20 matches its own address, it returns a low signal as an ACK signal (383 in FIG. 3C).
  • the slave device 20 interprets the command including data 1, data 2, and data 3 transmitted from the master device 10 earlier.
  • OK data or NG data (“0x05” or “0xA0”) is returned to the master device 10 (391 in FIG. 3C).
  • the master device 10 receives OK or NG data and returns an ACK signal to the slave device 20 (392 in FIG. 3C).
  • the master device 10 sets the SDA signal line 31 to low and then sets both the SCL signal line 30 and the SDA signal line 31 to high to generate a stop condition (395 in FIG. 3C). IIC communication is terminated.
  • the SCL signal line 30 is normally controlled by the SCL control unit 101 of the master device 10, but when the slave device 20 is not ready for data transmission, the SCL control unit 201 of the slave device 20 connects the SCL signal line 30. Drive low. At this time, the SCL control unit 101 of the master device 10 can recognize that the high / low control of the SCL signal line 30 cannot be performed, and the master device 10 confirms that the slave device 20 is in a waiting state. Can be recognized. In FIG. 3C, in the wait state 390 portion, the slave device 20 may drive the SCL signal line 30 and enter a wait state.
  • the master device 10 transmits a command in the write process, issues a restart condition, and executes a series of IIC communication processes until the response to the command of the slave device 20 is confirmed instead of the read process.
  • the communication session becomes clear, an OK or NG data response of the slave device 20 to the command transmitted by the master device 10 can be surely returned.
  • the write process and the read process may be used independently.
  • the slave device 20 surely responds to the command transmitted by the master device 10
  • the write process and the read process are performed. Processing and read processing are combined.
  • FIG. 1 the CPU 110 of the master device 10 executes IIC communication processing based on a program recorded in the ROM 111.
  • FIG. 4 is a flowchart showing processing of the master device 10 in the first embodiment.
  • 5 and 6 are flowcharts showing processing of the slave device 20 according to the first embodiment. The processing when the CPU 210 performs the IIC communication processing based on the program recorded in the ROM 211 is shown in FIG. It is shown.
  • FIG. 7 is a flowchart showing the contents of the reception processing routine of FIG.
  • step S401 when the CPU 110 starts processing (step S401), it instructs the IIC control unit 105 to start the timer 106 based on the program in the ROM 111 (step S402).
  • step S402 the CPU 110 instructs the IIC control unit 105 to generate a start condition, and the IIC control unit 105 controls the SCL control unit 101 and the SDA control unit 102 to release the IIC bus. Is confirmed, and a start condition is generated (step S403).
  • the CPU 110 transmits a slave address to the IIC control unit 105 (step S404), and instructs the IIC control unit 105 to transmit a write control bit indicating that the master device 10 performs a write process.
  • Step S405 The IIC control unit 105 writes 8-bit data including a slave address and a write control bit in the transmission FIFO 103.
  • the SDA control unit 101 reads the data from the transmission FIFO 103 and controls the SDA signal line 31 in synchronization with the control of the SCL signal line 30 by the SCL control unit 101, thereby obtaining the slave address and the write control bit. Send.
  • the CPU 110 controls the IIC control unit 105 to check whether or not an ACK signal has been received (step S406). If no ACK signal has been received, a stop condition is generated (step S407). IIC communication is terminated (step S408).
  • the CPU 110 controls the IIC control unit 105 to check whether or not an ACK signal has been received (step S411). If no ACK signal has been received, a stop condition is generated (step S407). IIC communication is terminated (step S408).
  • the CPU 110 controls the IIC control unit 105 to check the timer 106 (step S412), and the value of the timer 106 is equal to or less than the threshold value stored in advance in the timer threshold value storage unit 107. It is confirmed whether or not (step S413). This threshold is long enough to complete IIC communication, and short enough not to adversely affect other users of the communication system when IIC communication does not end. Is desirable.
  • the CPU 110 controls the IIC control unit 105, and there is some problem in the communication of the IIC bus and the processing of the slave device 20, which affects the system.
  • the SCL control unit 101 and the SDA control unit 102 issue a stop condition (step S407), and the IIC communication is terminated (step S408).
  • the CPU 110 instructs the IIC control unit 115 to issue a start condition in order to perform read processing, and the IIC control unit 105 causes the SCL control unit 101 and the SDA control unit 102 to operate. Control is performed again to generate a start condition (also referred to as “restart condition”) (step S416).
  • the CPU 110 instructs the IIC control unit 105 to transmit a slave address (step S417) and to transmit a read control bit indicating that the master device 10 performs a read process (step S418).
  • the IIC control unit 105 writes 8-bit data including a slave address and a read control bit in the transmission FIFO 103.
  • the SDA control unit 101 reads the data from the transmission FIFO 103 and transmits the slave address and the read control bit by controlling the SDA signal line 31 in synchronization with the control of the SCL signal line 30 by the SCL control unit 101. To do.
  • the CPU 110 controls the IIC control unit 105 to check whether or not an ACK signal has been received (step S419). If no ACK signal has been received, the CPU 110 stops at the SCL control unit 101 and the SDA control unit 102. A condition is generated (step S420), and IIC communication is terminated (step S421). If an ACK signal is received in step S419, the CPU 110 controls the IIC control unit 105 to check the value of the timer 106 (step S422), and the value of the timer 106 is stored in the timer threshold value storage unit 107 in advance. It is confirmed whether it is below the stored threshold value (step S423).
  • the CPU 110 determines that there is some problem in the processing of the slave device 20 and affects the communication system, and controls the IIC control unit 105 to control the SCL control unit. 101 and the SDA control unit 102 issue a stop condition (step S420), and the IIC communication is terminated (step S421).
  • the CPU 110 controls the IIC control unit 105 to check whether data has been received (step S424).
  • the SCL control unit 101 performs clock control, and the SDA control unit 102 receives data in synchronization with high / low of the SCL signal line 30 and writes the data to the reception FIFO 104.
  • the CPU 110 controls the IIC control unit 105 to detect that data has been written in the reception FIFO 104.
  • the CPU 110 reads the data in the reception FIFO 104 via the IIC control unit 105.
  • the data of the reception FIFO 104 is “OK” data (“0x05”) indicating that the transmitted command is correctly interpreted by the slave device 20, or “NG” indicating that the command is not correctly interpreted. Data (“0xA0”). If data has not been received, CPU 110 returns the process to step S422 again.
  • the CPU 110 controls the IIC control unit 105, controls the SCL control unit 101 and the SDA control unit 102 to generate a stop condition (step S425), and ends the IIC communication (step S426).
  • FIG. FIG. 7 shows the contents of the reception processing routine (step S509) of FIG. Since the slave device 20 does not know when the access from the master device 10 is performed, the slave device 20 needs to be in a state where reception is always possible.
  • the CPU 210 of the slave device 20 stores the slave address of the slave device 20 in the slave address storage unit 215 in advance via the IIC control unit 205 and the SDA control unit 202.
  • the IIC communication is started when the SCL control unit 201 and the SDA control unit 202 receive a signal change from the master device 10 (change of the state of the SCL signal line 30 and the SDA signal line 31 to high or low) ( Step S501). Since the master device 10 sets the IIC bus to the start condition and the data transmitted first includes the slave address and the write control bit or the read control bit, the SDA control unit 202 detects the start condition (step S502). Then, the slave address is received (step S503). The IIC control unit 205 compares the received slave address with the slave address stored in the slave address storage unit 215, and determines whether or not they match (step S504). If they do not match, the IIC control unit 205 ends IIC communication (step S505).
  • the CPU 210 controls the IIC control unit 205 to return an ACK signal (step S506), and the timer 206 is started (step S507).
  • the timer 206 once sets the value to an initial value (after initialization), and then starts an operation (for example, an operation for increasing a value indicating elapsed time).
  • the CPU 210 controls the IIC control unit 205 to determine the write control bit or the read control bit transmitted together with the slave address (step S508).
  • the write control bit is set, the write process from the master device 10 to the slave device 20 is performed.
  • the read control bit is set, the master device 10 performs a process of reading data from the slave device 20. .
  • the CPU 210 controls the IIC control unit 205 and executes a reception process routine (step S509).
  • the CPU 210 controls the IIC control unit 205 to perform data reception (step S552), and confirms whether or not data has been correctly received (step S553). If the data has not been correctly received, the reception processing routine ends.
  • the data of the reception FIFO 204 is sequentially transferred to the RAM 212 by the CPU 210 via the IIC control unit 205. If the CPU 210 cannot read data from the reception FIFO 205 by other processing, the IIC control unit 205 The SCL control unit 201 is controlled so as to drive the SCL signal line 30 low, and the SCL control unit 101 of the master device 10 performs high / low control of the SCL signal line 30 (that is, the clock of the SCL signal line 30). Operation) can be stopped.
  • the IIC control unit 205 releases the low control of the SCL signal line 30 by the SCL control unit 201 and resumes the reception operation. .
  • the CPU 210 controls the IIC control unit 205 after the reception is correctly completed, and confirms whether the IIC bus is in a stop condition (step S557). If the reception is correctly completed and the IIC bus is in the stop condition, the CPU 210 sets a reception processing routine end flag (step S558). On the other hand, if the reception is not properly terminated and the IIC bus is not in the stop condition, the CPU 210 checks whether the IIC bus is in the restart condition (step S559). If the IIC bus is in the restart condition, the CPU 210 sets a reception processing routine end flag and ends the reception processing routine (step S560). If the IIC bus is not in the restart condition (step S559), the CPU 210 returns the process to step S552 in order to receive data.
  • the CPU 210 controls the IIC control unit 205 to execute the reception processing routine, and confirms whether the reception processing routine end flag is set in step S510 in FIG.
  • the CPU 210 controls the IIC control unit 205 to confirm again whether a restart condition has occurred in the IIC bus (step S511), and the IIC bus. If a stop condition has occurred instead of a restart condition, the process ends (step S513).
  • the CPU 210 controls the IIC control unit 205 to cause the command analysis unit 214 to start analyzing a command composed of the received data if a restart condition has occurred in the IIC bus (step S512). Then, the process returns to the slave address reception step (step S503).
  • the CPU 210 reads the data transmitted from the master device 10 stored in the reception FIFO 204 via the IIC control unit 205, and causes the command analysis unit 214 to execute command analysis of this data.
  • the command analysis unit 214 since N counted in the previous reception processing routine (step S509) is the number of received bytes, the command analysis unit 214 includes, for example, transmission bytes in the data transmitted from the master device 10 and received. By preparing a parameter for specifying the number and comparing the parameter with N, it is possible to determine whether there is a problem in the number of received data.
  • the command analysis is executed by the command analysis unit 214.
  • the processing of the command analysis unit 214 may take time due to, for example, the processing of the arithmetic processing unit 213 becoming heavy.
  • the CPU 210 confirms whether the reception processing routine end flag is set in step S510, and if not, checks the value of the timer 206 (step S514).
  • the CPU 210 controls the IIC control unit 205 to check whether the value of the timer 206 exceeds the threshold value stored in advance in the timer threshold value storage unit 207 (step S515). This threshold is long enough to complete IIC communication, and short enough not to adversely affect other users of the communication system when IIC communication does not end. Is desirable.
  • the CPU 210 determines that there is some problem in the write processing of the master device 10 and affects the system, and controls the IIC control unit 205 to receive the transmission FIFO 203 and the reception.
  • the FIFO 204 is cleared (step S516), the SCL control unit 201 and the SDA control unit 202 are changed to the initial state (step S517), and IIC communication is terminated (step S518).
  • the CPU 210 controls the IIC control unit 205 to clear the transmission FIFO 203 and the reception FIFO 204 (step S516), and stops the clock signal from the SCL control unit 201.
  • the control is canceled and the SCL control unit 201 is in a state of receiving a clock signal (a state in which clock reception is possible), and the SDA control unit 202 is in a state of receiving a slave address indicating a communication device operating in the slave mode (slave address). Is ready to receive). If the value of the timer 206 does not exceed the threshold value in step S514, the CPU 210 controls the IIC control unit 205, returns to step S510 again, confirms whether the reception processing routine end flag is set, and receives the signal. Check if the processing routine is finished.
  • step S512 the processing of the slave device 20 in response to the write processing from the master device 10 starts command analysis (step S512), a restart condition has occurred, and the process proceeds to step S503 again, or the timer 206 If the value exceeds the threshold value, the transmission FIFO 203 and the reception FIFO 204 are cleared (step S516), the SCL control unit 201 and the SDA control unit 202 are changed to the initial state (step S517), and the process ends (step S518). It is.
  • step S528 the slave device 20 does not know when the next start condition is transmitted from the master device 10, so the process starts from step S501 and confirms that the IIC bus is not in the start condition. To do.
  • the first embodiment shows an example in which a read process is performed in a restart condition after a write process of the master device in order for the slave device 20 to respond to a command transmitted by the master device 10.
  • the SCL control unit 201 and the SDA control unit 202 receive a signal from the master device 10 (change of the SCL signal line 30 and the SDA signal line 31 to high or low). Since the master device 10 includes the slave address 20 and the read control bit in the data to be transmitted after the IIC bus is set to the start condition or the restart condition, the SDA control unit 202 performs the start condition or the restart condition. Detection (step S502) and reception of the slave address (step S503). If the write process has already been performed, the restart condition is detected in step S559 or step S511 of the reception process routine, and thus the CPU 210 proceeds with the process from reception of the slave address (step S503).
  • the CPU 210 compares the received slave address with the slave address stored in the slave address storage unit 215 and determines whether or not they match (step S504). If not, the CPU 210 ends the communication process (step S505). If the slave addresses match, the CPU 210 controls the IIC control unit 205 to send back an ACK signal (step S506), and starts the timer 206 (step S507). Here, if the timer 206 has not started, it initializes and starts once. In this embodiment, since the read process is executed in the restart condition, it is after the write process has already been executed, and the timer 206 has already been started.
  • the CPU 210 determines whether the data transmitted together with the slave address is a write control bit or a read control bit (step S508).
  • the CPU 210 since the read control bit is set, the CPU 210 starts preparation for transmitting data to the master device 10, but performs the previous command analysis processing in the slave device until the analysis processing ends. Cannot determine whether OK or NG data should be transmitted. Therefore, first, the CPU 210 controls the IIC control unit 205 to drive the SCL signal line 30 low, thereby controlling the SCL signal line 30 controlled by the SCL control unit 101 of the master device 10 to be high or low. That is, the process of changing the IIC clock signal is stopped (step S520).
  • the CPU 210 confirms whether or not the command analysis is completed (step S521), and if not completed, returns the process to the step S520 again. If the command analysis has been completed, the CPU 210 determines whether OK or NG data should be transmitted, and then checks the value of the timer 206 (step S522). The CPU 210 confirms whether the value of the timer 206 is equal to or less than a threshold value stored in advance in the timer threshold value storage unit 207 (step S523). This threshold is long enough to complete IIC communication, and short enough not to adversely affect other users of the communication system when IIC communication does not end. Is desirable.
  • step S4108 If the value of the timer 206 exceeds the threshold value, it may have taken too much processing time for command analysis, and the master device 10 also confirms the time required for the read processing by the timer 106 (FIG. 4). In step S418), if the respective threshold values are the same, the master device 10 has terminated IIC communication. Therefore, when the value of the timer 206 exceeds the threshold value, the CPU 210 controls the IIC control unit 205 to clear the data in the transmission FIFO 203 and the reception FIFO 204 (step S524), and the SCL control unit 201 performs the SCL signal line. 30 is released (step S525), the SCL control unit 201 and the SDA control unit 202 are changed to the initial state (initialization) (step S526), and the process ends (step S527). ).
  • step S523 the CPU 210 controls the IIC control unit 205 to transmit the result of command analysis (OK or NG data) to the transmission FIFO 203 (step S528), and the load of the SCL control unit 201.
  • step S529 the SCL control unit 101 of the master device 10 controls the SCL signal line 30 to be high or low, so that the SCL control unit 201 of the slave device 20 changes the SCL signal line 30.
  • step S530 the data transmission from the slave device 20 to the master device is performed.
  • step S527 and S531 the slave device 20 does not know when the next start condition is transmitted from the master device 10, and thus starts the processing from step S501.
  • the slave device 20 returns an NG data response to the command transmitted from the master device 10
  • the master device 10 is configured to transmit the same command to the slave device 20 again. With this configuration, the command from the master device 10 can be reliably transmitted to the slave device 20.
  • the slave device 20 it is possible to immediately confirm whether or not the command transmitted from the master device 10 to the slave device 20 has been correctly analyzed by the slave device 20. Also, even if the master device 10 does not respond within the predetermined time because the response from the slave device 20 does not exceed the predetermined time, the slave device 20 cannot respond within the predetermined time. Since it can be recognized, the access to the IIC bus is released (in the first embodiment, the SCL signal line 30 is released from being driven low, and the SCL control unit 201 and the SDA control unit 202 are changed to the initial state. And the situation where the SCL signal line 30 or the SDA signal line 31 of the IIC bus is driven low can be avoided.
  • the SCL control unit 201, the SDA control unit 202, the transmission FIFO 203, and the reception FIFO 204 are initialized, so that all the processes executed by the slave device 20 are performed. Need not be reset, and other processes executed by the CPU 210 are not affected.
  • the master device 10 and the slave device 20 can finish only the processing related to IIC communication because the timer value exceeds the threshold value. Processing other than the IIC of the device can be continued without affecting the processing other than the IIC of the device.
  • the threshold stored in the timer threshold storage unit 107 of the master device 10 and the threshold stored in the timer threshold storage unit 207 of the slave device 20 be the same value. This is because by setting these threshold values to the same value, even if a malfunction occurs in either the master device 10 or the slave device 20, the timing for terminating IIC communication is the same based on the value of each timer. This is because the period during which the IIC is in a communication disabled state can be minimized.
  • FIG. 8 and 9 are flowcharts showing processing of the slave device in the second embodiment of the present invention. 8 and 9, the same steps as those shown in FIGS. 5 and 6 are denoted by the same reference numerals. In describing the second embodiment, FIG. 1 is also referred to.
  • step S521 in FIG. 6 after the command analysis processing of the slave device is completed (step S521 in FIG. 6), the value of the timer 206 is referred to.
  • step S540 in FIG. 9 it is confirmed whether or not the command analysis process is completed (step S540 in FIG. 9). With reference to this value, it is confirmed whether or not the value of the timer 206 exceeds the threshold value (step S541 in FIG. 9).
  • step S520 of FIG. 9 the CPU 210 controls the IIC control unit 205 to drive the SCL signal line 30 low to check whether the command analysis is completed (step S540), and the command analysis is completed. If not, the value of the timer 206 is confirmed (step S541). Next, if the value of the timer 206 does not exceed the threshold value, the CPU 210 returns the process to step S520, and if the value of the timer 206 exceeds the threshold value, the process proceeds to step S524. Further, if the command analysis is completed in step S540, CPU 210 advances the process to step S528.
  • the CPU 210 can detect a case where the value of the timer 206 exceeds the threshold before the command analysis is completed. For this reason, when the value of the timer 206 exceeds the threshold value, it is possible to cancel the command analysis processing that is no longer necessary and to reduce the processing load on the slave device 20.
  • the second embodiment is the same as the first embodiment.
  • Embodiment 3 FIG.
  • the slave device 20 when the processing of the slave device 20 is completed (after execution of Step S505, Step S512, Step S517, Step S525, and Step S529), the slave device 20 receives the next start condition from the master device 10. Since it is not known whether the data is transmitted, IIC communication processing is started (step S501).
  • the third embodiment is configured to start the IIC communication process (step S501) based on the completion of the process for receiving the command. In the description of the third embodiment, reference is made to FIG. 1, FIG. 5, and FIG.
  • step S501 If the processing of step S501 is started before the CPU 210 is ready to copy the data of the reception FIFO 204 to the RAM 212, the data is accumulated in the reception FIFO 204 by the command reception from the master device 10, and the IIC control unit 205 performs the SCL control.
  • the unit 201 By controlling the unit 201 to drive the SCL signal line 30 low, the high / low control of the SCL signal line 30 performed by the SCL control unit 101 of the master device 10 (that is, the clock operation of the SCL signal line 30) is stopped. it can.
  • other master devices cannot access the IIC bus, and the performance of the entire communication system including the IIC bus and the communication device connected thereto is degraded.
  • the CPU 210 controls the slave device 20 so as not to start the IIC reception process in a state where the slave device 20 cannot perform the reception process from the master device 10. Control is performed to start IIC reception processing when the processing for reception is completed.
  • the receiving process can be performed after the slave device can reliably receive the command from the master device, and the command from the master device can be received more reliably.
  • the third embodiment is the same as the first embodiment.
  • FIG. 10 and 11 are flowcharts showing the processing of the slave device according to the fourth embodiment of the present invention. 10 and 11, the same steps as those shown in FIGS. 5 and 6 are denoted by the same reference numerals. In the description of the fourth embodiment, FIG. 1 is also referred to.
  • the slave device 20 receives the data by the write control of the master device 10 and starts command analysis (step S512 in FIG. 5). Then, the read control of the master device 10 is started immediately, and the command An example of confirming the completion of the analysis (step S521 in FIG. 6) is shown.
  • the slave device 20 returns OK or NG data to the read control from the master device 10 based on the command analysis result. Neither NG data can be returned. Therefore, when the slave device has no write process from the master device 10 and suddenly executes the read process, neither OK nor NG data can be returned. In the fourth embodiment, the slave device can return NG data when there is no write processing from the master device 10 and the read processing is suddenly executed.
  • step S512 after starting command analysis (step S512), the CPU 210 sets the command transmission flag to “untransmitted” (step S580). Further, after data transmission (step S530), the CPU 210 sets the command transmission flag to “transmission” (step S582). The CPU 210 sets the command transmission flag when the slave device 20 is in the initial state (that is, default) to “transmission”.
  • the CPU 210 determines whether the received data is a write control bit or a read control bit (step S508), and after determining that the received data is a read control bit, the command transmission flag is “not transmitted” or “transmitted”. (Step S581). If the determination result is “not transmitted”, the IIC control unit 205 is controlled to drive the SCL signal line low (step S520), and the determination result is “transmit”. In this case, the IIC control unit 205 is controlled to drive the SCL 30 to a low level (step S583), transmit NG data to the transmission FIFO 203 (step S584), and thereafter perform the processing from step S529 onward in FIG. In step S582, the CPU 210 changes the command transmission flag to “transmission”.
  • the fourth embodiment is the same as the first embodiment.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Systems (AREA)
  • Bus Control (AREA)

Abstract

 コマンドを受信し、解析し、その結果をマスターデバイス(10)に返信する通信装置であるスレーブデバイス(20)であって、制御部を構成するIIC制御部(205)及びCPU(210)は、コマンド解析期間中、SCL信号を停止するように、SCL制御部(201)を制御し、タイマー(206)の値が閾値以下であれば、送信するデータを送信FIFO(203)に保存し、SCL信号を停止させる制御を解除し、SCL信号に同期して、SDA制御部(202)が送信FIFO(203)に保存されているデータを、マスターデバイス(10)に送信し、タイマー(206)の値が閾値を超えていれば、SCL信号を停止させる制御を解除してクロック制御部を前記クロック信号を受信する状態にし、また、SDA制御部(202)をスレーブモードで動作する通信装置を示すスレーブアドレスを受信する状態に設定する。

Description

通信装置、通信方法、及び通信システム
 本発明は、通信装置、通信方法、及び通信システムに関するものである。
 電子機器内におけるデバイス同士のデータ通信規格としてIIC(Inter Integrated Circuit)規格(フィリップス社が開発したシリアル通信規格)がある。IICでは、複数のデバイスは、SCL(シリアルクロック)信号用のSCL信号線とSDA(シリアルデータ)信号用のSDA信号線で接続されており、それぞれの信号線は、抵抗を介して電源によってプルアップされた双方向のオープンコレクタ信号線である。SCL信号線及びSDA信号線で構成されるバスを、「IICバス」と言い、IICバスを用いる通信規格を、「IICプロトコル」と言う。また、IICバスに接続されている複数のデバイスには、SCL信号とSDA信号を制御して他のデバイスを制御することができるマスターデバイスと、マスターデバイスによって制御されるスレーブデバイスとがあり、それぞれのデバイスは、固有のアドレスを有している。また、1つのIICバスには、複数のマスターデバイスと複数のスレーブデバイスとを接続することができる。
 IICにおいて、マスターデバイスは、例えば、以下のように動作する。通信を開始する場合、マスターデバイスは、他のデバイスがIICバスにアクセスしていないかを確認する。アクセスが無いことの確認は、IICバスのSCL信号線及びSDA信号線の両方の状態がハイ(high)であることを検出することによって、行うことができる。次に、マスターデバイスは、IICバスにいずれのデバイスもアクセスしていなければ、IICにおけるスタートコンディションを発行し、通信したい相手のアドレスとリード/ライト方向を指定する情報を送信し、相手のスレーブデバイスから応答を受信すれば、次に相手のスレーブデバイスに必要なデータを送信する。この必要なデータは、デバイス間のプロトコルに基づいて決めることができる。IICでは、通信終了時には、マスターデバイスは、ストップコンディションを生成して、SCL信号線及びSDA信号線の両方の状態をハイにする。
 また、IICでは、マスターデバイスが、スレーブデバイスにデータを送信し、スレーブデバイスが、データを正しく受け取ったかどうかの応答をマスターデバイスに返信するように構成することもできる。この場合、マスターデバイスは、スタートコンディションを発行し、スレーブデバイスのアドレスとライト(write)方向を指定する情報とを送信し、続いて、データを送信する。次に、マスターデバイスは、再度スタートコンディションを発行して、スレーブアドレスとリード(read)方向を指定する情報を送信し、スレーブデバイスは、そのデータを正しく受信できたかどうかの応答をマスターデバイスに送信する。IIC規格に準拠した通信システムをこのように構成することで、マスターデバイスは、スレーブデバイスにデータが確実に送信できていることを確認することができる(例えば、特許文献1参照)。
 また、IICでは、スレーブデバイスが何らかの理由でマスターデバイスからの信号を正常に受信できない、又は、SCL信号線及びSDA信号線のいずれかの状態をロー(low)に固定してしまい、通信不能状態に陥る場合がある。これに対し、IICバスとは別の信号線を用いて、通信不能状態になったスレーブデバイスをリセットするという方法が提案されている(例えば、特許文献2参照)。
特開2009-244991号公報(段落0050-0051、図1) 特開2008-197752号公報(段落0206-0208、図1)
 特許文献1の通信システムにおいては、スレーブデバイスがマスターデバイスにデータを送信する場合、その送信データの準備のために、マスターデバイスを待たせる方法として、スレーブデバイスが、SCL信号線をローにドライブする方法が提案されている。しかし、スレーブデバイスが、SCL信号線をローにドライブしてIICバスを占有している期間、すなわち、IICバス上の他の通信装置が通信できない状態にある期間が、例えば、負荷の高い処理をしているために、長くなることがあるという問題点がある。
 また、特定のマスターデバイスとスレーブデバイスとの間の通信により、長い期間、IICバスが占有されることは、システム上好ましくないことであるから、特許文献2のように、別の信号線によりスレーブデバイスをリセットすることでIICバスの占有を解除することも可能である。しかし、スレーブデバイスが外部からの信号線を通した信号によりリセットされると、そのリセットされたスレーブデバイスが再起動して、起動処理が完了するまでの期間(長い期間の場合がある)、IICの通信エラーが発生して通信システムの動作が停止するので、IICバス上の他の通信装置が通信できない状態にある期間が、長くなることがあるという問題点がある。
 そこで、本発明は、クロック信号線及びデータ信号線からなる同期式シリアル通信用のバスを占有している期間を短縮することができる通信装置、通信方法、及び通信システムを提供することを目的とする。
 本発明に係る通信装置は、クロック信号を伝送するためのクロック信号線及びデータを伝送するためのデータ信号線からなる同期式シリアル通信用のバスを用いて、マスターモードで動作する通信装置であるマスターデバイスから送信されるコマンドを受信し、該コマンドを解析し、前記バスを用いて、前記解析の結果を前記マスターデバイスに返信する、スレーブモードで動作する通信装置であって、前記マスターデバイスが、前記スレーブモードで動作する通信装置に通信を開始したことによりスタートするタイマーと、予め決められた閾値を保存するタイマー閾値記憶部と、前記マスターデバイスからの前記クロック信号を前記クロック信号線を通して受信し、及び、前記マスターデバイスからの前記クロック信号を停止させる制御を行うクロック制御部と、前記マスターデバイスに対し、前記データ信号線を通してデータの送受信を行うデータ制御部と、前記データ制御部によって送信されるデータを一時的に保存する送信用一時記憶部と前記マスターデバイスから送信されたコマンドを解析するコマンド解析部と、制御部とを有し、前記制御部は、前記マスターデバイスが前記コマンド解析部の解析結果を返信することを求めたときに、前記コマンド解析部がコマンドを解析している期間中、前記マスターデバイスが前記クロック信号を停止するように、前記クロック制御部を制御し、前記タイマーの値を前記タイマー閾値記憶部に記憶されている閾値と比較し、前記比較の結果、前記タイマーの値が前記閾値以下であれば、送信するデータを前記送信用一時記憶部に保存し、前記クロック制御部による前記クロック信号を停止させる制御を解除し、前記クロック制御部が受信する前記クロック信号に同期して、前記データ制御部が前記送信用一時記憶部に保存されているデータを、前記マスターデバイスに送信し、前記比較の結果、前記タイマーの値が前記閾値を超えていれば、前記クロック制御部による前記クロック信号を停止させる制御を解除して前記クロック制御部を前記クロック信号を受信する状態にし、また、前記データ制御部をスレーブモードで動作する通信装置を示すスレーブアドレスを受信する状態にすることを特徴とする。
 本発明に係る通信方法は、クロック信号を伝送するためのクロック信号線及びデータを伝送するためのデータ信号線からなる同期式シリアル通信用のバスを用いて、マスターモードで動作する通信装置であるマスターデバイスから送信されるコマンドを受信し、該コマンドを解析し、前記バスを用いて、前記解析の結果を前記マスターデバイスに返信する、スレーブモードで動作する通信装置における通信方法であって、前記マスターデバイスが、前記スレーブモードで動作する通信装置に通信を開始したことによりタイマーをスタートするステップと、クロック制御部が、前記マスターデバイスからの前記クロック信号を、前記クロック信号線を通して受信し、又は、前記マスターデバイスからの前記クロック信号を停止させる制御を行うステップと、データ制御部が、前記マスターデバイスに対し、前記データ信号線を通してデータの送受信を行うステップと、前記データ制御部によって送信されるデータを送信用一時記憶部に一時的に保存するステップと、前記マスターデバイスから送信されたコマンドを解析するステップとを有し、前記マスターデバイスが前記コマンドの解析結果を返信することを求めたときに、前記コマンドを解析している期間中、前記マスターデバイスが前記クロック信号を停止するように制御し、前記タイマーの値をタイマー閾値記憶部に予め記憶されている閾値と比較し、前記比較の結果、前記タイマーの値が前記閾値以下であれば、送信するデータを前記送信用一時記憶部に保存し、前記クロック信号を停止させる制御を解除し、前記受信するクロック信号に同期して、前記送信用一時記憶部に保存されているデータを、前記マスターデバイスに送信し、前記比較の結果、前記タイマーの値が前記閾値を超えていれば、前記クロック制御部による前記クロック信号を停止させる制御を解除して前記クロック制御部を前記クロック信号を受信する状態にし、また、前記データ制御部をスレーブモードで動作する通信装置を示すスレーブアドレスを受信する状態にすることを特徴とする。
 本発明に係る通信装置、通信方法、及び通信システムによれば、クロック信号線及びデータ信号線からなる同期式シリアル通信用のバスを占有している期間を短縮することができるので、同期式シリアル通信用のバス上の他の通信装置が通信できない状態にある期間を減らすことができるという効果がある。
本発明の実施の形態1に係る通信装置及び通信システムの構成を概略的に示すブロック図である。 実施の形態1におけるマスターデバイスとスレーブデバイスとの間のIIC通信を示す図である。 (a)~(c)は、図2のIIC通信における波形の一例を示すタイミング図である。 実施の形態1におけるマスターデバイスの処理を示すフローチャートである。 実施の形態1におけるスレーブデバイスの処理を示すフローチャート(その1)である。 実施の形態1におけるスレーブデバイスの処理を示すフローチャート(その2)である。 図5の受信処理ルーチンの内容を示すフローチャートである。 本発明の実施の形態2におけるスレーブデバイスの処理を示すフローチャート(その1)である。 実施の形態2におけるスレーブデバイスの処理を示すフローチャート(その2)である。 本発明の実施の形態4におけるスレーブデバイスの処理を示すフローチャート(その1)である。 実施の形態4におけるスレーブデバイスの処理を示すフローチャート(その2)である。
実施の形態1.
 図1は、本発明の実施の形態1に係る通信装置及び通信システムの構成を概略的に示すブロック図である。図1において、通信システムは、マスターモードで動作する通信装置としてのマスターデバイス10と、スレーブモードで動作する通信装置としてのスレーブデバイス20とを有する。マスターデバイス10は、同期式のシリアル通信規格(本実施の形態においては、IIC規格)に準拠したマスターデバイスであり、スレーブデバイス20は、同期式のシリアル通信規格(本実施の形態においては、IIC規格)に準拠したスレーブデバイスである。マスターデバイス10及びスレーブデバイス20は、IICのクロック信号であるSCL信号を伝送するSCL信号線(同期式のシリアル通信規格におけるクロック信号線)30と、IICのデータ信号であるSDA信号を伝送するSDA信号線(同期式のシリアル通信規格におけるデータ信号線)31とに接続されている。マスターデバイス10とスレーブデバイス20とは、SCL信号線30とSDA信号線31とを用いることによって互いに通信可能である。SCL信号及びSDA信号は、オープンコレクタ信号であるので、SCL信号線30及びSDA信号線31はそれぞれ、抵抗32,33を介して電源電圧にプルアップされている。電源電圧は、一般的に、+3.3V又は+5Vが使用されるが、他の電圧であってもよい。図1では、1つのIICバス(SCL信号線及びSDA信号線で構成される)に1台のマスターデバイス10と1台のスレーブデバイス20とが接続されている場合を示しているが、1つのIICバスには、複数のマスターデバイスと複数のスレーブデバイスとを接続することができる。なお、図1に示される通信装置であるスレーブデバイス20は、実施の形態1における通信方法を実施することができる装置である。
 次に、マスターデバイス10の構成を説明する。図1に示されるように、マスターデバイス10は、クロック制御部としてのSCL制御部101と、データ制御部としてのSDA制御部102と、送信用データ一時記憶部としての送信FIFO103と、受信用データ一時記憶部としての受信FIFO104と、送受信制御部としてのIIC制御部105と、タイマー106と、タイマー閾値記憶部107と、CPU(中央演算処理装置)110と、リードオンリーメモリ(ROM)111と、ランダムアクセスメモリ(RAM)112と、演算処理部113とを有する。なお、本出願において、CPU110とIIC制御部105とを含む構成を、マスターデバイス10の「制御部」120とも言う。
 SCL制御部101は、SCL信号線のハイ/ロー制御(ハイ又はローにドライブする制御)と、SCL信号線30の状況(ハイ又はローのいずれの状態か)の読み出しとを行う。SDA制御部102は、SDA信号のハイ/ロー制御(ハイ又はローにドライブする制御)と、SDA信号線31の状況(ハイ又はローのいずれの状態か)の読み出しとを行う。
 送信FIFO103は、SDA制御部102からデータを送信するときに、そのデータを一時的に保存する。受信FIFO104は、SDA制御部102で受信したデータを一時的に保存する。
 IIC制御部105は、SCL制御部101、SDA制御部102、送信FIFO103、及び受信FIFO104を制御する。IIC制御部105は、IICの送信及び受信を行うときに、これらを制御して通信を行う。また、タイマー閾値記憶部107は、タイマー106の値と比較するための閾値を記憶する。IIC制御部105は、タイマー106の開始、停止、初期化を制御し、及び、タイマー閾値記憶部107に記憶されている閾値を参照する。
 CPU110は、マスターデバイス10の制御を行う。CPU110は、プログラムを記憶したROM111と、プログラムを実行するためのRAM112、及び、演算処理を行う演算処理部113とともにマスターデバイス10の動作を制御する。CPU110は、ROM111に記録されたプログラムを、RAM112を用いて実行し、IIC制御部105を制御して、IICバスへのデータの書込みや、IICバスからのデータの読み出しを行う。演算処理部113は、例えば、グラフィックスの処理や圧縮された映像信号のエンコード処理及びデコード処理等を行う。
 次に、スレーブデバイス20の構成を説明する。図1に示されるように、スレーブデバイス20は、クロック制御部としてのSCL制御部201と、データ制御部としてのSDA制御部202と、送信用データ一時記憶部としての送信FIFO203と、受信用データ一時記憶部としての受信FIFO204と、送受信制御部としてのIIC制御部205と、タイマー206と、タイマー閾値記憶部207と、CPU210と、ROM211と、RAM212と、演算処理部213と、コマンド解析部214と、スレーブアドレス記憶部215とを有する。なお、本出願において、CPU210とIIC制御部205とを含む構成を、スレーブデバイス20の「制御部」220とも言う。
 SCL制御部201は、SCL信号線のハイ/ロー制御(ハイ又はローにドライブする制御)と、SCL信号線30の状況(ハイ又はローのいずれの状態か)の読み出しとを行う。SDA制御部202は、SDA信号のハイ/ロー制御(ハイ又はローにドライブする制御)と、SDA信号線31の状況(ハイ又はローのいずれの状態か)の読み出しとを行う。
 送信FIFO203は、SDA制御部202からデータを送信するときに、そのデータを一時的に保存する。受信FIFO204は、SDA制御部202で受信したデータを一時的に保存する。スレーブアドレス記憶部215は、スレーブデバイス20のアドレス(「スレーブアドレス」と言う)を記憶する。SDA制御部202は、マスターデバイス10から送信されたスレーブアドレスを受信したときに、受信したスレーブアドレスが、スレーブアドレス記憶部215に記憶されているスレーブアドレスと一致しているかどうかを判定する。
 IIC制御部205は、SCL制御部201、SDA制御部202、送信FIFO203、及び受信FIFO204を制御する。IIC制御部205は、IICの送信及び受信を行うときに、これらを制御して通信を行う。また、タイマー閾値記憶部207は、タイマー206の値(タイマーの動作開始からの経過時間に応じた値)と比較する閾値を記憶する。IIC制御部205は、タイマー206の動作の開始及び停止、初期化、並びに、タイマー閾値記憶部207に記憶されている閾値の参照を行う。
 CPU210は、スレーブデバイス20の制御を行う。CPU210は、プログラムを記憶したROM211と、プログラムを実行するためのRAM212、及び、演算処理を行う演算処理部213とともにスレーブデバイス20を制御する。CPU210は、ROM211に記録されたプログラムを、RAM212を用いて実行し、IIC制御部205を制御して、IICバスにデータの書込みや、IICバスからのデータの読み出しを行う。また、演算処理部213は、例えば、グラフィックスの処理や圧縮された映像信号のエンコード処理及びデコード処理等を行う。
 コマンド解析部214は、マスターデバイス10からスレーブデバイス20に送信されたコマンドを解析し、その解析の結果として、OKのデータ(コマンドを正しく解釈できたことを示すデータ)又はNGのデータ(コマンドの解釈に失敗したことを示すデータ)を返信する。
 次に、マスターデバイス10及びスレーブデバイス20の動作について説明する。例えば、マスターデバイス10は、スレーブデバイス20に、3バイトのデータからなるコマンドを送信し(すなわち、マスターデバイス10によるライト処理を行い)、スレーブデバイス20は、そのコマンドを受け取り、コマンド内容を解釈して、コマンドを正しく解釈できた場合には、OKのデータを、コマンドの解釈が失敗した場合には、NGのデータを返信する(すなわち、マスターデバイス10によるリード処理を行う)。
 図2は、実施の形態1におけるマスターデバイス10とスレーブデバイス20との間のIIC通信の流れを示す図である。まず、マスターデバイス10は、ライト(write)処理を行うために、スレーブデバイス20のスレーブアドレス7ビットと、ライト制御を行うことを示したビット(「ライト制御ビット」とも言う)とを含む8ビットのデータを、スレーブデバイス20に送信する(ステップS301)。IICプロトコルでは、通信装置としてのデバイスは、自身のアドレスに合致するスレーブアドレスを受信した場合に、スレーブデバイスとして動作するために、ACK(ACKnowledgement)信号を返信する(ステップS302)。
 次に、マスターデバイス10は、8ビットのデータ1を送信し(ステップS303)、スレーブデバイス20は、その8ビットのデータを正しく受信できれば、ACK信号を返信する(ステップS304)。同様に、マスターデバイス10は、データ2を送信し、スレーブデバイス20からACK信号を受信し、さらに、データ3を送信し、スレーブデバイス20からACK信号を受信する(ステップS305~S308)。以上の処理によって、マスターデバイス10からスレーブデバイス20へのライト処理についての、コマンド送信が完了する。
 次に、マスターデバイス10は、先のライト処理で送信したコマンドに対するスレーブデバイス20の応答を確認するためのリード(read)処理を行うために、再度、スレーブアドレス20のスレーブアドレス7ビットと、リード制御を行うことを示したビット(「リード制御ビット」とも言う)とを含む8ビットのデータをスレーブデバイスに送信する(ステップS309)。
 これに対して、スレーブデバイス20は、受信したアドレスが自身のアドレスに合致するため、ACK信号を返信し(ステップS310)、さらに、マスターデバイス10に対して、OKのデータ又はNGのデータを送信する(ステップS311)。この処理は、マスターデバイス10がスレーブデバイス20のデータを読み取るリード処理である。例えば、スレーブデバイス20は、OKのデータを“0x05”とし、NGのデータを、“0xA0”として返信する。マスターデバイス10は、OKのデータとしての“0x05”、又は、NGのデータとしての“0xA0”を受信して、スレーブデバイス20にACK信号を返して通信処理を終了する(ステップS312)。
 図3(a)~(c)は、図2のIIC通信における波形の一例を示すタイミング図である。図3(a)は、図2におけるステップS301~S304に対応し、図3(b)は、図2におけるステップS305~S308に対応し、図3(c)は、図2におけるステップS309~S312に対応する。図3(a)~(c)において、IICの初期状態は、SCL信号線30及びSDA信号線31の両方がハイ(high)の状態である(図3(a)の330の状態)。このときに、マスターデバイス10は、ライト処理を行うために、まず、SCL制御部101及びSDA制御部102が、SCL信号線30及びSDA信号線31の状態をそれぞれ確認して、IICバス上にアクセスしているデバイスがないことを確認する。
 次に、SDA制御部102は、SDA信号線31をロー(low)にし、SCL制御部101は、SCL信号線30をローにする。これにより、IICバスは、スタートコンディションとなる(図3(a)の331)。その後、SCL制御部101は、SCL信号線30のハイ/ロー制御を行うことによってクロック波形を供給し、SDA制御部102は、SCL信号線30の制御に同期して、通信相手のデバイスのスレーブアドレスを示す7ビットのデータを送信する(図3(a)の332)。さらに、マスターデバイス10は、ライト制御ビットを送信する(ロー信号、図3(a)の333)。スレーブアドレスが合致したスレーブデバイス20は、SCL信号線30が次にハイになるときに、ACK信号を返信する(図3(a)の334)。図3(a)の例では、ACK信号は、ロー信号である。
 IIC信号はプルアップされたオープンコレクタ信号であるため、マスターデバイス10が送信したスレーブアドレスに一致したスレーブアドレスを持つデバイス(通信装置)が存在しない場合には、いずれのデバイスもSDA信号線31をローにドライブしないため、SDA信号線31はハイとなる。スレーブアドレスに一致したアドレスのデバイス(例えば、スレーブデバイス20)があると、そのデバイスがSDA信号線31をローにドライブするので、マスターデバイス10は、スレーブデバイス20がIICバス上に存在することを確認することができる。また、スレーブデバイス20は、SDA制御部202がマスターデバイス10からのスレーブアドレスを受信して、受信したスレーブアドレスがスレーブアドレス記憶部215に記憶されているスレーブアドレスと一致する場合に、ACK信号を送信し(すなわち、SDA信号線31をローにし)、一致しない場合には、何も送信しない(SDA信号線31に対して何もしない)。
 次に、マスターデバイス10は、ライト処理としてデータ1の送信を行い(図3(a)の341)、データ1を受信したスレーブデバイス20は、ACK信号を返信する(図3(a)の342)。次に、マスターデバイス10は、データ2を送信し(図3(b)の351)、スレーブデバイス20は、ACK信号を返信し(図3(b)の352)、マスターデバイス10は、データ3を送信し(図3(b)の361)、スレーブデバイス20は、ACK信号を返信する(図3(b)の362)。ここで、マスターデバイス10からのデータの送信は終了し、マスターデバイス10は、スレーブデバイス20からのOKのデータ又はNGのデータの返信を受けるためのリード処理を行うために、一旦スタートコンディション(「リスタートコンディション」とも言う。)を生成する(図3(c)の371)。
 そして、マスターデバイス10は、再度、スレーブアドレスを示す7ビットのデータを送信し(図3(c)の381)、マスターデバイス10がリード制御ビット(ハイ信号、図3(c)の382)を送信する。スレーブデバイス20は、自身のアドレスに合致するので、ACK信号としてロー信号を返信する(図3(c)の383)。
 次に、IICバスが待ち状態(図3(c)の390)のときに、スレーブデバイス20は、先にマスターデバイス10から送信されたデータ1、データ2、データ3からなるコマンドを解釈して、OKのデータ又はNGのデータ(“0x05”又は“0xA0”)をマスターデバイス10に返信する(図3(c)の391)。マスターデバイス10は、OK又はNGのデータを受信して、スレーブデバイス20に対してACK信号の返信を行う(図3(c)の392)。
 次に、マスターデバイス10は、SDA信号線31を一旦ローにした後、SCL信号線30及びSDA信号線31の両方をハイにすることによって、ストップコンディションを生成し(図3(c)の395)、IIC通信を終了する。SCL信号線30は、通常は、マスターデバイス10のSCL制御部101によって制御されるが、スレーブデバイス20によるデータ送信の準備ができていないときには、スレーブデバイス20のSCL制御部201がSCL信号線30をローにドライブする。このとき、マスターデバイス10のSCL制御部101は、SCL信号線30のハイ/ロー制御を行うことができない状態になることを認識でき、マスターデバイス10は、スレーブデバイス20が待ち状態になっていることを、認識することができる。図3(c)においては、待ち状態390の部分で、スレーブデバイス20がSCL信号線30をドライブして待ち状態になることがある。
 また、上記のように、マスターデバイス10がライト処理でコマンドを送信し、リスタートコンディションを発行して、リード処理に変わってスレーブデバイス20のコマンドに対する応答を確認するところまで一連のIIC通信処理として実行でき、通信のセッションが明確になるため、マスターデバイス10が送信したコマンドに対するスレーブデバイス20のOK又はNGのデータの応答を確実に返信することができる。
 なお、IICプロトコルでは、ライト処理とリード処理をそれぞれ単独で使用してもよいが、実施の形態1では、マスターデバイス10が送信したコマンドに対して、確実にスレーブデバイス20が応答するために、ライト処理とリード処理を組み合わせている。
 次に、マスターデバイス10が行う一連のIIC通信の動作を、図1、図4、図5、図6及び図7を用いて説明する。図1において、マスターデバイス10のCPU110は、ROM111に記録されているプログラムに基づいて、IIC通信の処理を実行する。図4は、実施の形態1におけるマスターデバイス10の処理を示すフローチャートである。また、図5及び図6は、実施の形態1におけるスレーブデバイス20の処理を示すフローチャートであり、CPU210が、ROM211の記録されているプログラムに基づいて、上記IIC通信の処理を行う場合の処理が示されている。また、図7は、図5の受信処理ルーチンの内容を示すフローチャートである。
 図4に示されるように、まず、CPU110は、処理を開始すると(ステップS401)、ROM111のプログラムに基づいて、IIC制御部105に対して、タイマー106のスタートを指示する(ステップS402)。次に、CPU110は、IIC制御部105に対して、スタートコンディションを生成するように指示し、IIC制御部105は、SCL制御部101とSDA制御部102を制御して、IICバスが解放されていることを確認し、スタートコンディションを生成する(ステップS403)。
 次に、CPU110は、IIC制御部105に対して、スレーブアドレスを送信し(ステップS404)、マスターデバイス10がライト処理を行うことを示すライト制御ビットを送信するようにIIC制御部105に対して指示する(ステップS405)。IIC制御部105は、送信FIFO103に、スレーブアドレスとライト制御ビットとで構成される8ビットのデータを書き込む。そして、SDA制御部101は、送信FIFO103からデータを読み出し、SCL制御部101によるSCL信号線30の制御と同期して、SDA信号線31の制御を行うことで、スレーブアドレスとライト制御ビットとを送信する。
 次に、CPU110は、IIC制御部105を制御して、ACK信号を受信したかどうかを確認し(ステップS406)、ACK信号を受信していない場合は、ストップコンディションを生成して(ステップS407)、IIC通信を終了する(ステップS408)。ACK信号を受信している場合は、CPU110は、N=0として(ステップS409)、IIC制御部105にデータを書き込み、IIC制御部105は、送信FIFO103にデータを送信し、SDA制御部101は、送信FIFO103からデータを読み出して、SCL制御部101によるSCL信号線30の制御と同期して、データの送信を行う(ステップS410)。
 そして、CPU110は、IIC制御部105を制御して、ACK信号を受信したかどうかを確認し(ステップS411)、ACK信号を受信していない場合は、ストップコンディションを生成して(ステップS407)、IIC通信を終了する(ステップS408)。CPU110は、ACK信号を受信している場合は、IIC制御部105を制御して、タイマー106を確認し(ステップS412)、タイマー106の値がタイマー閾値記憶部107に予め記憶されている閾値以下かどうか確認する(ステップS413)。この閾値は、IIC通信を完了するためには十分に長い時間であって、かつ、IIC通信が終了しないことによって通信システムの他の利用者に悪影響を与えることがない程度に短い時間であることが望ましい。タイマー106の値がタイマー閾値記憶部107の閾値を超えているときには、CPU110は、IIC制御部105を制御して、IICバスの通信や、スレーブデバイス20の処理に何らかの問題があり、システムに影響を与えると判断して、SCL制御部101及びSDA制御部102に、ストップコンディションの発行を行わせ(ステップS407)、IIC通信を終了する(ステップS408)。
 次に、CPU110は、N=N+1(ステップS414)として、N>Mであるか否かの確認(ステップS415)を行い、N≦Mであれば、再度、ステップS410に処理を戻して、データの送信を行う。実施の形態1においては、M=3である。ステップS415でN>Mとなると、CPU110は、リード処理を行うために、IIC制御部115にスタートコンディションを発行するように指示し、IIC制御部105は、SCL制御部101及びSDA制御部102を制御して、再度、スタートコンディション(「リスタートコンディション」とも言う)を生成する(ステップS416)。
 そして、CPU110は、IIC制御部105に対してスレーブアドレスの送信(ステップS417)と、マスターデバイス10がリード処理を行うことを示すリード制御ビットを送信するように指示する(ステップS418)。IIC制御部105は、送信FIFO103にスレーブアドレスとリード制御ビットとで構成される8ビットのデータを書き込む。そして、SDA制御部101は、送信FIFO103からデータを読み出し、SCL制御部101によるSCL信号線30の制御と同期して、SDA信号線31の制御を行うことで、スレーブアドレスとリード制御ビットを送信する。
 次に、CPU110は、IIC制御部105を制御して、ACK信号を受信したかどうかを確認し(ステップS419)、ACK信号を受信していなければ、SCL制御部101及びSDA制御部102にストップコンディションを生成させ(ステップS420)、IIC通信を終了する(ステップS421)。ステップS419でACK信号を受信している場合は、CPU110は、IIC制御部105を制御して、タイマー106の値を確認し(ステップS422)、タイマー106の値が、タイマー閾値記憶部107に予め記憶されている閾値以下であるかどうかを確認する(ステップS423)。CPU110は、タイマー106の値が閾値を超えているときは、スレーブデバイス20の処理に何らかの問題があり、通信システムに影響を与えると判断して、IIC制御部105を制御して、SCL制御部101及びSDA制御部102にストップコンディションを発行させ(ステップS420)、IIC通信を終了する(ステップS421)。
 CPU110は、タイマー106の値が閾値を超えていなければ、IIC制御部105を制御して、データ受信したかを確認する(ステップS424)。データ受信に際しては、SCL制御部101がクロック制御を行い、SDA制御部102が、SCL信号線30のハイ/ローに同期して、データを受信して、受信FIFO104にデータを書き込む。CPU110は、IIC制御部105を制御して、受信FIFO104にデータが書き込まれたことを検知する。CPU110は、IIC制御部105を介して、受信FIFO104のデータを読み出す。この受信FIFO104のデータは、送信したコマンドが、スレーブデバイス20で、正しく解釈されたことを示す「OK」のデータ(“0x05”)か、又は、正しく解釈されなかったことを示す「NG」のデータ(“0xA0”)である。データを受信していなければ、CPU110は、再び、処理をステップS422に戻す。
 このデータを受信して、CPU110は、IIC制御部105を制御し、SCL制御部101とSDA制御部102を制御してストップコンディションを生成させ(ステップS425)、IIC通信を終了する(ステップS426)。
 次に、スレーブデバイス20の処理を、図5及び図6を用いて、CPU210が、ROM211に記録されているプログラムに基づいて、上記IIC通信を行う場合を説明する。また、なお、図7には、図5の受信処理ルーチン(ステップS509)の内容が示されている。スレーブデバイス20は、マスターデバイス10からのアクセスが、いつ行われるかわからないため、常時、受信できる状態である必要がある。また、スレーブデバイス20のCPU210は、IIC制御部205及びSDA制御部202を介して、スレーブアドレス記憶部215に、スレーブデバイス20のスレーブアドレスを予め記憶させている。
 IIC通信は、SCL制御部201及びSDA制御部202が、マスターデバイス10からの信号変化(SCL信号線30及びSDA信号線31の状態のハイ又はローへの変化)を受信することで、開始する(ステップS501)。マスターデバイス10がIICバスをスタートコンディションにして、最初に送信するデータは、スレーブアドレスと、ライト制御ビット又はリード制御ビットとを含んでいるため、SDA制御部202は、スタートコンディションを検出(ステップS502)して、スレーブアドレスを受信する(ステップS503)。IIC制御部205は、受信したスレーブアドレスを、スレーブアドレス記憶部215に記憶されているスレーブアドレスと比較して、これらが一致するかどうかを判定する(ステップS504)。IIC制御部205は、これらが一致しなければ、IIC通信を終了する(ステップS505)。
 受信したスレーブアドレスが、スレーブアドレス記憶部215に記憶されているスレーブアドレスと一致している場合には、CPU210は、IIC制御部205を制御して、ACK信号を返信し(ステップS506)、タイマー206をスタートする(ステップS507)。ここで、タイマー206は、一旦、値を初期値にしてから(初期化してから)、動作(例えば、経過時間を示す値を増加させる動作)を開始する。
 次に、CPU210は、IIC制御部205を制御して、スレーブアドレスとともに送信されてくるライト制御ビット又はリード制御ビットの判定を行う(ステップS508)。ここで、ライト制御ビットが設定されている場合、マスターデバイス10からスレーブデバイス20へのライト処理になり、リード制御ビットが設定されていれば、マスターデバイス10はスレーブデバイス20からデータをリードする処理を行う。
 CPU210は、ライト処理の場合、IIC制御部205を制御して、受信処理ルーチンを実行する(ステップS509)。受信処理ルーチンでは、図7のステップS550で処理を開始し、N=0とする(ステップS551)。次に、CPU210は、IIC制御部205を制御して、データ受信を行い(ステップS552)、正しくデータを受信できたかどうかを確認し(ステップS553)、正しく受信できていなければ、受信処理ルーチン終了フラグを立てる(ステップS554)。CPU210は、IIC制御部205を制御して、正しくデータを受信できていれば、ACK信号を返信し、データを受信FIFO204に送信し(ステップS555)、N=N+1とする(ステップS556)。図7において、Nは、受信したデータのバイト数に一致する。
 なお、受信FIFO204のデータは、CPU210がIIC制御部205を介して、RAM212に順次転送するが、CPU210が他の処理で、受信FIFO205からのデータ読み出しを行うことができない場合、IIC制御部205は、SCL制御部201に対して、SCL信号線30をローにドライブするように制御し、マスターデバイス10のSCL制御部101が行うSCL信号線30のハイ/ロー制御(すなわち、SCL信号線30のクロック動作)を止めることができる。IIC制御部205は、受信FIFO204のデータがCPU210によって、RAM212にコピーされ、受信FIFO204の容量に空きができたら、SCL制御部201によるSCL信号線30のロー制御を解除し、受信動作を再開する。
 次に、CPU210は、受信が正しく終了して、IIC制御部205を制御して、IICバスがストップコンディションになっているかを確認する(ステップS557)。CPU210は、受信が正しく終了して、IICバスがストップコンディションになっていれば、受信処理ルーチン終了フラグを立てる(ステップS558)。また、CPU210は、受信が正しく終了せず、IICバスがストップコンディションになっていなければ、IICバスが、リスタートコンディションになっているかを確認する(ステップS559)。CPU210は、IICバスが、リスタートコンディションになっていれば、受信処理ルーチン終了フラグを立てて、受信処理ルーチンを終了する(ステップS560)。CPU210は、IICバスが、リスタートコンディションになっていなければ(ステップS559)、データ受信を行うために、処理をステップS552に戻す。
 CPU210は、IIC制御部205を制御して、受信処理ルーチンを実行しながら、図5のステップS510で、受信処理ルーチン終了フラグが立ったかを確認する。ここで、受信処理ルーチン終了フラグが立っていれば、CPU210は、IIC制御部205を制御して、IICバスに、リスタートコンディションが発生していたかどうかを再度確認し(ステップS511)、IICバスに、リスタートコンディションではなく、ストップコンディションが発生していれば、処理を終了する(ステップS513)。また、CPU210は、IIC制御部205を制御して、IICバスに、リスタートコンディションが発生していれば、受信したデータで構成されるコマンドの解析をコマンド解析部214に開始させ(ステップS512)、処理をスレーブアドレスの受信のステップに戻す(ステップS503)。
 CPU210は、受信FIFO204に保存されたマスターデバイス10から送信されたデータをIIC制御部205を介して読み出し、コマンド解析部214にこのデータのコマンド解析を実行させる。コマンド解析において、先の受信処理ルーチン(ステップS509)でカウントされたNは、受信したバイト数であるから、コマンド解析部214は、例えば、マスターデバイス10から送信され受信したデータの中に、送信バイト数を指定するパラメータを用意して、そのパラメータと、Nを比較することで、受信したデータの数に問題がないかどうかの判断をすることができる。
 コマンド解析は、コマンド解析部214で実行されるが、スレーブデバイス20において、例えば、演算処理部213の処理が重くなることにより、コマンド解析部214の処理に時間がかかることがある。
 CPU210は、ステップS510で受信処理ルーチン終了フラグが立っているかを確認し、立っていなければ、タイマー206の値の確認を行う(ステップS514)。CPU210は、IIC制御部205を制御して、タイマー206の値がタイマー閾値記憶部207に予め記憶された閾値を超えていないか確認する(ステップS515)。この閾値は、IIC通信を完了するためには十分に長い時間であって、かつ、IIC通信が終了しないことによって通信システムの他の利用者に悪影響を与えることがない程度に短い時間であることが望ましい。
 CPU210は、タイマー206の値が閾値を超えているときは、マスターデバイス10のライト処理に何らかの問題があり、システムに影響を与えると判断して、IIC制御部205を制御して、送信FIFO203と受信FIFO204をクリアし(ステップS516)、SCL制御部201、SDA制御部202を初期状態に変更して(ステップS517)、IIC通信を終了する(ステップS518)。言い換えれば、タイマー206の値が閾値を超えていれば、CPU210は、IIC制御部205を制御して、送信FIFO203と受信FIFO204をクリアし(ステップS516)、SCL制御部201によるクロック信号を停止させる制御を解除してSCL制御部201をクロック信号を受信する状態(クロック受信可能な状態)にし、また、SDA制御部202をスレーブモードで動作する通信装置を示すスレーブアドレスを受信する状態(スレーブアドレスを受信可能な状態)にする。
 また、CPU210は、ステップS514で、タイマー206の値が閾値を越えていない場合は、IIC制御部205を制御して、再度ステップS510に戻り、受信処理ルーチン終了フラグが立ったかを確認し、受信処理ルーチンが終了したか確認する。
 以上のように、マスターデバイス10からのライト処理に対するスレーブデバイス20の処理は、コマンド解析を開始して(ステップS512)、リスタートコンディションが発生していて、再度ステップS503に移行するか、タイマー206の値が閾値を越えて送信FIFO203及び受信FIFO204をクリア(ステップS516)、SCL制御部201及びSDA制御部202を初期状態に変更して(ステップS517)、処理を終了する(ステップS518)かのいずれかである。
 この終了処理(ステップS518)を実行後、スレーブデバイス20では、いつマスターデバイス10から次のスタートコンディションが送信されるか分からないので、ステップS501から処理を開始し、IICバスがスタートコンディションにならないか確認する。
 次に、スレーブデバイス20が、マスターデバイス10からリード制御ビットが設定されたときの動作を説明する。なお、実施の形態1では、マスターデバイス10が送信したコマンドに対して、スレーブデバイス20が応答するために、マスターデバイスのライト処理後に、リスタートコンディションで、リード処理を行う例を示す。
 まず、SCL制御部201とSDA制御部202が、マスターデバイス10からの信号(SCL信号線30及びSDA信号線31のハイ又はローへの変化)を受信する。マスターデバイス10がIICバスをスタートコンディション、又は、リスタートコンディションにした後に送信するデータには、スレーブアドレス20と、リード制御ビットを含んでいるため、SDA制御部202は、スタートコンディション又はリスタートコンディションを検出(ステップS502)して、スレーブアドレスを受信する(ステップS503)。既にライト処理を実行している場合には、受信処理ルーチンのステップS559や、ステップS511でリスタートコンディションを検出しているので、CPU210は、スレーブアドレスの受信(ステップS503)から処理を進める。
 CPU210は、受信したスレーブアドレスと、スレーブアドレス記憶部215に記憶されているスレーブアドレスを比較して、一致するかどうか判定する(ステップS504)。もし一致しなければ、CPU210は、通信処理を終了する(ステップS505)。CPU210は、スレーブアドレスが一致している場合には、IIC制御部205を制御してACK信号を返信し(ステップS506)、タイマー206をスタートさせる(ステップS507)。ここで、タイマー206は、開始していなければ一旦初期化して開始する。本実施の形態ではリスタートコンディションで、リード処理が実行されているので、既にライト処理が実行された後であり、タイマー206は既にスタートしているので、ここでは改めてスタートしない。
 次に、CPU210は、スレーブアドレスとともに送信されているデータが、ライト制御ビットであるかリード制御ビットであるかの判定を行う(ステップS508)。ここで、リード制御ビットが設定されているので、CPU210は、マスターデバイス10にデータを送信するための準備を開始するが、スレーブデバイス内で先のコマンド解析処理を行い、その解析処理が終了するまでは、OK又はNGのデータのいずれを送信すべきか決定できない。そのため、まず、CPU210は、IIC制御部205を制御して、SCL信号線30をローにドライブすることで、マスターデバイス10のSCL制御部101が制御するSCL信号線30をハイ又はローにする制御、すなわち、IICのクロック信号を変化させる処理を止める(ステップS520)。
 次に、CPU210は、コマンド解析が完了したかどうかを確認し(ステップS521)、完了していなければ、処理を再びステップS520に戻す。CPU210は、コマンド解析が完了していれば、OK又はNGのデータいずれを送信すべきか決定し、次に、タイマー206の値の確認を行う(ステップS522)。CPU210は、タイマー206の値がタイマー閾値記憶部207に予め記憶された閾値以下かを確認する(ステップS523)。この閾値は、IIC通信を完了するためには十分に長い時間であって、かつ、IIC通信が終了しないことによって通信システムの他の利用者に悪影響を与えることがない程度に短い時間であることが望ましい。
 タイマー206の値が閾値を超えているときは、コマンド解析の処理時間がかかりすぎた可能性があり、マスターデバイス10も同様にタイマー106でリード処理に要した時間を確認しているので(図4のステップS418)、それぞれの閾値が同じであれば、マスターデバイス10がIIC通信を終了していることになる。よって、タイマー206の値が閾値を越えているときは、CPU210は、IIC制御部205を制御して、送信FIFO203、受信FIFO204のデータをクリアし(ステップS524)、SCL制御部201がSCL信号線30をローにドライブしている状態を解除し(ステップS525)、SCL制御部201、SDA制御部202を初期状態に変更(初期化)して、(ステップS526)、処理を終了する(ステップS527)。
 ステップS523で閾値を超えていなければ、CPU210は、IIC制御部205を制御して、送信FIFO203にコマンド解析の結果(OK又はNGのデータ)を送信し(ステップS528)、SCL制御部201のロードライブを解除する(ステップS529)と、マスターデバイス10のSCL制御部101がSCL信号線30をハイ又はローにする制御を行うことによって、スレーブデバイス20のSCL制御部201はSCL信号線30の変化を検出し、それに同期して、SDA制御部202が送信FIFO203のデータをSDA信号線31に送出することで、スレーブデバイス20からマスターデバイスへのデータ送信が行われる(ステップS530)。データ送信が完了することで、処理を終了する(ステップS531)。
 なお、この終了処理(ステップS527、S531)を実行後、スレーブデバイス20では、いつマスターデバイス10から次のスタートコンディションが送信されるか分からないので、ステップS501から処理を開始する。また、マスターデバイス10から送信されたコマンドに対して、スレーブデバイス20がNGのデータの応答を返した場合には、マスターデバイス10は、再度スレーブデバイス20に対して同じコマンドを送信するように構成する。このように構成することで、マスターデバイス10からのコマンドをスレーブデバイス20に確実に送信することができる。
 また、このように構成することで、マスターデバイス10からスレーブデバイス20に送信したコマンドが、スレーブデバイス20において正しく解析されたか否かをすぐに確認することができる。また、マスターデバイス10が、スレーブデバイス20からの応答が予め決められた時間以上ないためにIIC通信の処理を途中で終了しても、スレーブデバイス20でも、予め決められた時間以内に応答できなかったと認識できるため、IICバスへのアクセスを解除する(実施の形態1では、SCL信号線30をローにドライブすることを解除する、また、SCL制御部201及びSDA制御部202を初期状態に変更する)ことができ、IICバスのSCL信号線30又はSDA信号線31をローにドライブしたままになる状態を回避することができる。
 また、スレーブデバイス20の処理の過程で問題が発生した場合に、SCL制御部201、SDA制御部202、送信FIFO203、受信FIFO204を初期化しているため、スレーブデバイス20で実行している処理のすべてをリセットする必要がなく、CPU210で実行している他の処理に影響を与えることがない。
 また、マスターデバイス10での送信で問題が発生した場合においても、マスターデバイス10及びスレーブデバイス20のそれぞれが、タイマーの値が閾値を越えたことで、IIC通信に関する処理だけを終了できるので、マスターデバイス及びスレーブデバイスのIIC以外の処理に影響を与えることがなく、マスターデバイス及びスレーブデバイスのIIC以外の処理を継続することができる。
 また、マスターデバイス10のタイマー閾値記憶部107に保存されている閾値と、スレーブデバイス20のタイマー閾値記憶部207に保存されている閾値とを同じ値にすることが望ましい。これは、これらの閾値を同じ値にすることによって、マスターデバイス10、スレーブデバイス20のいずれかで不具合が発生しても、それぞれのタイマーの値に基づいてIIC通信を終了するタイミングが同じになるため、IICが通信不能状態となっている期間を最小限にすることができるからである。
実施の形態2.
 図8及び図9は、本発明の実施の形態2におけるスレーブデバイスの処理を示すフローチャートである。図8及び図9において、図5及び図6に示されるステップと同じステップには、同じ符号を付す。また、実施の形態2の説明に際しては、図1をも参照する。
 実施の形態1においては、スレーブデバイスのコマンド解析処理が完了してから(図6のステップS521)、タイマー206の値を参照している。これに対し、実施の形態2においては、図8及び図9に示されるように、コマンド解析処理が完了しているかどうかを確認し(図9のステップS540)、完了していなければ、タイマー206の値を参照して、タイマー206の値が閾値を越えたか否かを確認する(図9のステップS541)ように構成している。
 すなわち、図9のステップS520において、CPU210は、IIC制御部205を制御して、SCL信号線30をローにドライブし、コマンド解析が完了したかを確認し(ステップS540)、コマンド解析が完了していなければ、タイマー206の値の確認を行う(ステップS541)。次に、CPU210は、タイマー206の値が閾値を超えていなければ、処理をステップS520に戻し、タイマー206の値が閾値を超えていれば、処理をステップS524に進める。また、CPU210は、ステップS540において、コマンド解析が完了していれば、処理をステップS528に進める。
 このように構成することで、CPU210は、コマンド解析が完了する前に、タイマー206の値が閾値を超えてしまった場合を検出することができる。このため、タイマー206の値が閾値を超えてしまった場合、行う必要が無くなったコマンド解析処理をキャンセルすることができ、スレーブデバイス20の処理負荷を低減することができる。
 上記以外の点について、実施の形態2は、実施の形態1と同じである。
実施の形態3.
 実施の形態1においては、スレーブデバイス20の処理が終了したとき(ステップS505、ステップS512、ステップS517、ステップS525、ステップS529を実行後)、スレーブデバイス20では、いつマスターデバイス10から次のスタートコンディションが送信されるか分からないので、IIC通信処理を開始(ステップS501)している。これに対し、実施の形態3においては、コマンドを受信するための処理が完了したことに基づいて、IIC通信処理を開始(ステップS501)するように構成している。なお、実施の形態3の説明に際しては、図1、図5、図6を参照する。
 実施の形態3の処理を詳細に説明する。CPU210によって受信FIFO204のデータをRAM212にコピーする準備が整う前に、ステップS501の処理を開始すると、マスターデバイス10からのコマンド受信で、受信FIFO204にデータが溜まってしまい、IIC制御部205が、SCL制御部201を制御して、SCL信号線30をローにドライブさせ、マスターデバイス10のSCL制御部101が行うSCL信号線30のハイ/ロー制御(すなわち、SCL信号線30のクロック動作)を止めることができる。しかし、このとき、他のマスターデバイス(図示せず)は、IICバスにアクセスできなくなり、IICバスとそれに接続される通信装置からなる通信システム全体のパフォーマンスを落とすことになる。
 このため、実施の形態3においては、CPU210は、スレーブデバイス20において、マスターデバイス10からの受信処理を行うことができない状態では、IICの受信処理を開始しないように制御し、マスターデバイス10からのコマンドを受信するための処理が完了した状態になったときに、IICの受信処理を開始するように制御する。
 このように構成することで、スレーブデバイスがマスターデバイスからのコマンドを確実に受信できる状態になってから受信処理を行うことができ、より確実にマスターデバイスからのコマンドを受信することができる。
 上記以外の点について、実施の形態3は、実施の形態1と同じである。
実施の形態4.
 図10及び図11は、本発明の実施の形態4におけるスレーブデバイスの処理を示すフローチャートである。図10及び図11において、図5及び図6に示されるステップと同じステップには、同じ符号を付す。また、実施の形態4の説明に際しては、図1をも参照する。
 実施の形態1においては、スレーブデバイス20は、マスターデバイス10のライト制御でデータを受信し、コマンド解析を開始してから(図5のステップS512)、すぐにマスターデバイス10のリード制御が開始され、コマンド解析の完了を確認する(図6のステップS521)例を示した。
 しかし、実施の形態1では、スレーブデバイス20は、マスターデバイス10からのリード制御に対してはコマンド解析結果に基づいて、OK又はNGのデータを返信しているため、解析結果のない状態では、OK又はNGのデータのいずれも返信することができない。したがって、スレーブデバイスが、マスターデバイス10からのライト処理がなく、いきなりリード処理が実行したときには、OK又はNGのデータのいずれも返信することができない。実施の形態4においては、スレーブデバイスが、マスターデバイス10からのライト処理がなく、いきなりリード処理が実行したときには、NGのデータを返信できるようにしている。
 図10及び図11において、CPU210は、コマンド解析開始(ステップS512)の後、コマンド送信フラグを「未送信」に設定する(ステップS580)。また、CPU210は、データ送信(ステップS530)の後に、コマンド送信フラグを「送信」に設定する(ステップS582)。なお、CPU210は、スレーブデバイス20が最初の状態のとき(すなわち、デフォルト)のコマンド送信フラグを「送信」としておく。
 また、CPU210は、受信したデータがライト制御ビット又はリード制御ビットのいずれであるかの判定をし(ステップS508)、リード制御ビットと判定した後に、コマンド送信フラグが「未送信」か「送信」かの判定を行い(ステップS581)、判定結果が「未送信」の場合は、IIC制御部205を制御して、SCL信号線をローにドライブさせ(ステップS520)、判定結果が「送信」の場合は、IIC制御部205を制御して、SCL30をローにドライブし(ステップS583)、送信FIFO203にNGのデータを送信し(ステップS584)、以下、図11のステップS529以降の処理を行う。そして、CPU210は、ステップS582で、コマンド送信フラグを、「送信」に変更する。
 このように構成することで、マスターデバイス10からいきなりリード処理が実行されても、NGのデータの返信を行うことができ、IICのデータ通信誤動作を防止することができる。
 上記以外の点について、実施の形態4は、実施の形態1と同じである。
 10 マスターデバイス、 20 スレーブデバイス、 30 SCL信号線(クロック信号線)、 31 SDA信号線(データ信号線)、 32 SCL信号線用プルアップ抵抗、 33 SDA信号線用プルアップ抵抗、 101 SCL制御部(クロック制御部)、 102 SDA制御部(データ制御部)、 103 送信FIFO(送信用データ一時記憶部)、 104 受信FIFO(受信用データ一時記憶部)、 105 IIC制御部、 106 タイマー、 107 タイマー閾値記憶部、 110 CPU、 111 ROM、 112 RAM、 113 演算処理部、 120 制御部(CPU110及びIIC制御部105)、 201 SCL制御部(クロック制御部)、 202 SDA制御部(データ制御部)、 203 送信FIFO(送信用データ一時記憶部)、 204 受信FIFO(受信用データ一時記憶部)、 205 IIC制御部、 206 タイマー、 207 タイマー閾値記憶部、 210 CPU、 211 ROM、 212 RAM、 213 演算処理部、 214 コマンド解析部、 215 スレーブアドレス記憶部、 220 制御部(CPU210及びIIC制御部205)。

Claims (17)

  1.  クロック信号を伝送するためのクロック信号線及びデータを伝送するためのデータ信号線からなる同期式シリアル通信用のバスを用いて、マスターモードで動作する通信装置であるマスターデバイスから送信されるコマンドを受信し、該コマンドを解析し、前記バスを用いて、前記解析の結果を前記マスターデバイスに返信する、スレーブモードで動作する通信装置であって、
     前記マスターデバイスが、前記スレーブモードで動作する通信装置に通信を開始したことによりスタートするタイマーと、
     予め決められた閾値を保存するタイマー閾値記憶部と、
     前記マスターデバイスからの前記クロック信号を前記クロック信号線を通して受信し、及び、前記マスターデバイスからの前記クロック信号を停止させる制御を行うクロック制御部と、
     前記マスターデバイスに対し、前記データ信号線を通してデータの送受信を行うデータ制御部と、
     前記データ制御部によって送信されるデータを一時的に保存する送信用一時記憶部と
     前記マスターデバイスから送信されたコマンドを解析するコマンド解析部と、
     制御部と
     を有し、
     前記制御部は、
     前記マスターデバイスが前記コマンド解析部の解析結果を返信することを求めたときに、前記コマンド解析部がコマンドを解析している期間中、前記マスターデバイスが前記クロック信号を停止するように、前記クロック制御部を制御し、
     前記タイマーの値を前記タイマー閾値記憶部に記憶されている閾値と比較し、
     前記比較の結果、前記タイマーの値が前記閾値以下であれば、送信するデータを前記送信用一時記憶部に保存し、前記クロック制御部による前記クロック信号を停止させる制御を解除し、前記クロック制御部が受信する前記クロック信号に同期して、前記データ制御部が前記送信用一時記憶部に保存されているデータを、前記マスターデバイスに送信し、
     前記比較の結果、前記タイマーの値が前記閾値を超えていれば、前記クロック制御部による前記クロック信号を停止させる制御を解除して前記クロック制御部を前記クロック信号を受信する状態にし、また、前記データ制御部をスレーブモードで動作する通信装置を示すスレーブアドレスを受信する状態にする
     ことを特徴とする通信装置。
  2.  前記制御部は、前記コマンド解析部による前記コマンドの解析を完了した後に、前記タイマーの値を前記閾値と比較する前記処理を行うことを特徴とする請求項1に記載の通信装置。
  3.  前記制御部は、
     前記コマンド解析部による前記コマンドの解析の完了の前に、前記タイマーの値を前記閾値と比較する前記処理を開始し、
     前記比較の結果、前記タイマーの値が前記閾値を超えていれば、前記コマンド解析部により前記コマンドの解析は完了しているかいないかに関係なく、前記クロック制御部による前記クロック信号を停止させる制御を解除して前記クロック制御部を前記クロック信号を受信する状態にし、また、前記データ制御部をスレーブモードで動作する通信装置を示すスレーブアドレスを受信する状態にする
     ことを特徴とする請求項1に記載の通信装置。
  4.  前記マスターデバイスから送信されるデータを一時的に保存する受信用一時記憶部をさらに有し、
     前記マスターデバイスから送信されるデータを受信するときに、前記タイマーの値を前記タイマー閾値記憶部に記憶されている閾値と比較する処理を行い、前記タイマーの値が前記閾値を超えていれば、前記受信用一時記憶部のデータをクリアし、前記クロック制御部による前記クロック信号を停止させる制御を解除して前記クロック制御部を前記クロック信号を受信する状態にし、また、前記データ制御部をスレーブモードで動作する通信装置を示すスレーブアドレスを受信する状態にする
     ことを特徴とする請求項1から3までのいずれか1項に記載の通信装置。
  5.  前記制御部は、前記受信用一時記憶部からデータを読み出すことが可能な状態になってから、前記マスターデバイスからの受信処理を開始させることを特徴とする請求項4に記載の通信装置。
  6.  前記制御部は、
     前記コマンド解析部によるコマンドの解析を開始した後に、コマンド送信フラグを未送信を示すフラグに設定し、
     前記コマンド解析部によるコマンドの解析を完了し、前記マスターデバイスに前記解析の結果を送信した後に、前記コマンド送信フラグを送信済を示すフラグに設定し、
     前記マスターデバイスが前記コマンド解析部の解析結果を返信するように求めたときに、前記コマンド送信フラグに基づいて、返信するデータを決定する
     ことを特徴とする請求項1から5までのいずれか1項に記載の通信装置。
  7.  前記クロック信号線は、SCL信号線であり、
     前記データ信号線は、SDA信号線であり、
     前記同期式シリアル通信用のバスは、IICバスである
     ことを特徴とする請求項1から6までのいずれか1項に記載の通信装置。
  8.  クロック信号を伝送するためのクロック信号線及びデータを伝送するためのデータ信号線からなる同期式シリアル通信用のバスを用いて、マスターモードで動作する通信装置であるマスターデバイスから送信されるコマンドを受信し、該コマンドを解析し、前記バスを用いて、前記解析の結果を前記マスターデバイスに返信する、スレーブモードで動作する通信装置における通信方法であって、
     前記マスターデバイスが、前記スレーブモードで動作する通信装置に通信を開始したことによりタイマーをスタートするステップと、
     クロック制御部が、前記マスターデバイスからの前記クロック信号を、前記クロック信号線を通して受信し、又は、前記マスターデバイスからの前記クロック信号を停止させる制御を行うステップと、
     データ制御部が、前記マスターデバイスに対し、前記データ信号線を通してデータの送受信を行うステップと、
     前記データ制御部によって送信されるデータを送信用一時記憶部に一時的に保存するステップと、
     前記マスターデバイスから送信されたコマンドを解析するステップと
     を有し、
     前記マスターデバイスが前記コマンドの解析結果を返信することを求めたときに、前記コマンドを解析している期間中、前記マスターデバイスが前記クロック信号を停止するように制御し、
     前記タイマーの値をタイマー閾値記憶部に予め記憶されている閾値と比較し、
     前記比較の結果、前記タイマーの値が前記閾値以下であれば、送信するデータを前記送信用一時記憶部に保存し、前記クロック信号を停止させる制御を解除し、前記受信するクロック信号に同期して、前記送信用一時記憶部に保存されているデータを、前記マスターデバイスに送信し、
     前記比較の結果、前記タイマーの値が前記閾値を超えていれば、前記クロック制御部による前記クロック信号を停止させる制御を解除して前記クロック制御部を前記クロック信号を受信する状態にし、また、前記データ制御部をスレーブモードで動作する通信装置を示すスレーブアドレスを受信する状態にする
     ことを特徴とする通信方法。
  9.  前記コマンド解析部による前記コマンドの解析を完了した後に、前記タイマーの値を前記閾値と比較する前記処理を行うことを特徴とする請求項8に記載の通信方法。
  10.  前記コマンド解析部による前記コマンドの解析の完了の前に、前記タイマーの値を前記閾値と比較する前記処理を開始し、
     前記比較の結果、前記タイマーの値が前記閾値を超えていれば、前記コマンド解析部により前記コマンドの解析は完了しているかいないかに関係なく、前記クロック制御部による前記クロック信号を停止させる制御を解除して前記クロック制御部を前記クロック信号を受信する状態にし、また、前記データ制御部をスレーブモードで動作する通信装置を示すスレーブアドレスを受信する状態にする
     ことを特徴とする請求項8に記載の通信方法。
  11.  前記マスターデバイスから送信されるデータを一時的に保存する受信用一時記憶部をさらに有し、
     前記マスターデバイスから送信されるデータを受信するときに、前記タイマーの値を前記タイマー閾値記憶部に記憶されている閾値と比較する処理を行い、前記タイマーの値が前記閾値を超えていれば、前記受信用一時記憶部のデータをクリアし、前記クロック制御部による前記クロック信号を停止させる制御を解除して前記クロック制御部を前記クロック信号を受信する状態にし、また、前記データ制御部をスレーブモードで動作する通信装置を示すスレーブアドレスを受信する状態にする
     ことを特徴とする請求項8から10までのいずれか1項に記載の通信方法。
  12.  前記受信用一時記憶部からデータを読み出すことが可能な状態になってから、前記マスターデバイスからの受信処理を開始させることを特徴とする請求項11に記載の通信方法。
  13.  前記コマンドの解析を開始した後に、コマンド送信フラグを未送信を示すフラグに設定し、
     前記コマンドの解析を完了し、前記マスターデバイスに前記解析の結果を送信した後に、前記コマンド送信フラグを送信済を示すフラグに設定し、
     前記マスターデバイスが前記解析結果を返信するように求めたときに、前記コマンド送信フラグに基づいて、返信するデータを決定する
     ことを特徴とする請求項8から12までのいずれか1項に記載の通信方法。
  14.  前記クロック信号線は、SCL信号線であり、
     前記データ信号線は、SDA信号線であり、
     前記同期式シリアル通信用のバスは、IICバスである
     ことを特徴とする請求項8から13までのいずれか1項に記載の通信方法。
  15.  クロック信号を伝送するためのクロック信号線及びデータを伝送するためのデータ信号線からなる同期式シリアル通信用のバスを用いて、マスターモードで動作する通信装置であるマスターデバイスと、
     前記マスターデバイスから送信されるコマンドを受信し、該コマンドを解析し、前記バスを用いて、前記解析の結果を前記マスターデバイスに返信する、スレーブモードで動作する通信装置であるスレーブデバイスと
     を有し、
     前記スレーブデバイスは、請求項1から7までのいずれか1項に記載の通信装置である
     ことを特徴とする通信システム。
  16.  前記マスターデバイスは、
     前記スレーブモードで動作する通信装置に通信を開始したことによりスタートする第1のタイマーと、
     予め決められた第1の閾値を保存する第1のタイマー閾値記憶部と、
     前記クロック信号線を通して送信される前記クロック信号を制御する第1のクロック制御部と、
     前記データ信号線を通してデータの送受信を行う第1のデータ制御部と、
     前記第1のデータ制御部によって送信されるデータを一時的に保存する第1の送信用一時記憶部と、
     第1の制御部と
     を有し、
     前記マスターデバイスは、前記スレーブデバイスにデータの送信、又は、前記スレーブデバイスからのデータ受信を行うたびに、前記第1のタイマーの値を前記第1のタイマー閾値記憶部に記憶されている第1の閾値と比較し、前記第1のタイマーの値が前記第1の閾値を越えていれば、前記第1のクロック制御部と前記データ制御部を初期状態に変更する
     ことを特徴とする請求項15に記載の通信システム。
  17.  前記マスターデバイスの前記第1のタイマー閾値記憶部に記憶されている前記第1の閾値と、前記スレーブデバイスの前記タイマー閾値記憶部に記憶されている前記閾値とが、同じ値であること特徴とする請求項16に記載の通信システム。
PCT/JP2012/063115 2011-11-25 2012-05-23 通信装置、通信方法、及び通信システム WO2013077012A1 (ja)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US14/352,110 US9671820B2 (en) 2011-11-25 2012-05-23 Communication device, communication method, and communication system
JP2013545808A JP5762561B2 (ja) 2011-11-25 2012-05-23 通信装置、通信方法、及び通信システム

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2011257755 2011-11-25
JP2011-257755 2011-11-25

Publications (1)

Publication Number Publication Date
WO2013077012A1 true WO2013077012A1 (ja) 2013-05-30

Family

ID=48469474

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2012/063115 WO2013077012A1 (ja) 2011-11-25 2012-05-23 通信装置、通信方法、及び通信システム

Country Status (3)

Country Link
US (1) US9671820B2 (ja)
JP (1) JP5762561B2 (ja)
WO (1) WO2013077012A1 (ja)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2017194934A (ja) * 2016-04-22 2017-10-26 ソニーセミコンダクタソリューションズ株式会社 通信装置、通信方法、プログラム、および、通信システム

Families Citing this family (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103814363B (zh) * 2011-09-27 2016-08-24 三菱电机株式会社 从装置、主装置及通信方法
KR101861453B1 (ko) * 2013-10-09 2018-05-28 퀄컴 인코포레이티드 CCIe 버스를 통한 슬레이브 식별자 스캔 및 핫 플러그 능력
CN108011692A (zh) * 2017-06-30 2018-05-08 宁波方太厨具有限公司 一种用于单片机的数据通信方法
JP7082311B2 (ja) * 2017-11-08 2022-06-08 株式会社村田製作所 データ通信装置
JP7200370B2 (ja) 2018-12-03 2023-01-06 ヒューレット-パッカード デベロップメント カンパニー エル.ピー. 論理回路
KR20210087502A (ko) 2018-12-03 2021-07-12 휴렛-팩커드 디벨롭먼트 컴퍼니, 엘.피. 로직 회로
EP3904105A1 (en) 2018-12-03 2021-11-03 Hewlett-Packard Development Company, L.P. Logic circuitry
US11338586B2 (en) 2018-12-03 2022-05-24 Hewlett-Packard Development Company, L.P. Logic circuitry
US10894423B2 (en) 2018-12-03 2021-01-19 Hewlett-Packard Development Company, L.P. Logic circuitry
EP3695334A1 (en) 2018-12-03 2020-08-19 Hewlett Packard Enterprise Development Company LP Logic circuitry
PL3682359T3 (pl) 2018-12-03 2021-05-17 Hewlett-Packard Development Company, L.P. Obwód logiczny
CA3121146A1 (en) 2018-12-03 2020-06-11 Hewlett-Packard Development Company, L.P. Logic circuitry package for controlling ic2 traffic
EP3688645A1 (en) 2018-12-03 2020-08-05 Hewlett-Packard Development Company, L.P. Logic circuitry package
US11312145B2 (en) 2018-12-03 2022-04-26 Hewlett-Packard Development Company, L.P. Logic circuitry package
WO2020117304A1 (en) 2018-12-03 2020-06-11 Hewlett-Packard Development Company, L.P. Logic circuitry
WO2021080607A1 (en) 2019-10-25 2021-04-29 Hewlett-Packard Development Company, L.P. Logic circuitry package
CN113641618A (zh) * 2021-08-12 2021-11-12 海信(山东)空调有限公司 Iic通讯控制方法、用电设备和计算机可读存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001075878A (ja) * 1999-09-06 2001-03-23 Fujitsu General Ltd バスエラー検出処理装置
JP2008197752A (ja) * 2007-02-08 2008-08-28 Sharp Corp データ通信誤動作防止装置、電子機器、データ通信誤動作防止装置の制御方法、データ通信誤動作防止装置の制御プログラム、及び当該プログラムを記録した記録媒体
JP2011070282A (ja) * 2009-09-24 2011-04-07 Furukawa Electric Co Ltd:The 通信システム、マスタ装置、および、スレーブ装置

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2642734B2 (ja) 1989-03-17 1997-08-20 富士通株式会社 データ処理装置
US6799233B1 (en) 2001-06-29 2004-09-28 Koninklijke Philips Electronics N.V. Generalized I2C slave transmitter/receiver state machine
US7630304B2 (en) * 2003-06-12 2009-12-08 Hewlett-Packard Development Company, L.P. Method of overflow recovery of I2C packets on an I2C router
JP2007164765A (ja) 2005-11-15 2007-06-28 Matsushita Electric Ind Co Ltd Iicバス通信システム、スレーブ装置およびiicバス通信制御方法
US7802036B2 (en) * 2007-02-06 2010-09-21 Seiko Epson Corporation Serial communication system using an I2C bus as a serial bus
JP2008293230A (ja) 2007-05-24 2008-12-04 Nec Engineering Ltd データ転送装置
JP2009244991A (ja) 2008-03-28 2009-10-22 Fujitsu Ten Ltd データ通信方法、データ通信システム、電子制御ユニット、及び回路基板
JP5397614B2 (ja) * 2009-10-28 2014-01-22 横河電機株式会社 I2cバス制御回路

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001075878A (ja) * 1999-09-06 2001-03-23 Fujitsu General Ltd バスエラー検出処理装置
JP2008197752A (ja) * 2007-02-08 2008-08-28 Sharp Corp データ通信誤動作防止装置、電子機器、データ通信誤動作防止装置の制御方法、データ通信誤動作防止装置の制御プログラム、及び当該プログラムを記録した記録媒体
JP2011070282A (ja) * 2009-09-24 2011-04-07 Furukawa Electric Co Ltd:The 通信システム、マスタ装置、および、スレーブ装置

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2017194934A (ja) * 2016-04-22 2017-10-26 ソニーセミコンダクタソリューションズ株式会社 通信装置、通信方法、プログラム、および、通信システム

Also Published As

Publication number Publication date
US20140258576A1 (en) 2014-09-11
US9671820B2 (en) 2017-06-06
JPWO2013077012A1 (ja) 2015-04-27
JP5762561B2 (ja) 2015-08-12

Similar Documents

Publication Publication Date Title
JP5762561B2 (ja) 通信装置、通信方法、及び通信システム
JP2016004388A (ja) 通信システム及び電子回路
US10459872B2 (en) Data communication apparatus
US11010328B2 (en) Communication apparatus, communication method, program, and communication system
JP2014003377A (ja) 制御装置及び画像形成装置
KR102554978B1 (ko) 통신 장치, 통신 방법, 프로그램, 및, 통신 시스템
JP2008293230A (ja) データ転送装置
US20190146939A1 (en) Communication device, communication method, program, and communication system
JP6413724B2 (ja) データ通信装置
US20170091601A1 (en) Control device, image forming apparatus, and control method
CN109155689B (zh) 通信设备、通信方法、程序和通信系统
WO2017199762A1 (ja) 通信装置、通信方法、プログラム、および、通信システム
JP6136754B2 (ja) 通信制御装置及び画像形成装置
TW201741888A (zh) 通信器件、通信方法、程式及通信系統
US9869985B2 (en) Control device, image forming apparatus, and control method
US9075784B2 (en) Communication device, communication method and computer-readable recording medium
TWI834603B (zh) 通信裝置、通信方法、通信程式及通信系統
JP5913454B2 (ja) 制御装置、第1制御装置、第2制御装置、画像形成装置
JP6107499B2 (ja) 通信制御装置及び画像形成装置
JP2007072685A (ja) データ転送装置及び情報処理装置
JP2014197902A (ja) 制御装置、第1制御装置、第2制御装置、画像形成装置
JP2009199141A (ja) データ転送方法、データ転送プログラムおよびデータ転送プログラムを格納した記録媒体
JP2015026216A (ja) 制御装置及び画像形成装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 12851018

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2013545808

Country of ref document: JP

Kind code of ref document: A

WWE Wipo information: entry into national phase

Ref document number: 14352110

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 12851018

Country of ref document: EP

Kind code of ref document: A1