Giving Acknowledge to a Slave Device
Upon reception of a byte from a slave, the master must acknowledge this to the slave device.
The master is in full control of the SDA and the SCL line.
After transmission of the last bit to the master (1) the slave will release the SDA line.
The SDA line should then go high (2). The Master will now pull the SDA line low (3) .
Next, the master will put a clock pulse on the SCL line (4). After completion of this clock pulse, the master will again release the SDA line (5).
The slave will now regain control of the SDA line (6).
Note: The above waveform is slightly exaggerated. You will not notice SDA going high in (2) and (5). A small spike might barely be visible.
Note: An Acknowledge of a byte received from a slave is always necessary, EXCEPT on the last byte received.
If the master wants to stop receiving data from the slave, it must be able to send a stop condition.
Since the slave regains control of the SDA line after the ACK cycle issued by the master, this could lead to problems.
Let's assume the next bit ready to be sent to the master is a 0. The SDA line would be pulled low by the slave immediately after the master takes the SCL line low. The master now attempts to generate a Stop condition on the bus. It releases the SCL line first and then tries to release the SDA line - which is held low by the slave. Conclusion: No Stop condition has been generated on the bus.
This condition is called a NACK : Not ACKnowledge . Do not confuse this with No ACKnowledge:
Condition | Can Only Occur... |
Not acknowledge (NACK) | After a master has read a byte from a slave |
No acknowledge | After a master has written a byte to a slave |