Datasheet
Section 14 Universal Serial Bus (USB)
Rev.7.00 Dec. 24, 2008 Page 515 of 698
REJ09B0074-0700
14.5.7 Bulk-Out Transfer (Dual FIFOs) (Endpoint 2)
EP2 has two 64-byte FIFOs, but the user can receive data and read receive data without being
aware of this dual-FIFO configuration.
When one FIFO is full after reception is completed, the UIFR1/EP2READY bit is set. After the
first receive operation into one of the FIFOs when both FIFOs are empty, the other FIFO is empty,
and so the next packet can be received immediately. When both FIFOs are full, NAK is returned to
the host automatically. When reading of the receive data is completed following data reception, 1
is written to the UTRG0/EP2RDFN bit. This operation empties the FIFO that has just been read,
and makes it ready to receive the next packet.
USB function Firmware
Receive OUT token
Receive data from host
Set EP2 data ready status
(EP2READY in UIFR1 = 1)
Clear EP2 data ready status
(EP2READY in UIFR1 = 0)
Read USB endpoint receive
data size register 2 (UESZ2)
Read data from USB endpoint
data register 2 (UEDR2)
Write 1 to EP2o read
complete bit
(EP2RDFN in UTRG0 = 1)
Space
in EP2 FIFO?
No
Yes
Both
EP2 FIFOs empty?
No
Yes
NAK
ACK
EXIRQx
EXIRQI
Figure 14.19 EP2 Bulk-Out Transfer Operation