UM10208_2
© NXP B.V. 2007. All rights reserved.
User manual
Rev. 02 — 1 June 2007
210 of 362
NXP Semiconductors
UM10208
Chapter 17: LPC2800 USB Device
6.
Data flow
USB is a host controlled protocol, i.e., regardless of whether the data transfer is from the
host to the device or device to the host, it is always initiated by the host. During data
transfer from a device to the host, the host sends an IN token to the device, after which
the device responds with the data.
6.1 Data flow from the USB host to the device
The USB ATX receives the D+ and D- lines of the USB, and stores data from these lines in
the local buffer SRAM of the USB Controller. The local buffer is organized with a FIFO for
each endpoint.
For non-isochronous endpoints, when a full data packet is received without any errors, the
USB Controller generates a request for data transfer from its FIFO. For high-traffic
endpoints this is a request to the DMA Engine, while for low-traffic endpoints the request
is for a processor interrupt.
An Isochronous endpoint will have a packet of data to be transferred in every frame. So
the data transfer has to be synchronized to the USB frame rather than packet arrival.
6.2 Data flow from the device to the host
For endpoints using Slave mode transfer, the processor writes data directly into the local
buffer FIFO for the endpoint, via the register interface. For endpoints using DMA mode
transfer, the processor sets up the USB Controller so that it requests the DMA Engine to
transfer data into the local buffer FIFO whenever the buffer allows for it. When the host
sends an IN token for an endpoint, if the FIFO corresponding to the endpoint is empty, the
USB Controller returns a NAK, otherwise it sends data from the local buffer FIFO. For a
Slave mode transfer endpoint, this also triggers a processor interrupt.
6.3 Slave mode transfer
Slave data transfer is done via interrupts requested by the USB Controller to the CPU.
Upon receiving such an interrupt for an OUT (RX) endpoint, software should write the
Endpoint Index Register to select that endpoint, then read the Data Count Register to see
how many bytes are available, then read the Data Port register the appropriate number of
times to read the data. When there is no empty buffer for an OUT non-isochronous
endpoint that is handled by slave mode transfer, any data arrival generates an interrupt
only if the Interrupt on NAK feature for that endpoint type is enabled and the existing
interrupt is cleared. For OUT isochronous endpoints, the data will always be written
irrespective of the buffer status. No interrupts are requested for OUT isochronous
endpoints other than the frame interrupt.
Similarly, when a packet is successfully transferred to the host from any IN
non-isochronous endpoint buffer, an interrupt is generated. When there is no data
available in any of the buffers for a given IN non-isochronous endpoint, a data request
generates an interrupt only if the Interrupt on NAK feature for that endpoint type is
enabled and the existing interrupt is cleared. Upon receiving the interrupt, software can
load any data to be sent by writing the Data Count and Data Port registers. For IN
isochronous endpoints, the data available in the buffer will be sent only if the buffer has