Preparing for Transfers
13-83
USB Function Module
13.5 Preparing for Transfers
To avoid NAK handshakes for the first transaction on an endpoint, the local
host must prepare the endpoint FIFO for receiving or transferring data. After
the first transaction, the FIFO is enabled during the interrupt handling.
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
Set_FIFO_En bit enables both FIFOs. Therefore, it is not possible to allow a
single transaction when double buffering is used.
The local host enters the Prepare for USB RX Transfers routine, shown in
Figure 13–12, after the enumeration phase and then properly reacts to end-
point interrupts. Whether double buffering is allowed or not is transparent to
the local host, unless both FIFOs are cleared through the Clr_EP or the
Reset_EP bits. In that case, and in the case where the local host finishes
handling an interrupt without having set the Set_FIFO_En bit, the local host
must reenter the Prepare for USB RX Transfers routine.
For transmit endpoints, the local host enters the Prepare for USB Transfer on
endpoint n routine each time a new file must be transmitted from endpoint n
to USB host. The local host must not enter this routine until data written into
TX FIFO from previous transfer has been received successfully by the USB
host (ACK interrupt received), unless TX FIFO is cleared through the Clr_EP
or the Reset_EP bits.
This does not apply to endpoint 0, which is not used before a setup interrupt
occurs. At setup interrupt, the local host reacts appropriately and enables the
EP0 FIFO only if necessary.