
UM10375
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2011. All rights reserved.
User manual
Rev. 3 — 14 June 2011
163 of 368
NXP Semiconductors
UM10375
Chapter 10: LPC13xx USB device controller
4. Select the system clock source by setting 0x01 (use system oscillator) in
SYSPLLCLKSEL register (see
).
5. Update the clock source by setting 1 in SYSPLLUEN register (see
) register,
and wait until clock source is updated.
6. Boost system PLL to 192 MHz and then divide by 4 (M=4, P=2) to obtain the 48 MHz
main clock. If the main clock is not 48 MHz then the USB PLL has to be used as USB
clock.
7. Enable the main system PLL by clearing bit 7 in PDAWAKECFG (see
wait until the PLL clock is locked.
8. If the USB PLL is used as the USB clock, do the following extra step:
Configure USB PLL identically to the System PLL and select system clock source by
setting 0x01 (use system oscillator) in USBPLLCLKSEL (see
) register.
9. Enable USB clock by clearing bit 8 in PDCTRL.
10. Set USB clock by setting USBCLKSEL (see
) to:
a. 0x0 if USB PLL is used.
b. 0x1 if main clock is used.
11. Update clock source by setting 1 in USBPLLUEN (see
) register and wait until
USB clock source is updated.
12. Set USB clock divider register (see
) to 1, meaning the USB clock is divided
by 1, as the input is 48 MHz already.
10.12.2 USB device controller initialization
1. Set bits 14 and 16 in the AHBCLKCTRL register (see
) to enable USB and
IOConfig blocks. The IOConfig is needed to configure IO pin multiplexing.
2. In the IOConfig block, set Port0[3] (see
) and Port0[6] (see
) to
USB VBUS and USB CONNECT respectively.
3. Clear any device interrupts using USBDevIntClr (
), then enable the desired
endpoints by setting the corresponding bits in USBDevIntEn (
4. Install the USB interrupt handler in the NVIC.
5. Set the default USB address to 0x0 and DEV_EN to 1 using the SIE Set Address
command.
6. Set CON bit to 1 to make CONNECT active using the SIE Set Device Status
command.
10.13 Functional description
10.13.1 Data flow from the Host to the Device
The USB ATX receives the bi-directional USB_DP and USB_DM lines of the USB bus. It
will put this data in the unidirectional interface between ATX and USB block.
The SIE protocol engine receives this serial data and converts it into a parallel data
stream. The parallel data is sent to the RAM interface which in turn will transfer the data to
the endpoint buffer. The endpoint buffer is implemented as an SRAM based FIFO. Data is
written to the buffers with the header showing how many bytes are valid in the buffer.