Slave and communicating method between a master and the same

A slave and a communicating method between a slave and a master that includes checking whether the command to be sent is one of a write command and a read-out command if the master attempts to send a command to the slave, determining whether a processing of a previous command sent by the master is entirely completed if the command to be sent is the write command, and sending an acknowledgement signal that allows a transfer of the command to the master if the processing of the previously sent command is determined as one of entirely completed and the command to be sent is determined as the read-out command. The master sends the command to the slave in response to the acknowledgement signal sent by the slave.

The present application claims priority under 35 U.S.C. §119 to Korean Patent Application No. 10-2008-0136377 (filed on Dec. 30, 2008), which is hereby incorporated by reference in its entirety.

BACKGROUND

Generally, through a serial bus communication protocol called I2C, a command delivery from a master provided to a host system to a slave loaded with a microcontroller unit is performed. In this case, the host system uses polling to check whether the slave has completed the processing of a previous command. If a command having been delivered to the slave from the master through I2C is still being processed, the slave makes a response in a manner of sending a non-acknowledgment signal (NAK) to the master. On the contrary, if the processing of the previous command is completed, the slave makes a response in a manner of sending an acknowledgement signal (ACK) to the master through the I2C. Therefore, the master is able to determine whether the processing for the previous command is completed by the slave using the ACK signal or the NAK signal.

The host waits until the I2C communication enters a normal state, i.e., until the ACK signal is sent from the slave. If the ACK signal is sent to the host from the slave by the I2C communication, the host is able to deliver a command to the slave. Accordingly, if the slave is processing a previous command, the slave sends NAK to the master unconditionally. However, even if a command the master attempts to send is not a write command but a read command, NAK is sent to the master. Hence, the master is unable to read data from the slave.

SUMMARY

Embodiments relate to a data communication, and more particularly, to a slave and communicating method between a master and the same. Although embodiments are suitable for a wide scope of applications, they are particularly suitable for the data communication including signals.

Embodiments relate to a slave and communicating method between a master and the same thereof by which the master is synchronized more efficiently and precisely to be accessible to the slave.

In accordance with embodiments, a slave which communicates with a master in accordance with a serial bus communication protocol can include at least one of the following: a central processing unit that generates an acknowledgement signal (ACK) for allowing a transfer of the command if the master attempts to send a command, the ACK being sent in accordance with a result of checking whether the command to be transmitted is a write command or a read-out command and a result of checking whether a processing of a previous command previously sent by the master is entirely completed and a storage unit storing a written or read-out data under control of the central processing unit, such that the master sends the command to the slave in response to the acknowledgement signal transferred from the slave.

In accordance with embodiments, a communicating method between a slave and a master which are able to communicate with each other in accordance with a serial bus communication protocol, can include at least one of the following: checking, if the master attempts to send a command to the slave, whether the command to be sent is a write command or a read-out command, determining, if the command to be sent is checked as the write command, whether a processing of a previous command previously sent by the master is entirely completed, and then sending, if the processing of the previously sent command is determined as entirely completed or the command to be sent is determined as the read-out command, an acknowledgement signal allowing a transfer of the command to the master such that the master sends the command to the slave in response to the acknowledgement signal sent by the slave.

DESCRIPTION

ExampleFIG. 1is a diagram for a schematic and connection relation between master10and slave20.

As illustrated in exampleFIG. 1, master10communicates with slave20in accordance with I2C communication protocol and can be included in a host system. A device including master10and slave20can be an image signal processor for example. Master10transfers such data as a command, a control signal and the like to slave20. Hence, slave20is enabled to write the data or master10is able to read out and bring the data stored in slave20.

ExampleFIG. 2is a block diagram of slave20illustrated in exampleFIG. 1in accordance with embodiments.

As illustrated in exampleFIG. 2, slave20A in accordance with embodiments can include central processing unit24and storage unit22. Central processing unit24is a device having a micro control unit (MCU). If master10attempts to send a command, central processing unit24checks whether the command is a write command or a read-out command. Central processing unit24checks whether the processing of a previous command given by master10has been completely performed. In accordance with the check results, central processing unit24generates an acknowledgement signal (ACK) indicating that master10is allowed to send a command to slave20and then sends the generated acknowledgement signal (ACK) to master10.

In accordance with embodiments, central processing unit24includes command type checking unit26, command completion checking unit28and responding unit30. Command type checking unit26checks whether a command master10attempts to send is a write command or a read-out command and then outputs the check result as a first check signal to command completion checking unit28and responding unit30. In response to the first check signal received from command type checking unit26, command completion checking unit28checks whether the processing of a previous command master10have sent to the slave is completely performed and then outputs the check result as a second check signal to responding unit30.

In response to at least one of the first and second check signals, responding unit30generates an ACK signal and then transfers it to master10via an output terminal OUT. Master10is able to send a command to slave2in response to the ACK signal transferred from slave20. Yet, responding unit30generates a non-acknowledgment (NAK) signal indicating that master10should not send a command to slave20yet in response to the first and second check signals and then sends the generated NAK signal to master10. Having received the NAK signal, master10holds a transfer of the command to send until an ACK signal is received from slave20.

Responding unit30of central processing unit24is able to send a flag type ACK or NAK signal to master10. For instance, assuming that this flag is defined as a NAK flag, if a command is received from master10in accordance with I2C or a stop signal described in the following description is input, responding unit20sets a level of a NAK plug to a logic level “high.” Thereafter, if an interruption of the I2C occurs, a firmware (F/W) executed in central processing unit24will enter an interrupt service routine (ISR). If the processing for an I2C command that should be currently handled is completely performed, the F/W sets a level of the NAK flag to a logic level “low.” In particular, if the level of the NAK flag is set to the logic level “low,” it means the generation of the ACK signal. Storage unit22is a type of buffer memory for storing the data written or read out under the control of central processing unit24.

