UM10503
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2012. All rights reserved.
User manual
Rev. 1.3 — 6 July 2012
561 of 1269
NXP Semiconductors
UM10503
Chapter 23: LPC43xx USB0 Host/Device/OTG controller
In this case three packets are sent: Data2 (8 bytes), Data1 (7 bytes), Data0 (0 bytes).
Example 2
MULT = 3; Max_packet_size = 8; Total_bytes = 15; MultO = 2
In this case two packets are sent: Data1 (8 bytes), Data0 (7 bytes).
To optimize efficiency for IN transfers, software should compute MultO = greatest integer
of (Total_bytes/Max_packet_size). If Total_bytes = 0, then MultO should be 1.
23.10 Device operational model
The function of the device operation is to transfer a request in the memory image to and
from the Universal Serial Bus. Using a set of linked list transfer descriptors, pointed to by
a queue head, the device controller will perform the data transfers. The following sections
explain the use of the device controller from the device controller driver (DCD)
point-of-view and further describe how specific USB bus events relate to status changes
in the device controller programmer's interface.
23.10.1 Device controller initialization
After hardware reset, the device is disabled until the Run/Stop bit is set to a ‘1’. In the
Disabled state, the pull-up on the USB_DM is not active which prevents an attach event
from occurring. At a minimum, it is necessary to have the queue heads setup for endpoint
zero before the device attach occurs. Shortly after the device is enabled, a USB reset will
occur followed by a setup packet arriving at endpoint 0. A Queue head must be prepared
so that the device controller can store the incoming setup packet.
In order to initialize a device, the software should perform the following steps:
1. Set Controller Mode in the USBMODE register to device mode.
Remark:
Transitioning from host mode to device mode requires a device controller
reset before modifying USBMODE.
2. Allocate and Initialize device queue heads in system memory (see
Minimum: Initialize device queue heads 0 Tx & 0 Rx.
Remark:
All device queue heads associated with control endpoints must be initialized
before the control endpoint is enabled. Non-Control device queue heads must be
initialized before the endpoint is used and not necessarily before the endpoint is
enabled.
3. Configure ENDPOINTLISTADDR Pointer (see
).
4. Enable the microprocessor interrupt associated with the USB-HS core.
Recommended: enable all device interrupts including: USBINT, USBERRINT, Port
Change Detect, USB Reset Received, DCSuspend (see
5. Set Run/Stop bit to Run Mode.
After the Run bit is set, a device reset will occur. The DCD must monitor the reset
event and adjust the software state as described in the Bus Reset section of the Port
State and Control section (see
Remark:
Endpoint 0 is designed as a control endpoint only and does not need to be
configured using ENDPTCTRL0 register.