You are here

How is the I2C bus arranged? Part 12

We already know that the bus in its idle state has high levels on the lines SDA and SCL. But how can slave-devices find out that the data transfer started and ended? To recognize the beginning and the end of transmission, the Start and the Stop conditions were introduced in the bus specification. In the original documentation the Start condition and the Stop condition have “S” and “P” abbreviations.

The Start condition.

The Stop condition.

The Start condition is formed at the falling edge of the signal on the SDA line at one state on the SCL line. And conversely, the Stop condition occurs at the positive edge on SDA line at one state on the SCL line. These conditions must always be generated by master-devices. Thus, the information packet transmitted via the 12C bus, looks as it is shown in picture below.

To determine the Start and the Stop conditions, hardware circuit as a part of a slave-device is typically provided. It is quite difficult to implement the interface of a slave-device programmatically - there is a necessity to constantly check the SDA line for data identification.

There is also a state of “Repeated Start”, which may occur in the middle of an information packet. We will consider the situation when there is a condition of “Repeated Start” a little later.

Data transfer via a bus is performed on 8 bits, and it is followed by acknowledge signal. Acknowledge signal indicates that the data is properly received and processed. Take a look at the picture below that reflects the byte transfer via the 12C bus.

The byte transfer via the I2C bus.

After the Start condition, transmitter consistently puts the data on the SDA line, starting with the most significant bit (MSB) and ending with the youngest one (LSB). This data is sampled on the SCL line.

Note: the SDA line of a slave-subscriber at the time of receiving the data bits (MSB-LSB) must be set in one state. Physically, this means that the transistor connected to the SDA line, should be closed. At the time of falling edge of pulse 8 on the SCL line, the slave-subscriber must set the zero level on the SDA line to open the transistor. Thus, the receiver confirms proper bytes reception. The transmitter (master-subscriber) must set one state on the SDA line. Due to the fact that the line is organized in the way of “dot and”, its status will be determined only by the slave-subscriber. The transmitter should check the state of the SDA line, then issue the ninth gate pulse with which slave-subscriber will set high level on the SDA line, check out this operation, and only then continue the transfer (Fig. 1.24). If normal reception is not confirmed (ACK signal has a high level), it is desirable for the transmitter to fulfill the Stop condition and repeat the transfer.