English
Language : 

EZ-USB Datasheet, PDF (72/334 Pages) Cypress Semiconductor – The EZ-USB USB Integrated Circuit
4.9 Receiving I2C Data
To read a multiple-byte data record, follow these steps:
1. Set the START bit.
2. Write the peripheral address and direction=1 (for read) to I2DAT.
3. Wait for DONE=1*. If BERR=1 or ACK=0, terminate by setting STOP=1.
4. Read I2DAT and discard the data. This initiates the first burst of nine SCL pulses
to clock in the first byte from the slave.
5. Wait for DONE=1*. If BERR=1, terminate by setting STOP=1.
6. Read the data from I2DAT. This initiates another read transfer.
7. Repeat steps 5 and 6 for each byte until ready to read the second-to-last byte.
8. Before reading the second-to-last I2DAT byte, set LASTRD=1.
9. Read the data from I2DAT. With LASTRD=1, this initiates the final byte read on
the I2C bus.
10. Wait for DONE=1*. If BERR=1, terminate by setting STOP=1.
11. Set STOP=1.
12. Read the last byte from I2DAT immediately (the next instruction) after setting the
STOP bit. This retrieves the last data byte without initiating an extra read transac-
tion (nine more SCL pulses) on the I2C bus.
* If the I2C interrupt (8051 INT3) is enabled, each “Wait for DONE=1” step can be inter-
rupt-driven, and handled by an interrupt service routing. See Section 9.12, "I2C Inter-
rupt” for more details regarding the I2C interrupt.
EZ-USB TRM v1.9
Chapter 4. EZ-USB CPU
Page 4-11