DR
AFT
DR
AFT
DRAFT
DR
D
RAFT
DRAFT
DRA
FT DRAF
D
RAFT DRAFT DRAFT DRAFT DRAFT D
DRAFT
D
RAFT DRA
FT DRAFT DRAFT DRAFT DRA
UM10316_0
© NXP B.V. 2008. All rights reserved.
User manual
Rev. 00.06 — 17 December 2008
193 of 571
NXP Semiconductors
UM10316
Chapter 13: LPC29xx USB device
Internally, there is a hardware FIFO status flag called Buffer_Full. This flag is set by the
Validate Buffer command and cleared when the data has been sent on the USB bus and
the buffer is empty.
A control IN buffer cannot be validated when its corresponding OUT buffer has the Packet
Over-written (PO) bit (see the Clear Buffer Register) set or contains a pending SETUP
packet. For the control endpoint the validated buffer will be invalidated when a SETUP
packet is received.
See
Section 13–13 “Slave mode operation”
for a description of when this command is
used.
12. USB device controller initialization
The LPC29xx USB device controller initialization includes the following steps:
1. Enable the USB device block through the PMU, <tbd>.
2. Configure and enable the USB PLL in the CGU1, see
3. Enable the device controller clocks by setting DEV_CLK_EN and AHB_CLK_EN bits
in the USBClkCtrl register. Poll the respective clock bits in the USBClkSt register until
they are set.
4. Enable the USB pin functions by writing to the corresponding port configuration
register, see
5. Disable the pull-up resistor on the USB_V
BUS
pin using the corresponding port
configuration register, see
6. Set USBEpIn and USBMaxPSize registers for EP0 and EP1, and wait until the
EP_RLZED bit in USBDevIntSt is set so that EP0 and EP1 are realized.
7. Enable endpoint interrupts (Slave mode):
–
Clear all endpoint interrupts using USBEpIntClr.
–
Clear any device interrupts using USBDevIntClr.
–
Enable Slave mode for the desired endpoints by setting the corresponding bits in
USBEpIntEn.
–
Set the priority of each enabled interrupt using USBEpIntPri.
–
Configure the desired interrupt mode using the SIE Set Mode command.
–
Enable device interrupts using USBDevIntEn (normally DEV_STAT, EP_SLOW,
and possibly EP_FAST).
8. Configure the DMA (DMA mode):
–
Disable DMA operation for all endpoints using USBEpDMADis.
–
Clear any pending DMA requests using USBDMARClr.
–
Clear all DMA interrupts using USBEoTIntClr, USBNDDRIntClr, and
USBSysErrIntClr.
–
Prepare the UDCA in system memory.
–
Write the desired address for the UDCA to USBUDCAH (for example 0x7FD0
0000).
–
Enable the desired endpoints for DMA operation using USBEpDMAEn.