
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
UM10360_0
© NXP B.V. 2009. All rights reserved.
User manual
Rev. 00.06 — 5 June 2009
224 of 808
NXP Semiconductors
UM10360
Chapter 11: LPC17xx USB device controller
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 11–14 “Slave mode operation”
for a description of when this command is
used.
13. USB device controller initialization
The LPC17xx USB device controller initialization includes the following steps:
1. Enable the device controller by setting the PCUSB bit of PCONP.
2. Configure and enable the PLL and Clock Dividers to provide 48 MHz for usbclk and
the desired frequency for cclk. For correct operation of synchronization logic in the
device controller, the minimum cclk frequency is 18 MHz. For the procedure for
determining the PLL setting and configuration, 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 PINSEL register.
5. Disable the pull-ups and pull-downs on the V
BUS
pin using the corresponding
PINMODE register by putting the pin in the “pin has neither pull-up nor pull-down
resistor enabled” mode. See
Section 8–4 “Pin mode select register values”
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.