ZHCSRH9E April 2009 – January 2023 TCA6408A
PRODUCTION DATA
Reading from a target is very similar to writing, but requires some additional steps. In order to read from a target, the controller must first instruct the target which register it wishes to read from. This is done by the controller starting off the transmission in a similar fashion as the write, by sending the address with the R/ W bit equal to 0 (signifying a write), followed by the register address it wishes to read from. Once the target acknowledges this register address, the controller will send a START condition again, followed by the target address with the R/ W bit set to 1 (signifying a read). This time, the target will acknowledge the read request, and the controller will release the SDA bus but will continue supplying the clock to the target. During this part of the transaction, the controller will become the controller-receiver, and the target will become the target-transmitter.
The controller will continue to send out the clock pulses, but will release the SDA line so that the target can transmit data. At the end of every byte of data, the controller will send an ACK to the target, letting the target know that it is ready for more data. Once the controller has received the number of bytes it is expecting, it will send a NACK, signaling to the target to halt communications and release the bus. The controller will follow this up with a STOP condition.
#SCPS133IMG6461 shows an example of reading a single byte from a target register.