CHAPTER 29 USB FUNCTION
●
OUT direction (host PC → device) forwarding
Host PC
→
Device
Device
→
Host PC
DMAE
DRQIE
DRQ
SIZE
DER(Enx)
In both OUT and IN transfer directions, a USB device performs the following steps:
1. The total number of data to be transferred is set in the data counter register DDCT in DMA, and DMA is
enabled by setting the DER register.
2. DMAE and DRQIE are set
3. Once the transfer is complete, a DMA interrupt routine is entered to clear the necessary flag.
Note:
Each of EP1 to EP5 consists of the double buffer, they all can be read only when one buffer that is not
being accessed is empty and data is read from the other buffer. The DRQ status depends on the reading
of the buffers. This flag can not be cleared by the CPU as long as one buffer holds a data that must be
read (Dotted line status of DRQ on the figure 30-4.11). In such a case, the DRQ interrupt routine is
continously entered.
●
IN direction (host PC → device) forwarding
764
Figure 29.4-13 OUT Direction (Host PC → Device) Forwarding
OUT packet
OUT
DATA0
ACK
Last OUT packet
OUT DATA1
DRQ flag *
Automatic
clear
DATA0
Read PKS part of
DMA receive buffer
DRQ flag *
ACK
CPU clear
DATA1
Read the rest of
DMA receive buffer