In the following description, a method for slave20illustrated in exampleFIG. 2to communicate with master10is explained with reference to the accompanying drawings.

ExampleFIG. 3is a flowchart for a communicating method between slave20A and master10in accordance with embodiments.

As illustrated in exampleFIG. 3, if master10attempts to send a command, it is determined whether the command the master attempts to send to slave20A is a write command or a read-out command [S40]. Step S40can be performed by command type checking unit26illustrated in exampleFIG. 2.

ExampleFIG. 4is a diagram for a format of slave identification data in accordance with embodiments.

As illustrated in exampleFIG. 4, in order to perform step S40, command type checking unit26of slave20A receives slave identification information transferred from master10via input terminal IN and is then able to determine whether a command master10attempts to send is a write command or a read-out command. For instance, the slave identification information, as illustrated in exampleFIG. 4, includes unique identification data50and command type data52. Unique identification data50is the data uniquely given to each of slaves20illustrated in exampleFIG. 1to identify slaves20individually.

Master10transfers the slave identification information to all slaves20illustrated in exampleFIG. 1. In this case, each of the slaves receives the slave identification information transferred from master10and then checks whether the unique identification data included in the received identification information is identical to the unique identification data granted to itself. If they are identical to each other, the corresponding slave20can be aware of being selected by master10. Moreover, command type data52includes the data indicating whether the command master10attempts to send to slave20is the write command or the read-out command. For instance, if the command master10attempts to send is the write command, the command type data of 1 bit can be set to 1. If the command master10attempts to send is the read-out command, the command type data of 1 bit can be set to 0. Thus, slave20, which is aware of being selected by master10, is also able to recognize whether the command master10attempts to send currently is the write or read-out command through command type data52.

If it is determined that the command master10attempts to send is the write command, slave20A determines whether the processing of the command previously sent by master10is entirely completed [step S42]. In this case, step S42is performed by command completion checking unit28. In case of determining that the processing of the command previously sent by master10is entirely completed or determining that the command master10attempts to send is the read-out command, slave20A sends an ACK signal enabling master10to send the command to master10[step S44]. In this case, step S44can be performed by responding unit30illustrated in exampleFIG. 2. In particular, in case of confirming that the command master10currently attempts to send is the write command through the first check signal received from command type checking unit26, responding unit30recognizes whether the processing of the previous command is completed through the second check signal and is then able to perform step S44. Moreover, in case of confirming that the command master10currently attempts to send is the read-out command through the first check signal received from command type checking unit26, responding unit30sends an ACK signal to master10irrespective of the second check signal.

In this case, unlike a general slave, it can be observed that slave20A in accordance with embodiments sends the ACK signal to master10if the command master10attempts to send is the read-out command, despite that slave20A is still performing the processing of the previously send command. Yet, in case of determining that the command master10attempts to send is the write command and also determining that the processing of the previously sent command is in progress, i.e., the processing is not completed yet, slave20A sends a NAK signal for not allowing master10to send the command to master10via the output terminal OUT. Master10sends a command to slave20A in response to the ACK signal transferred from slave20A. If the NAK signal is received from slave20, master10can hold a command which is currently to be sent to slave20. Thereafter, when the processing of the command previously sent by slave20is entirely completed, if an ACK signal is sent to master10, master10sends a write command to slave20.

ExampleFIGS. 5A and 5Billustrate diagrams of the exchange of data between master10and slave20through I2C.

As illustrated in exampleFIG. 5A, master10sends a write command to slave20. Slave20then stores data. In exampleFIG. 5A, ‘devID’ indicates the slave identification information illustrated in exampleFIG. 4. In exampleFIG. 5B, master10sends a read-out command to slave20. Slave20then reads data.

As illustrated in exampleFIGS. 5A and 5B, if master10sends a start signal Start to slave20, slave20sends ACK signal (ACK)80,82for allowing a command to be sent to master10. Having received ACK signal (ACK)80,82, master10sends devID to slave20. In this case, slave20recognizes that it is selected by master10through the devID and also recognizes whether the command master10attempts to send is the write command or the read-out command through the devID. Slave20then sends ACK signal84,86to master10. Having received ACK signal84,86, master10sends a written or read-out address (Addr) to slave20. In this case, slave20sends ACK signal88,90for allowing master10to send the command to master10. Thereafter, slave20writes the data transferred from master10in storage unit22, as illustrated in exampleFIG. 5A, or reads out the data stored in storage unit22, as illustrated in exampleFIG. 5B.

Thus, each time the ACK signal is transferred from slave20, master10transfers the data to slave20or brings the data from slave20. In this case, if master10sends a stop signal, the write or read-out operation of slave20is stopped. In particular, portion62,72illustrated in exampleFIGS. 5A and 5Bindicates a signal transferred the slave20to master10, while portion60,70indicates the signal and data transferred from master10to slave20. Therefore, if the command previously sent by master10is still being processed, the general slave that generates ACK unconditionally irrespective of whether the command master10currently attempt to send is the write command or the read-out command.

On the contrary, if the command master10attempts to send is the read-out command, the slave20in accordance with embodiments is able to send the acknowledgement signal (ACK) to master10at the timing point of processing the command previously transferred from master10.

In a slave and communicating method between a master and the same in accordance with embodiments, when the master attempts to send a command via a serial bus such as I2C, even if the processing of a previous command is not completed, embodiments enable the master to read out data stored in the slave. Moreover, embodiments enable the command processing not to be overlapped in a manner of checking whether an acknowledgment signal (ACK) is sent or not. Therefore, embodiments considerably reduce unnecessary codes of a host system, thereby simplifying control codes of devices that use such a serial bus communication protocol as I2C.