Prepare for USB
RX transfers
routine
Device is
ready to receive
data for
EPn ?
Write EP_NUM register:
- EP_NUM.EP_NUM = n
- EP_NUM.EP_DIR = 0
- EP_NUM.EP_SEL = 0
- EP_NUM.SETUP_SEL = 0
Set CTRL.
Set_FIFO_EN
Any OUT
endpoint
configured ?
(EPn)
Another
OUT endpoint
configured ?
(EPn)
Yes
End of prepare for
USB RX transfers
routine
Yes
Note: This applies to all non-
ISO endpoints, with or
without DMA.
No
No
Yes
This enables both
FIFOs if double-buffering
is used.
USB Device Controller
1615
SPNU503C – March 2018
Copyright © 2018, Texas Instruments Incorporated
Universal Serial Bus (USB)
For receive endpoints, this phase consists of enabling the FIFO to receive data from the USB host. If
double buffering is allowed for the endpoint, setting the CTRL.SET_FIFO_EN bit enables both FIFOs.
Therefore, it is not possible to allow a single transaction when double buffering is used.
The CPU enters the prepare for USB RX transfers routine, presented once after the enumeration phase,
and then properly reacts to EP interrupts. Whether double-buffering is allowed or not is transparent to the
CPU, unless both FIFOs are cleared through a CTRL.CLR_EP or CTRL.RESET_EP. In that case, and in
the case where the CPU finishes to handle an interrupt without having set the CTRL.SET_FIFO_EN bit,
the CPU must reenter the prepare for USB RX transfers routine.
For transmit endpoints, the CPU enters the prepare for endpoint n TX transfer routine, presented each
time a new file must be transmitted from endpoint n to USB host. The CPU must not enter this routine until
data written into TX FIFO from the previous transfer have all been received successfully by the USB host
(ACK interrupt received), unless TX FIFO is cleared through the CTRL.CLR_EP or CTRL.RESET_EP bits
(see
and
).
NOTE:
This does not apply to endpoint 0, which is not used before a setup interrupt occurs. At setup
interrupt, the CPU reacts appropriately, and enables EP0 FIFO only if necessary.
To ensure proper usage of the module, you cannot prepare data on different endpoints at the
same time. You can enter a routine once the routine is not being used by another endpoint
(no parallelism); the EP_NUM register can be accessed via different routines.
Figure 29-60. Prepare for USB RX Transfers Routine