Comment on Wire.read()
reference: "slave may send less than requested" is misleading
#893
Labels
Wire.read()
reference: "slave may send less than requested" is misleading
#893
In the documentation of Wire.read() is this example:
The comment "slave may send less than requested" is misleading.
Some might think that they have to wait for the rest of the bytes to arrive. Some might think that the Slave can decide to send less bytes, even when there was no bus error.
It is however inherit to the I2C protocol that the Slave can not send less or more than requested. If the Slave stops sending data, then the SDA will stay high and the Master will read 0xFF. The Master will continue to read all the bytes and does not know that the 0xFF is not valid data from the Slave. When reading data from a Slave, the Master provides the SCL clock signal, the ACK between the data bytes and the STOP at the end. The Slave has no way to influence that.
The text was updated successfully, but these errors were encountered: