The LPC17xx is an ARM Cortex-M3 based microcontroller for embedded applications
requiring a high level of integration and low power dissipation. The ARM Cortex-M3 is a
next generation core that offers system enhancements such as modernized debug
features and a higher level of support block integration.
High speed versions (LPC1769 and LPC1759) operate at up to a 120 MHz CPU
frequency. Other versions operate at up to an 100 MHz CPU frequency. The ARM
Cortex-M3 CPU incorporates a 3-stage pipeline and uses a Ha rvard architecture with
separate local instruction and data buses as well as a third bus for peripherals. The ARM
Cortex-M3 CPU also includes an internal prefetch unit that supports speculative
branches.
The peripheral complement of the LPC17xx includes up to 512 kB of flash memory, up to
64 kB of data memory, Ethernet MAC, a USB interface that can be configured as either
Host, Device, or OTG, 8 channel general purpose DMA controller, 4 UARTs, 2 CAN
channels, 2 SSP controllers, SPI interface, 3 I
interface, 8 channel 12-bit ADC, 10-bit DAC, motor control PWM, Quadrature Encoder
interface, 4 general purpose timers, 6-output ge neral purpose PWM, ultra-low power RTC
with separate battery supply, and up to 70 general purpose I/O pins.
Refer to Section 1.4.1 for details of features on specific part numbers.
• ARM Cortex-M3 processor, running at frequencies of up to 120 MHz on high speed
• ARM Cortex-M3 built-in Nested Vectored Interrupt Controller (NVIC).
• Up to 512 kB on-chip flash program memory with In-System Programming (ISP) and
• Up to 64 kB on-chip SRAM includes:
• Eight channel General Purpose DMA controller (GPDMA) on the AHB multilayer
• Multilayer AHB matrix interconnect provides a separate bus for each AHB master.
• Split APB bus allows for higher throughput with fewer stalls between the CPU and
• Serial interfaces:
UM10360
Chapter 1: LPC17xx Introductory information
versions (LPC1769 and LPC1759), up to 100 MHz on other versions. A Memory
Protection Unit (MPU) supporting eight regions is included.
In-Application Programming (IAP) capabilities. The combination of an enhanced flash
memory accelerator and location of the flash memory on the CPU local code/data bus
provides high code performance from flash.
– Up to 32 kB of SRAM on the CPU with local code/data bus for high-performance
CPU access.
– Up to two 16 kB SRAM blocks with separate access paths for higher throughput.
These SRAM blocks may be used for Ethernet, USB, and DMA memory, as well as
for general purpose instruction and data storage.
matrix that can be used with the SSP, I
Digital-to-Analog converter peripherals, timer match signals, GPIO, and for
memory-to-memory transfers.
AHB masters include the CPU, General Purpose DMA controller, Ethernet MAC, and
the USB interface. This interconnect provides communication with no arbitration
delays unless two masters attempt to access the same slave at the same time.
DMA. A single level of write buffering allows the CPU to continue without waiting for
completion of APB writes if the APB was not already busy.
– Ethernet MAC with RMII interface and dedicated DMA controller.
– USB 2.0 full-speed controller that can be configured for either device, Host, or
OTG operation with an on-chip PHY for device and Ho st functions and a dedicated
DMA controller.
– Four UARTs with fractional baud rate generation, internal FIFO, IrDA, and DMA
support. One UART has modem control I/O and RS-485/EIA-485 support.
– Two-channel CAN controller.
– Two SSP controllers with FIFO and multi-protocol capabilities. The SSP interfaces
can be used with the GPDMA controller.
– SPI controller with synchronous, serial, full duplex communication and
programmable data length. SPI is included as a legacy peripheral and can be used
instead of SSP0.
2
– Three enhanced I
2
full I
C specification and Fast mode plus with data rates of 1Mbit/s, two with
standard port pins. Enhancements include multiple address recognition and
monitor mode.
C-bus interfaces, one with an open-drain output supporting the
– I2S (Inter-IC Sound) interface for digital audio input or output, with fractional rate
control. The I
3-wire data transmit and receive or 4-wire combined transmit and receive
connections, as well as master clock output.
2
S interface can be used with the GPDMA. The I2S interface supports
• Other peripherals:
– 70 (100 pin package) or 52 (80-pin package) General Purpose I/O (GPIO) pins with
configurable pull-up/down resistors, open drain mode, and repeater mode. All
GPIOs are located on an AHB bus for fast access, and support Cortex-M3
bit-banding. GPIOs can be accessed by the General Purpose DMA Co ntroller. Any
pin of ports 0 and 2 can be used to generate an interrupt.
– 12-bit Analog-to-Digital Converter (ADC) with input multiplexing among eight pins,
conversion rates up to 200 kHz, and multiple result registers. The 12-bit ADC can
be used with the GPDMA controller.
– 10-bit Digital-to-Analog Converter (DAC) with dedicated conversion timer and DMA
support.
– Four general purpose timers/counters, with a total of eight capture inputs and ten
compare outputs. Each timer block has an external count input. Specific timer
events can be selected to generate DM A requests.
– One moto r control PWM with support for three-phase motor control.
– Quadrature encoder interface that can monitor one external quadrature encoder.
– One standard PWM/timer block with external count input.
– Real-Time Clock (RTC) with a separate power domain. The RTC is clocked by a
dedicated RTC oscillator. The R TC block includes 20 bytes of battery-powered
backup registers, allowing system status to be stored when the rest of the chip is
powered off. Battery power can be supplied from a standard 3 V Lithium button
cell. The RTC will continue working when the battery voltage drops to as low as
2.1 V. An RTC interrupt can wake up the CPU from any reduced power mode.
– Watchdog Timer (WDT). The WDT can be clocked from the internal RC oscillator,
the RTC oscillator, or the APB clock.
– Cortex-M3 system tick timer, including an external clock input option.
– Repetitive interrupt timer provides programmable and repeating timed interrupts.
• Standard JTAG test/debug interface as well as Serial Wire Debug and Serial Wire
• Processor wake-up from Power-down mode via any interrupt able to operate during
• Each peripheral has its own clock divider for further power savings.
• Brownout detect with separate threshold for interrupt and forced reset.
• On-chip Power-On Reset (POR).
• On-chip crystal oscillator with an operating range of 1 MHz to 25 MHz.
• 4 MHz internal RC oscillator trimmed to 1% accuracy that can optionally be used as a
• An on-chip PLL allows CPU operation up to the maximum CPU rate without the nee d
• A second, dedicated PLL may be used for the USB interface in order to allow added
• Versatile pin function selection feature allows many possibilities for using on-chip
• Available as 100-pin LQFP (14 x 14 x 1.4 mm) and 80-pin LQFP (12 x 12 x 1.4 mm)
UM10360
Chapter 1: LPC17xx Introductory information
Power-down mode (includes external interrupts, RTC interrupt, USB activity, Ethernet
wake-up interrupt, CAN bus activity, PORT0/2 pin interrupt, and NMI).
system clock.
for a high-frequency crystal. May be run from the main oscillator, the internal RC
oscillator, or the RTC oscillator.
The ARM Cortex-M3 includes three AHB-Lite buses, one system bus and the I-code and
D-code buses which are faster and are used similarly to TCM interfaces: one bus
dedicated for instruction fetch (I-code) and one bus for data access (D-code). The use of
two core buses allows for simultaneous operations if concurrent ope rations target dif ferent
devices.
The LPC17xx uses a multi-layer AHB matrix to connect the Cortex-M3 buses and other
bus masters to peripherals in a flexible manner that optimizes performance by allowing
peripherals on different slaves ports of the matrix to be accessed simultaneously by
different bus masters. Det ails of the multilayer matrix connections are shown in Figure 2
APB peripherals are connected to the CPU via two APB busses using separate slave
ports from the multilayer AHB matrix. This allows for better performance by reducing
collisions between the CPU and the DMA controller. The APB bus bridges are configured
to buffer writes so that the CPU or DMA controller can write to APB devices without
always waiting for APB write completion.
UM10360
Chapter 1: LPC17xx Introductory information
.
1.7 ARM Cortex-M3 processor
The ARM Cortex-M3 is a general purpose 32-bit microprocessor, which offers high
performance and very low power consumption. The Cortex-M3 offers many new features,
including a Thumb-2 instruction set, low interrupt latency, hardware divide,
interruptible/continuable multiple load and store instructions, automatic state save and
restore for interrupts, tightly integrated interrupt controller with Wakeup Interrupt
Controller, and multiple core buses capable of simultaneous accesses.
Pipeline techniques are employed so that all pa rts of the p rocessing and memory systems
can operate continuously. T ypically, while one instruction is being executed, its successor
is being decoded, and a third instruction is being fetched from memory.
The ARM Cortex-M3 processor is described in detail in the Cortex-M3 User Guide that is
appended to this manual.
1.7.1Cortex-M3 Configuration Options
The LPC17xx uses the r2p0 version of the Cortex-M3 CPU, which includes a number of
configurable options, as noted below.
System options:
• The Nested Vectored Inter rupt Controller (NVIC) is included. The NVIC includes the
SYSTICK timer.
• The Wakeup Interrupt Controller (WIC) is included. The WIC allows more powerful
options for waking up the CPU from reduced power modes.
• A Memory Protection Unit (MPU) is included.
• A ROM Table in included. The ROM Table provides addresses of debug components
• Serial Wire Debug is included. Serial Wire Debug allows debug op erations u sing only
• The Embedded Trace Macrocell (ETM) is included. The ETM provides instruction
• The Data Watchpoint and Trace (DWT) unit is included. The DWT allows data
• An Instrumentation T race Macrocell (ITM) is included. Software can write to the ITM in
• The Trace Port Interface Unit (TPIU) is included. The TPIU encodes and provides
• A Flash Patch and Breakpoint (FPB) is included. The FPB can generate hardware
UM10360
Chapter 1: LPC17xx Introductory information
2 wires, simple trace functions can be added with a third wire.
trace capabilities.
address or data value matches to be trace information or trigger other events. The
DWT includes 4 comparators and counters for certain internal events.
order to send messages to the trace port.
trace information to the outside world. This can be on the Serial Wire V iewer pin or the
4-bit parallel trace port.
breakpoints and remap specific addresses in code space to SRAM as a temporary
method of altering non-volatile code. The FPB include 2 literal comparators and 6
instruction comparators.
1.8 On-chip flash memory system
The LPC17xx contains up to 512 kB of on-chip flash memory. A flash memory accelerator
maximizes performance for use with the two fast AHB-Lite buses. This memory may be
used for both code and data storage. Programming of the flash memory may be
accomplished in several ways. It may be programmed In System via the serial port. The
application program may also erase and/or program the flash while the application is
running, allowing a great degree of flexibility for data storage field firmware upgrades, etc.
1.9 On-chip Static RAM
The LPC17xx contains up to 64 kB of on-chip static RAM memory. Up to 32 kB of SRAM,
accessible by the CPU and all three DMA controllers are on a higher-speed bus. Devices
containing more than 32 kB SRAM have two additional 16 kB SRAM blocks, each situated
on separate slave ports on the AHB multilayer matrix.
This architecture allows the possibility for CPU and DMA accesses to be separated in
such a way that there are few or no delays for the bus masters.
The ARM Cortex-M3 processor has a single 4 GB address space. The following table
shows how this space is used on the LPC17xx.
Table 3.LPC17xx memory usage and details
Address rangeGeneral UseAddress range details and description
0x0000 0000 to
0x1FFF FFFF
0x2000 0000 to
0x3FFF FFFF
0x4000 0000 to
0x5FFF FFFF
0xE000 0000 to
0xE00F FFFF
On-chip non-volatile
memory
On-chip SRAM0x1000 0000 - 0x1000 7FFFFor devices with 32 kB of local SRAM.
Boot ROM0x1FFF 0000 - 0x1FFF 1FFF8 kB Boot ROM with flash services.
On-chip SRAM
(typically used for
peripheral data)
GPIO0x2009 C000 - 0x2009 FFFFGPIO.
APB Peripherals0x4000 0000 - 0x4007 FFFFAPB0 Peripherals, up to 32 peripheral blocks,
AHB peripherals0x5000 0000 - 0x501F FFFFDMA Controller, Ethernet interface, and USB
Cortex-M3 Private
Peripheral Bus
0x0000 0000 - 0x0007 FFFFFor devices with 512 kB of flash memory.
0x0000 0000 - 0x0003 FFFFFor devices with 256 kB of flash memory.
0x0000 0000 - 0x0001 FFFFFor devices with 128 kB of flash memory.
0x0000 0000 - 0x0000 FFFFFor devices with 64 kB of flash memory.
0x0000 0000 - 0x0000 7FFFFor devices with 32 kB of flash memory.
0x1000 0000 - 0x1000 3FFFFor devices with 16 kB of local SRAM.
0x1000 0000 - 0x1000 1FFFFor devices with 8 kB of local SRAM.
0x2007 C000 - 0x2007 FFFFAHB SRAM - bank 0 (16 kB), present on
devices with 32 kB or 64 kB of total SRAM.
0x2008 0000 - 0x2008 3FFFAHB SRAM - bank 1 (16 kB), present on
devices with 64 kB of total SRAM.
16 kB each.
0x4008 0000 - 0x400F FFFFAPB1 Peripherals, up to 32 peripheral blocks,
16 kB each.
interface.
0xE000 0000 - 0xE00F FFFFCortex-M3 related functions, includes the
NVIC and System Tick Timer.
2.2 Memory maps
The LPC17xx incorporates several distinct memory regions, shown in the following
figures. Figure 3
program viewpoint following reset. The interrupt vector area supports address remapping,
which is described later in this section.
shows the overall map of the entire address space from the user
User manualRev. 2 — 19 August 2010 13 of 840
0x5000 0000
0x5000 4000
0x5000 8000
0x5000 C000
0x5020 0000
AHB peripherals
Ethernet controller
USB controller
reserved
127- 4 reserved
GPDMA controller
0
1
2
3
APB0 peripherals
0x4000 4000
0x4000 8000
0x4000 C000
0x4001 0000
0x4001 8000
0x4002 0000
0x4002 8000
0x4002 C000
0x4003 4000
0x4003 0000
0x4003 8000
0x4003 C000
0x4004 0000
0x4004 4000
0x4004 8000
0x4004 C000
0x4005 C000
0x4006 0000
0x4008 0000
0x4002 4000
0x4001 C000
0x4001 4000
0x4000 0000
WDT
TIMER0
TIMER1
UART0
UART1
reserved
I2C0
SPI
RTC + backup registers
GPIO interrupts
pin connect
SSP1
ADC
CAN AF RAM
CAN AF registers
CAN common
CAN1
CAN2
22 - 19 reserved
I2C1
31 - 24 reserved
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
23
APB1 peripherals
0x4008 0000
0x4008 8000
0x4008 C000
0x4009 0000
0x4009 4000
0x4009 8000
0x4009 C000
0x400A 0000
0x400A 4000
0x400A 8000
0x400A C000
0x400B 0000
0x400B 4000
0x400B 8000
0x400B C000
0x400C 0000
0x400F C000
0x4010 0000
SSP0
DAC
Timer 2
Timer 3
UART2
UART3
reserved
I2S
I2C2
1 - 0 reserved
2
3
4
5
6
7
8
9
10
reserved
repetitive interrupt timer
11
12
reserved
motor control PWM
30 - 16 reserved
13
14
15
system control31
reserved
reserved
32 kB local static RAM
reserved
reserved
private peripheral bus
0x0000 0000
0 GB
0.5 GB
4 GB
1 GB
0x0008 0000
0x1000 0000
0x1000 8000
0x1FFF 0000
0x1FFF 2000
0x2007 C000
0x2008 4000
0x2009 C000
0x200A 0000
0x2200 0000
0x2400 0000
0x4000 0000
0x4008 0000
0x4010 0000
0x4200 0000
0x4400 0000
0x5000 0000
0x5020 0000
0xE000 0000
0xE010 0000
0xFFFF FFFF
reserved
reserved
GPIO
reserved
reserved
reserved
reserved
APB0 peripherals
AHB periherals
APB1 peripherals
AHB SRAM bit band alias addressing
peripheral bit band alias addressing
AHB SRAM (2 blocks of 16 kB)
LPC1768 memory space
512 kB on-chip flash
QEI
PWM1
8 kB boot ROM
0x0000 0000
0x0000 0400
active interrupt vectors
+ 256 words
I-code/D-code
memory space
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxx x x x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xx xx xxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx x x
xxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxx
Figure 3 and Table 4 show different views of the peripheral address space. The AHB
peripheral area is 2 megabyte in size, and is divided to allow for up to 128 peripherals.
The APB peripheral area is 1 megabyte in size and is divided to allow for up to 64
peripherals. Each peripheral of either type is allocated 16 kilobytes of space. This allows
simplifying the address decoding for each peripheral.
All peripheral register addresses are word aligned (to 32-bit boundaries) regardless of
their size. This eliminates the need for byte lane mapping hardware that would be required
to allow byte (8-bit) or half-word (16-bit) accesses to occur at smaller boundaries. An
implication of this is that word and half-word registers must be accessed all at once. For
example, it is not possible to read or write the upper byte of a word register separately.
2.3 APB peripheral addresses
The following table shows the APB0/1 address maps. No APB peripheral uses all of the
16 kB space allocated to it. Typically each device’s registers are "aliased" or repeated at
multiple locations within each 16 kB range.
The Cortex-M3 incorporates a mechanism that allows remapping the interrupt vector table
to alternate locations in the memory map. This is controlled via the Vector Table Offset
Register contained in the Cortex-M3. Refer to Section 6.4
and Section 34.4.3.5 of the
Cortex-M3 User Guide appended to this manual for details of the Vector Table Offset
feature.
Boot ROM re-mapping
Following a hardware reset, the Boot ROM is temporarily mapped to address 0. This is
normally transparent to the user . However , if execution is halted imm ediately after reset by
a debugger, it should correct the mapping for the user. See Section 33.6
.
2.5 AHB arbitration
The Multilayer AHB Matrix arbitrates between several masters. By default, the Cortex-M3
D-code bus has the highest priority, followed by the I-Code bus. All other masters share a
lower priority.
2.6 Bus fault exceptions
The LPC17xx generates Bus Fault exception if an access is a ttempted for an add ress that
is in a reserved or unassigned address region. The regions are are as of the memor y map
that are not implemented for a specific derivative. These include all spaces marked
“reserved” in Figure 3
For these areas, both attempted data acce ss and in struction fetch genera te an exception.
In addition, a Bus Fault exception is generated for any instruction fetch that maps to an
AHB or APB peripheral address.
Within the address space of an existing APB peripheral, an exception is not generated in
response to an access to an undefined address. Address decoding within e ach peripheral
is limited to that needed to distinguish defined registers within the peripheral itself. For
example, an access to address 0x4000 D000 (an undefined address within the UART0
space) may result in an access to the register defined at address 0x4000C000. Details of
such address aliasing within a peripheral space are not defined in the LPC17xx
documentation and are not a supported feature.
If software executes a write directly to the flash memory, the flash accelerator will
generate a Bus Fault exception. Flash prog r amm i ng must be acco m plis he d by using the
specified flash programming interface provided by the Boot Code.
Note that the Cortex-M3 core stores the exception flag along with the associated
instruction in the pipeline and processes the exception only if an attempt is made to
execute the instruction fetched from the disallowed address. This prevents accidental
aborts that could be caused by prefetches that occur when code is executed very near a
memory boundary.
The system control block includes several system features and control registers for a
number of functions that are not related to specific peripheral devices. These include:
• Reset
• Brown-Out Detection
• External Interrupt Input s
• Miscellaneous System Controls and Status
Each type of function has its own register(s) if any are required and unneeded bits are
defined as reserved in order to allow future expansion. Unrelated functions never share
the same register addresses
3.2 Pin description
Table 6 shows pins tha t ar e as soc i at ed with Syst em Con tr ol block fu nctions.
Table 6.Pin summary
Pin namePin
EINT0InputExternal Interrupt In put 0 - An active low/high level or falling/rising
EINT1Input
EINT2Input
EINT3Input
RESET
Pin description
direction
edge general purpose interrupt input. This pin may be used to wake up
the processor from Sleep, Deep-sleep, or Power-down modes.
External Interrupt Input 1 - See the EINT0 description above.
External Interrupt Input 2 - See the EINT0 description above.
External Interrupt Input 3 - See the EINT0 description above.
InputExternal Reset input - A LOW on this pin resets the chip, causing I/O
ports and peripherals to take on their default states, and the processor to
begin execution at address 0x0000 0000.
EXTINTExternal Interrup t Flag RegisterR/W00x400F C140
EXTMODEExternal Interrupt Mode registerR/W00x400F C148
EXTPOLARExternal Interrupt Polarity RegisterR/W00x 400F C14C
Reset
RSIDReset Source Iden tif icatio n RegisterR/Wsee Table 80x400F C180
Syscon Miscellaneous Registers
SCSSystem Control and StatusR/W00x400F C1A0
3.4 Reset
UM10360
Chapter 3: LPC17xx System control
Reset has 4 sources on the LPC17xx: the RESET pin, Watchdog Reset, Power On Reset
(POR), and Brown Out Detect (BOD).
The RESET
pin is a Schmitt trigger input pin. Assertion of chip Reset by any source, once
the operating voltage attains a usable level, starts the wake-up timer (see description in
Section 4.9 “
Wake-up timer” in this chapter), causing reset to remain asserted until the
external Reset is de-asserted, the oscillator is running, a fixed number of clocks have
passed, and the flash controller has completed it s initialization. The reset logic is shown in
the following block diagram (see Figure 4
On the assertion of a reset source external to the Cortex-M3 CPU (POR, BOD reset,
External reset, and Watchdog reset), the IRC starts up. After the IRC-start-up time
(maximum of 60 μs on power-up) and after the IRC provides a stable clock output, the
reset signal is latched and synchronized on the IRC clock. Then the following two
sequences start simultaneously:
1. The 2-bit IRC wake-up timer starts counting when the synchronized reset is
de-asserted. The boot code in the ROM starts when the 2-bit IRC wake-up timer times
out. The boot code performs the boot tasks and may jump to the flash. If the flash is
not ready to access, the Flash Accelerator will insert wait cycles until the flash is
ready.
2. The flash wake-up timer (9-bit) starts counting when the synchronized reset is
de-asserted. The flash wakeup-timer generates the 100 μs flash start-up time. Once it
times out, the flash initialization sequence is started, which takes about 250 cycles.
When it’s done, the Flash Accelerator will be granted access to the flash.
When the internal Reset is removed, the processor begins executing at address 0, which
is initially the Reset vector mapped from the Boot Block. At that point, all of the processor
and peripheral registers have been initialized to predetermined values.
Figure 5
shows an example of the relationship between the RESET, the IRC, and the
processor status when the LPC17xx starts up after reset. See Section 4.3.2 “
oscillator” for start-up of the main oscillator if selected by the user code.
This register contains one bit for each source of Reset. Writing a 1 to any of these bits
clears the corresponding read-side bit to 0. The interactions among the four sources are
described below.
0PORAssertion of the POR signal sets this bit, and clears all of the other bits in
1EXTRAssertion of the RESET
2WDTRThis bit is set when the Watchdog Timer times out and the WDTRESET bit
3BODRThis bit is set when the V
31:4 -Reserved, user software should not write ones to reserved bits. The value
UM10360
Chapter 3: LPC17xx System control
this register. But if another Reset signal (e.g., External Reset) remains
asserted after the POR signal is negated, then its bit is set. This bit is not
affected by any of the other sources of Reset.
signal sets this bit. This bit is cleared only by
software or POR.
in the Watchdog Mode Register is 1. This bit is cleared only by software or
POR.
BOD reset trip level (typically 1.85 V under nominal room temperature
DD(REG)(3V3)
conditions).
If the V
DD(REG)(3V3)
voltage dips from the normal operating range to below
the BOD reset trip level and recovers, the BODR bit will be set to 1.
If the V
DD(REG)(3V3)
voltage dips from the normal operating range to below
the BOD reset trip level and continues to decline to the level at which POR
is asserted (nominally 1 V), the BODR bit is cleared.
If the V
DD(REG)(3V3)
voltage rises continuously from below 1 V to a level
above the BOD reset trip level, the BODR will be set to 1.
This bit is cleared only by software or POR.
Note: Only in the case where a reset occurs and the POR = 0, the BODR
The LPC17xx includes a Brown-Out Detector (BOD) that provides 2-stage monitoring of
the voltage on the V
(typically 2.2 V under nominal room temperature conditions), the BOD asserts an interrupt
signal to the NVIC. This signal can be enabled for interrupt in the Interrupt Enable
Register in the NVIC in order to cause a CPU interrupt; if not, software can monitor the
signal by reading the Raw Interrupt Status Register.
The second stage of low-voltage d etection a sse rts Reset to inactivate the LPC17xx when
the voltage on the V
under nominal room temperature cond itio ns ). T his Rese t pre ve nts altera tio n of th e flas h
as operation of the various elements of the chip would otherwise become unreliable due
to low voltage. The BOD circuit maintains this reset down below 1 V, at which point the
Power-On Reset circuitry maintains the overall Reset.
Both the BOD reset interrupt level and the BOD reset trip level thresholds include some
hysteresis. In normal operation, this hysteresis allows the BOD reset interrupt level
detection to reliably interrupt, or a regularly-executed event loop to sense the condition.
DD(REG)(3V3)
DD(REG)(3V3)
UM10360
Chapter 3: LPC17xx System control
pins. If this voltage falls below the BOD interrupt trip level
pins falls below the BOD reset trip level (typically 1.85 V
But when Brown-Out Detection is enabled to bring the LPC17xx out of Power-down mode
(which is itself not a guaranteed operation -- see Section 4.8.7 “
register (PCON - 0x400F C0C0)”), the supply voltage may re cover from a transient b efore
the wake-up timer has completed its delay. In this case, the net result of the transient BOD
is that the part wakes up and continues operation after the instructions that set
Power-down mode, without any interrupt occurring and with the BOD bit in the RSID being
0. Since all other wake-up conditions have latching flags (see Section 3.6.2 “
Interrupt flag register (EXTINT - 0x400F C140)” and Section 27.6.2), a wake-up of this
type, without any apparent cause, can be assumed to be a Brown-Out that has gone
away.
TheLPC17xx includes four External Interrupt Inputs as selectable pin functions. The logic
of an individual external interrupt is r epresented in Figure 6
have the ability to wake up the CPU from Power-down mode. Refer to Section 4.8.8
The external interrupt function has four registers associated with it. The EXTINT register
contains the interrupt flags. The EXTMODE and EXTPOLAR registers specify the level
and edge sensitivity parameters.
Table 9.External Interrupt registers
NameDescriptionAccessReset
EXTINTThe External Interrupt Flag Register contains
[1] Reset Value reflects the data stored in used bits only. It does not include reserved bits content.
Chapter 3: LPC17xx System control
interrupt flags for EINT0, EINT1, EINT2 and
EINT3. See Table 10
whether each pin is edge- or level-sensitive.
See Table 11
which level or edge on each pin will cause an
interrupt. See Table 12
.
.
.
UM10360
Address
[1]
value
R/W0x000x400F C140
R/W0x000x400F C148
R/W0x000x400F C14C
3.6.2External Interrupt flag register (EXTINT - 0x400F C140)
When a pin is selected for its external interrupt function, the level or edge on that pin
(selected by its bits in the EXTPOLAR a nd EXTMODE registers) will set its interrup t flag in
this register. This asserts the corresponding interrupt request to the NVIC, which will
cause an interrupt if interrupts from the pin are enabled.
Writing ones to bits EINT0 through EINT3 in EXTINT register clears the corresponding
bits. In level-sensitive mode the interrupt is cleared only when the pin is in its inactive
state.
Once a bit from EINT0 to EINT3 is set and an appropriate code st arts to execute (hand ling
wake-up and/or external interrupt), this bit in EXTINT register must be cleared. Otherwise
event that was just triggered by activity on the EINT pin will not be recognized in future.
Important: whenever a change of external interrupt operating mode (i.e. active
level/edge) is performed (including the initialization of an external interrupt), the
corresponding bit in the EXTINT register must be cleared! For details see
Section 3.6.3 “
Section 3.6.4 “
For example, if a system wakes up from Power-down using low level on external interrupt
0 pin, its post wake-up code must reset EINT0 bit in order to allow future entry into the
Power-down mode. If EINT0 bit is left set to 1, subsequent attempt(s) to invoke
Power-down mode will fail. The same goes for external interrupt handling.
Table 10.External Interrupt Flag reg ister (EXTINT - address 0x400F C140) bit description
BitSymbol DescriptionReset
0EINT0In level-sensitive mode, this bit is set if the EINT0 function is selected for
1EINT1In level-sensitive mode, this bit is set if the EINT1 function is selected for
2EINT2In level-sensitive mode, this bit is set if the EINT2 function is selected for
3EINT3In level-sensitive mode, this bit is set if the EINT3 function is selected for
31:4 -Reserved, user software should not write ones to reserved bits. The value
UM10360
Chapter 3: LPC17xx System control
its pin, and the pin is in its active state. In edge-sensitive mode, this bit is
set if the EINT0 function is selected for its pin, and the selected edge
occurs on the pin.
This bit is cleared by writing a one to it, except in level sensitive mode
when the pin is in its active state.
its pin, and the pin is in its active state. In edge-sensitive mode, this bit is
set if the EINT1 function is selected for its pin, and the selected edge
occurs on the pin.
This bit is cleared by writing a one to it, except in level sensitive mode
when the pin is in its active state.
its pin, and the pin is in its active state. In edge-sensitive mode, this bit is
set if the EINT2 function is selected for its pin, and the selected edge
occurs on the pin.
This bit is cleared by writing a one to it, except in level sensitive mode
when the pin is in its active state.
its pin, and the pin is in its active state. In edge-sensitive mode, this bit is
set if the EINT3 function is selected for its pin, and the selected edge
occurs on the pin.
This bit is cleared by writing a one to it, except in level sensitive mode
when the pin is in its active state.
read from a reserved bit is not defined.
[1]
[1]
[1]
[1]
value
0
0
0
0
NA
[1] Example: e .g. if the EINTx is selected to be low level sensitive and low level is present on
corresponding pin, this bit can not be cleared; this bit can be cleared only when signa l on the
pin becomes high.
The bits in this register select whether ea ch EINT pin is le vel- or edge- sensitive. Only pins
that are selected for the EINT function (see Section 8.5
NVIC register) can cause interrupts from the External Interr up t fun ction (tho ugh of co ur se
pins selected for other functions may cause interrupts from those functions).
Note: Software should only change a bit in this register when its interrupt is
disabled in the NVIC (state readable in the ISERn/ICERn registers), and sho uld write
the corresponding 1 to EXTINT before enabling (initializing) or re-enabling the
interrupt. An extraneous interrupt(s) could be set by changing the mode and not
having the EXTINT cleared.
In level-sensitive mode, the bits in this register select whether the corresponding pin is
high- or low-active. In edge-sensitive mode, they select whether the pin is rising- or
falling-edge sensitive. Only pins that are selected for the EINT function Only pins that are
selected for the EINT function (see Section 8.5
register) can cause interrupts from the External Interrupt function (though of course pins
selected for other functions may cause interrupts from those functions).
description
1EINT0
1EINT1
1EINT2
1EINT3
UM10360
Chapter 3: LPC17xx System control
value
is edge sensitive.
.0
is edge sensitive.
.0
is edge sensitive.
.0
is edge sensitive.
NA
bits. The value read from a reserved bit is not defined.
) and enabled in the appropriate NVIC
Note: Software should only change a bit in this register when its interrupt is
disabled in the NVIC (state readable in the ISERn/ICERn registers), and sho uld write
the corresponding 1 to EXTINT before enabling (initializing) or re-enabling the
interrupt. An extraneous interrupt(s) could be set by changing the polarity and not
having the EXTINT cleared.
Some aspects of controlling LPC17xx operation that do not fit into peripheral or other
registers are grouped here.
3.7.1System Controls and Status register (SCS - 0x400F C1A0)
The SCS register contains several control/status bits related to the main oscillator. Since
chip operation always begins using the Internal RC Oscillator, and the main oscillator may
not be used at all in some applications, it will only be started by software request. This is
accomplished by setting the OSCEN bit in the SCS register , as described in Table 3-13.
The main oscillator provides a status flag (the OSCSTAT bit in the SCS register) so that
software can determine when the oscillator is running and stable. At that point, software
can control switching to the main oscillator as a clock source. Prior to starting the main
oscillator, a frequency range must be selected by configuring the
OSCRANGE bit in the SCS register.
T able 13.System Controls and Status register (SCS - address 0x400F C1A0) bit description
BitSymbolValue DescriptionAccess Reset
3:0--Reserved. User software should not write ones to
reserved bits. The value read from a reserved bit is
not defined.
4OSCRANGEMain oscillator range select.R/W0
0The frequency range of the main oscillator is 1 MHz
to 20 MHz.
1The frequency range of the main oscillator is
15 MHz to 25 MHz.
5OSCENMain oscillator enable.R/W0
0The main oscillator is disabled.
1The main oscillator is enabled, and will start up if
the correct external circuitry is connected to the
XT AL1 and XTAL2 pins.
6OSCSTATMain oscillator status.RO0
0The main oscillator is not ready to be used as a
clock source.
1The main oscillator is ready to be used as a clock
source. The main oscillator must be enabled via the
OSCEN bit.
31:7 --Reserved. User software should not write ones to
reserved bits. The value read from a reserved bit is
not defined.
4.1 Summary of clocking and power control functions
This section describes the generation of the various clocks needed by the LPC17xx and
options of clock source selection, as well as power control and wake-up from reduced
power modes. Functions described in the following subsections include:
The LPC17xx includes three independent oscillators. These are the Main Oscillator, the
Internal RC Oscillator, and the RTC oscillator. Each oscillator can be used for more than
one purpose as required in a particular application. This can be seen in Figure 7
Following Reset, the LPC17xx will operate from the Internal RC Oscillator until switched
by software. This allows systems to operate without any external crystal, and allows the
boot loader code to operate at a known frequency.
4.3.1Internal RC oscillator
The Internal RC Oscillator (IRC) may be used as the clock source for the watchdog timer,
and/or as the clock that drives PLL0 and subsequently the CPU. The precision of the IRC
does not allow for use of the USB interface, which requires a much more precise time
base in order to comply with the USB specification. Also, the IRC should not be used with
the CAN1/2 block if the CAN baud rate is higher than 100 kbit/s.The nominal IRC
frequency is 4 MHz.
Upon power-up or any chip reset, the LPC17xx uses the IRC as the clock source.
Software may later switch to one of the other available clock sources.
UM10360
Chapter 4: LPC17xx Clocking and power control
.
4.3.2Main oscillator
The main oscillator can be used as the clock source for the CPU, with or without using
PLL0. The main oscillator operates at frequencies of 1 MHz to 25 MHz. This frequency
can be boosted to a higher frequency, up to the maximum CPU operating frequency, by
the Main PLL (PLL0). The oscillator output is called OSC_CLK. The clock selected as the
PLL0 input is PLLCLKIN and the ARM processor clock frequency is referred to as CCLK
for purposes of rate equations, etc. elsewh er e in th is doc ume nt. The frequencies of
PLLCLKIN and CCLK are the same value unless the PLL0 is active and connected. Refer
to Section 4.5 “
The on-board oscillator in the LPC17xx can operate in one of two modes: slave mode and
oscillation mode.
In slave mode the input clock signal should be coupled by means of a capacitor of 100 pF
in Figure 8, drawing a), with an amplitude between 200 mVrms and 1000 mVrms.
(C
C
This corresponds to a square wave signal with a signal swing of betwee n 280 mV and 1.4
V. The XTAL2 pin in this configuration can be left unconnected.
External components and models used in oscillation mode are shown in Figure 8
drawings b and c, and in Table 15
integrated on chip, only a crysta l and the cap acit ances C
externally in case of fundamental mode oscillation (the fundamental frequency is
represented by L, C
parallel package capacitance and should not be larger than 7 pF. Parameters F
and C
are supplied by the crystal manufacturer.
P
PLL0 (Phase Locked Loop 0)” for details.
,
and Table 16. Since the feedback resistance is
and CX2 need to be connected
X1
and RS). Capacitance CP in Figure 8, drawing c, represents the
Since chip operation always begins using the Internal RC Oscillator, and the main
oscillator may not be used at all in some applications, it will only be started by software
request. This is accomplished by setting the OSCEN bit in the SCS register, as described
in Table 13
register) so that software can determine when the oscillator is running and stable. At that
. The main oscillator provides a status flag (the OSCSTAT bit in the SCS
Ω39 pF, 39 pF
Ω18 pF, 18 pF
Ω39 pF, 39 pF
NXP Semiconductors
point, software can control switching to the main oscillator as a clock source. Prior to
starting the main oscillator, a frequency range must be selected by configuring the
OSCRANGE bit in the SCS register.
4.3.3RTC oscillator
The RTC oscillator provides a 1 Hz clock to the RTC and a 32 kHz clock output that can
be used as the clock source for PLL0 and CPU and/or the watchdog timer.
Remark: The RTC oscillator must not be used as a clock source when the PLL0 output is
selected to drive the USB controller. In this case select the main oscillator as clock source
for PLL0 (see also Table 17
Several clock sources may be chosen to drive PLL0 and ultimately the CPU and on-chip
peripheral devices. The clock sources available are the main oscillator, the RTC oscillator,
and the Internal RC oscillator.
The clock source selection can only be changed safely when PLL0 is not connected . For a
detailed description of how to change the clock source in a system using PLL0 see
Section 4.5.13 “
Note the following restrictions regarding the choice of clock sources:
• Only the main oscillator must be used (via PLL0) as the clock source for the USB
subsystem. The IRC or RTC oscillators do not provide the proper tolerances for this
use.
• The IRC oscillator should not be used (via PLL0) as the clock source for the CAN
controllers if the CAN baud rate is higher than 100 kbit/s.
PLL0 accepts an input clock frequency in the range of 32 kHz to 50 MHz. The clock
source is selected in the CLKSRCSEL register (see Section 4.4
multiplied up to a high frequency, then divided down to provide the actual clock used by
the CPU, peripherals, and optionally the USB subsystem. Note that the USB subsystem
has its own dedicated PLL (see Section 4.6
maximum allowed for the CPU, which is 120 MHz on high speed versions (LPC1769 and
LPC1759), and 100 MHz on other versions.
4.5.1PLL0 operation
The PLL input, in the range of 32 kHZ to 50 MHz, may initially be divided down by a value
"N", which may be in the range of 1 to 256. This input division provides a greater number
of possibilities in providing a wide range of output frequencies from the same input
frequency.
Following the PLL input divider is the PLL multiplier. This can multiply the input divider
output through the use of a Current Controlled Oscillator (CCO) by a value "M", in the
range of 6 through 512, plus additional values listed in Table 21
must be in the range of 275 MHz to 550 MHz. The multiplier works by dividing the CCO
output by the value of M, then using a phase-frequency detector to compare the divided
CCO output to the multiplier input. The error value is used to adjust the CCO frequency.
UM10360
Chapter 4: LPC17xx Clocking and power control
). The input frequency is
). PLL0 can produce a clock up to the
. The resulting frequency
There are additional dividers at the output of PLL0 to bring the frequency down to what is
needed for the CPU, peripherals, and potentially the USB subsystem. PLL0 output
dividers are described in the Clock Dividers section following the PLL0 description. A
block diagram of PLL0 is shown in Figure 9
PLL activation is controlled via the PLL0CON register. PLL0 multiplier and divider values
are controlled by the PLL0CFG register. These two registers are protected in order to
prevent accidental alteration of PLL0 parameters or dea ctivation of the PLL. Since all chip
operations, including the Watchdog Timer, could be dependent on PLL0 if so configured
(for example when it is providing the chip clock), accidental changes to the PLL0 setup
values could result in unexpected or fatal behavior of the microcontroller. The protection is
accomplished by a feed sequence similar to that of the Watchdog Timer. Details are
provided in the description of the PLL0FEED register.
PLL0 is turned off and bypassed following a chip Reset and by entering Power-down
mode. PLL0 must be configured, enabled, and connected to the system by software.
It is important that the setup procedure described in Section 4.5.13 “
sequence” is followed or PLL0 might not operate at all!
4.5.1.1 PLL0 and startup/boot code interaction
When there is no valid user code (determined by the checksum word) in the user flash or
the ISP enable pin (P2.10) is pulled low on startup, the ISP mode will be entered and the
boot code will setup the PLL with the IRC. Therefore it can not be assumed that the PLL is
disabled when the user opens a debug session to debug the application code. The user
startup code must follow the steps describe d in this chapter to disconnect the PLL.
PLL0 is controlled by the registers shown in Table 18. More detailed descriptions follow.
Warning: Improper setting of PLL0 values may result in incorrect operation of the
device!
Table 18.PLL0 registers
NameDescriptionAccess Reset
PLL0CONPLL0 Control Register. Holding register for
PLL0CFGPLL0 Configuration Register. Holding register for
PLL0STATPLL0 Status Register. Read-back register for
PLL0FEED PLL0 Feed Register. This register enables
Chapter 4: LPC17xx Clocking and power control
updating PLL0 control bits. Values written to this
register do not take effect un ti l a valid PL L0 fee d
sequence has taken place.
updating PLL0 configuration values. Values
written to this register do not take effect until a
valid PLL0 feed sequence has taken place.
PLL0 control and configuration information. If
PLL0CON or PLL0CFG have been written to, but
a PLL0 feed sequence has not yet occurred, they
will not reflect the current PLL0 state. Reading
this register provides the actual values controlling
the PLL0, as well as the PLL0 status.
loading of the PLL0 control and configuration
information from the PLL0CON and PLL0CFG
registers into the shadow registers that actually
affect PLL0 operation.
UM10360
Address
[1]
value
R/W00x400F C080
R/W00x400F C084
RO00x400F C088
WONA0x400F C08C
[1] Reset Value reflects the data stored in used bits only. It does not include reserved bits content.
Fig 9.PLL0 block diagram
4.5.3PLL0 Control register (PLL0CON - 0x400F C080)
The PLL0CON register contains the bits that enable and connect PLL0. Enabling PLL0
allows it to attempt to lock to the current settings of the multiplier and divider values.
Connecting PLL0 causes the processor and most chip functions to run from the PLL0
NXP Semiconductors
output clock. Changes to the PLL0CON register do not take effect until a correct PLL0
feed sequence has been given (see Section 4.5.8 “
0x400F C08C)”).
Table 19.PLL Control register (PLL0CON - address 0x400F C080) bit description
BitSymbol DescriptionReset
0PLLE0PLL0 Enable. When one, and after a valid PLL0 feed, this bit will activate
1PLLC0PLL0 Connect. Setting PLLC0 to one after PLL0 has been enabled and
31:2-Reserved, user software should not write ones to reserved bits. The
PLL0 must be set up, enabled, and Lock established before it may be used as a clock
source. When switching from the oscillator clock to the PLL0 output or vice versa, internal
circuitry synchronizes the operation in order to ensure that glitches are not generated.
Hardware does not insure that PLL0 is locked before it is connected or automatically
disconnect PLL0 if lock is lost during operation. In the event of loss of lock on PLL0, it is
likely that the oscillator clock has become unstable and disconnecting PLL0 will not
remedy the situation.
UM10360
Chapter 4: LPC17xx Clocking and power control
PLL0 Feed register (PLL0FEED -
PLL0 and allow it to lock to the requested frequency. See PLL0STAT
register, Table 22
locked, then followed by a valid PLL0 feed sequence causes PLL0 to
become the clock source for the CPU, AHB peripherals, and used to
derive the clocks for APB peripherals. The PLL0 output may potentially
be used to clock the USB subsystem if the frequency is 48 MHz. See
PLL0ST AT register, Table 22
The PLL0CFG register contains PLL0 multiplier and divider values. Changes to the
PLL0CFG register do not take effect until a correct PLL feed sequence has been given
(see Section 4.5.8 “
the PLL frequency , and multiplier and d ivider values are fo und in the Section4.5.10 “
4.5.5PLL0 Status register (PLL0STAT - 0x400F C088)
The read-only PLL0STAT register provides the actual PLL0 parameters that are in effect
at the time it is read, as well as PLL0 stat us. PLL0STAT may disagree with values fou nd in
PLL0CON and PLL0CFG because changes to those registers do not take effect until a
proper PLL0 feed has occurred (see Section 4.5.8 “
0x400F C08C)”).
T able 22. PLL Status register (PLL0STAT - address 0x400F C088) bit description
BitSymbolDescriptionReset
14:0MSEL0Read-back for the PLL0 Multiplier value. This is the value currently
15-Reserved, user software should not write ones to reserved bits.
23:16 NSEL0Read-back for the PLL0 Pre-Divider value. This is the value
24PLLE0_STAT Read-back for the PLL0 Enable bit. This bit reflects the state of the
25PLLC0_STAT Read-back for the PLL0 Connect bit. This bit reflects the state of
26PLOCK0Reflects the PLL0 Lock status. When zero, PL L0 is not locked.
31:27 -Reserved, user software should not write ones to reserved bits.
UM10360
Chapter 4: LPC17xx Clocking and power control
PLL0 Feed register (PLL0FEED -
used by PLL0, and is one less than the actual multiplier.
The value read from a reserved bit is not defined.
currently used by PLL0, and is one less than the actual divider.
PLEC0 bit in PLL0CON (see Table19
When one, PLL0 is currently enabled. When zero, PLL0 is turned
off. This bit is automatically cleared when Power-down mode is
entered.
the PLLC0 bit in PLL0CON (see Table 19
When PLLC0 and PLLE0 are both one, PLL0 is connected as the
clock source for the CPU. When either PLLC0 or PLLE0 is zero,
PLL0 is bypassed. This bit is automatically cleared when
Power-down mode is entered.
When one, PLL0 is locked onto the requested frequency. See text
for details.
The value read from a reserved bit is not defined.
) after a valid PLL0 feed.
) after a valid PLL0 feed.
value
0
NA
0
0
0
0
NA
4.5.6PLL0 Interrupt: PLOCK0
The PLOCK0 bit in the PLL0STAT register reflects the lock status of PLL0. When PLL0 is
enabled, or parameters are changed, PL L0 requires some time to establish lo ck under the
new conditions. PLOCK0 can be monitored to determine when PLL0 may be connected
for use. The value of PLOCK0 may not be stable when the PLL reference frequency
(F
, the frequency of REFCLK, which is equal to the PLL input frequency divided by the
REF
pre-divider value) is less than 100 kHz or greater than 20 MHz. In these cases, the PLL
may be assumed to be stable after a start-up time has passed. This time is 500 μs when
FREF is greater than 400 kHz and 200 / FREF seconds when FREF is less than 400 kHz
PLOCK0 is connected to the interrupt controller. This allows for software to turn on PLL0
and continue with other functions without having to wait for PLL0 to achieve lock. When
the interrupt occurs, PLL0 may be connected, and the interrupt disabled. PLOCK0
appears as interrupt 32 in Table 50
is locked, so if the interrupt is used, the interrupt service routine must disable the PLOCK0
interrupt prior to exiting.
The combinations of PLLE0 and PLLC0 are shown in Table 23.
Table 23.PLL control bit combinations
PLLC0 PLLE0 PLL Function
00PLL0 is turned off and disconnected. PLL0 outputs the unmodified clock input.
01PLL0 is active, but not yet connected. PLL0 can be connected after PLOCK0 is
10Same as 00 combination. This prevents the possibility of PLL0 being connected
11PLL0 is active and has been connected as the system clock source.
4.5.8PLL0 Feed register (PLL0FEED - 0x400F C08C)
A correct feed sequence must be written to the PLL0FEED register in order for cha nges to
the PLL0CON and PLL0CFG registers to take effect. The feed sequence is:
1. Write the value 0xAA to PLL0FEED.
2. Write the value 0x55 to PLL0FEED.
UM10360
Chapter 4: LPC17xx Clocking and power control
asserted.
without also being enabled.
The two writes must be in the correct sequence, and there must be no other register
access in the same address space (0x400F C000 to 0x400F FFFF) between them.
Because of this, it may be necessary to disable interrupt s for the duration of the PLL0 feed
operation, if there is a possibility that an interrupt service routine could write to another
register in that space. If either of the feed values is incorrect, or one of the previously
mentioned conditions is not met, any changes to the PLL0CON or PLL0CFG register will
not become effective.
Table 24.PLL Feed register (PLL0FEED - address 0x4 00F C08C) bit des cription
BitSymbolDescriptionReset
7:0PLL0FEED The PLL0 feed sequence must be written to this register in order for
PLL0 configuration and control register changes to take effect.
31:8-Reserved, user software should not write ones to reserved bits. The
value read from a reserved bit is not defined.
4.5.9PLL0 and Power-down mode
Power-down mode automatically turns off and disconnects PLL0. Wake-up from
Power-down mode does not automatically restore PLL0 settings, this must be done in
software. T ypically , a r outine to activate PLL0, wait for lock, and then connect PLL0 can be
called at the beginning of any interrupt service routine that might be called due to the
wake-up. It is important not to attempt to restart PLL0 by simply feeding it when execution
resumes after a wake-up from Power-down mode. This would enable and connect PLL0
at the same time, before PLL lock is established.
NPLL0 Pre-divider value from the NSEL0 bits in the PLL0CFG register (PLL0CFG
MPLL0 Multiplier value from the MSEL0 bits in the PLL0CFG register (PLL0CFG
F
REF
The PLL0 output frequency (when PLL0 is both active and connected) is given by:
F
CCO
PLL inputs and settings must meet the following:
• F
• F
Chapter 4: LPC17xx Clocking and power control
the frequency of PLLCLKIN from the Clock Source Selection Multiplexer.
the frequency of the PLLCLK (output of the PLL Current Controlled Oscillator)
NSEL0 field + 1). N is an integer from 1 through 32.
MSEL0 field + 1). Not all potential values are supported. See below.
PLL internal reference frequency, FIN divided by N.
= (2 × M × FIN) / N
is in the range of 32 kHz to 50 MHz.
IN
is in the range of 275 MHz to 550 MHz.
CCO
UM10360
The equation can be solved for other PLL parameters:
M = (F
N = (2 × M × F
FIN = (F
× N) / (2 × FIN)
CCO
IN
× N) / (2 × M)
CCO
) / F
CCO
Allowed values for M:
At higher oscillator frequencies, in the MHz range, values of M from 6 through 512 are
allowed. This supports the entire useful range of both the main oscillator and the IRC.
For lower frequencies, specifically when the RTC is used to clock PLL0, a set of 65
additional M values have been selected for supporting baud rate generation, CAN
operation, and obtaining integer MHz frequencies. Th ese values are shown in Table 26
PLL0 parameter determination can be simplified by using a spreadsheet available from
NXP. To determine PLL0 parameters by hand, the follo win g ge n er al procedure may be
used:
1. Determine if the application requires use of the USB interface, and whether it will be
clocked from PLL0. The USB requires a 50% duty cycle clock of 48 MHz within a very
small tolerance, which means that F
(i.e. an integer multiple of 96 MHz), within a very small tolerance.
2. Choose the desired pro cessor operating frequency (CCLK). This may be based on
processor throughput requirements, need to support a specific set of UART baud
rates, etc. Bear in mind that peripheral devices may be running from a lower clock
frequency than that of the processor (see Section 4.7 “
Section 4.8 “
Power control” on page 58). Find a value for F
multiple of the desired CCLK frequency, bearing in mind the requirement for USB
support in [1] above, and that lower values of F
3. Choose a value for the PLL input frequency (F
the main oscillator, the RTC oscillator, or the on-chip RC oscillator. For USB support,
the main oscillator should be used. Bear in mind that if PLL1 rather than PLL0 is used
to clock the USB subsystem, this affects the choice of the main oscillator frequency.
4. Calculate values for M and N to produce a sufficiently accurate F
desired M value -1 will be written to the MSEL0 field in PLL0CFG. The desired N value
-1 will be written to the NSEL0 field in PLL0CFG.
must be an even integer multiple of 48 MHz
CCO
IN
Clock dividers” on page 54 and
that is close to a
CCO
result in lower power dissipation.
CCO
). This can be a clock obtained from
frequency. The
CCO
In general, it is better to use a smaller value for N, to reduce the level of multiplication that
must be accomplished by the CCO. Due to the difficulty in finding the best values in some
cases, it is recommended to use a spreadsheet or similar method to show many
possibilities at once, from which an overall best choice may be selected. A spreadsheet is
available from NXP for this purpose.
The following table gives a summary of examples that illustrate selecting PLL0 values
based on different system requirements.
T able 27. Summary of PLL0 examples
Example Description
UM10360
Chapter 4: LPC17xx Clocking and power control
1• The PLL0 clock source is 10 MHz.
• PLL0 is not used as the USB clock source, or the USB interface is not used.
• The desired CPU clock is 100 MHz.
2• The PLL0 clock source is 4 MHz.
• PLL0 is used as the USB clock source.
• The desired CPU clock is 60 MHz.
3• The PLL0 clock source is the 32.768 kHz RTC clock.
• PLL0 is not used as the USB clock source, or the USB interface is not used.
• The desired CPU clock is 72 MHz.
Example 1
Assumptions:
• The USB interface will not be used in the application, or will be clocked by PLL1.
• The desired CPU rate is 100 MHz.
• An external 10 MHz crystal or clock source will be used as the system clock source.
Calculations:
M = (F
A smaller value for the PLL pre-divide (N) as well as a smaller value of the multiplier (M),
both result in better PLL operational stability and lower output jitter. Lower values of F
also save power. So, the process of determining PLL setup parameters involves looking
for the smallest N and M values giving the lowest F
CPU and/or USB clocks. It is usually easier to work backward from the desired output
clock rate and determine a target F
the available input clock.
Potential precise values of F
example, it is clear that the smallest frequency for F
clock rate and is within the PLL0 operating range of 275 to 550 MHz is 300 MHz
(3 × 100 MHz).
× N) / (2 × FIN)
CCO
value that will support the required
CCO
rate, then find a way to obtain that F
CCO
are integer multiples of the desired CPU clock. In this
CCO
that can produce the desired CPU
CCO
CCO
CCO
rate from
Assuming that the PLL pre-divide is 1 (N = 1), the equation above gives
6
M = ((300 × 10
× 1) / (2 × 10 × 106) = 300 / 20 = 15. Since the result is an integer , there is
no need to look any further for a good set of PLL0 configuration value s. The va lue written
to PLL0CFG would be 0x0E (N - 1 = 0; M - 1 = 14 gives 0x0E).
The PLL output must be further divided in order to produce the CPU clock. This is
accomplished using a separate divider that is described later in this chapter, see
• The USB interface will be used in the application and will be clocked from PLL0.
• The desired CPU rate is 60 MHz.
• An external 4 MHz crystal or clock source will be used as the system clock source.
Calculations:
UM10360
Chapter 4: LPC17xx Clocking and power control
This clock source could be the Internal RC oscillator (IRC).
M = (F
× N) / (2 × FIN)
CCO
Because supporting USB requires a precise 48 MHz clock with a 50% duty cycle, that
need must be addressed first. Potential precise values of F
are integer multiples of the
CCO
2 × the 48 MHz USB clock. The 2 × insures that the clock has a 50% duty cycle, which
would not be the case for a division of the PLL output by an odd number.
The possibilities for the F
MHz. The smallest frequency for F
rate when the USB is used are 288 MHz, 384 MHz, and 480
CCO
that can produce a valid USB clock rate and is
CCO
within the PLL0 operating range is 288 MHz (3 × 2 × 48 MHz).
Star t by assuming N = 1, since this produces the smallest multiplier needed for PLL0. So,
6
M = ((288 × 10
) × 1) / (2 × (4 × 106)) = 288 / 8 = 36. The result is an integer, which is
necessary to obtain a precise USB clock. The value written to PLL0CFG would be 0x23
(N - 1 = 0; M - 1 = 35 = 0x23).
The potential CPU clock rate can be determined by dividing F
frequency: 288 × 10
6
/60× 106= 4.8. The nearest integer value for the CPU Clock
by the desired CPU
CCO
Divider is then 5, giving us 57.6 MHz as the nearest value to the desired CPU clock rate.
If it is important to obtain exactly 60 MHz, an F
down to both 48 MHz and 60 MHz. As previously noted, the possibilities for the F
rate must be found that can be divided
CCO
CCO
rate
when the USB is used are 288 MHz, 384 MHz, and 480 MHz. Of these, only is 480 MHz is
also evenly divisible by 60. Divided by 10, this gives the 48 MHz with a 50% duty cycle
needed by the USB subsystem. Divided by 8, it gives 60 MHz for the CPU clock. PLL0
settings for 480 MHz are N = 1 and M = 60.
The PLL output must be further divided in order to produce both the CPU clock and the
USB clock. This is accomplished using separate dividers that are described later in this
chapter. See Section 4.7.1
• The USB interface will not be used in the application, or will be clocked by PLL1.
• The desired CPU rate is 72 MHz
• The 32.768 kHz RTC clock source will be used as the system clock source
Calculations:
UM10360
Chapter 4: LPC17xx Clocking and power control
M = (F
× N) / (2 × FIN)
CCO
The smallest integer multiple of the desired CPU clock rate that is within the PLL0
operating range is 288 MHz (4 × 72 MHz).
6
Using the equation above and assuming that N = 1, M = ((288 × 10
) × 1) / (2 × 32,768) =
4,394.53125. This is not an integer, so th e CPU frequency will not be exactly 72 MHz with
this setting. Since this example is less obvious, it may be useful to make a table of
possibilities for different values of N (see below).
Beyond N = 5, the value of M is out of range or not supported, so the table stops at that
point. In the third column of the table, the calculated M value is rounded to the nearest
integer. If this results in CCLK being above the maximum operating frequency, it is
allowed if it is not more than 1/2 % above the maximum freque n cy.
In general, larger values of F
result in a more stable PLL when the input clock is a low
REF
frequency. Even the first table entry shows a very small error of just over 1 hundred th of a
percent, or 107 parts per million (ppm). If that is not accurate enough in the application,
the second case gives a much smaller error of 7 ppm. There are no allowed combinations
that give a smaller error than that.
Remember that when a frequency below about 1 MHz is used as the PLL0 clock source,
not all multiplier values are available. As it turns out, all of the rounded M values found in
Table 28
of this example are supported, which may be confirmed in Table 26. If PLL0
calculations suggest use of unsupported multiplier values, those values must be
disregarded and other values examined to find the best fit.
The value written to PLL0CFG for the second table entry would be 0x12254
(N - 1 = 1 = 0x1; M - 1 = 8788 = 0x2254).
The PLL output must be further divided in order to produce the CPU clock. This is
accomplished using a separate divider that is described later in this chapter, see
The following sequence must be followed step by step in order to have PLL0 initialized
and running:
1. Disconnect PLL0 with one feed sequence if PLL0 is a lready connected.
2. Disable PLL0 with one feed sequence.
3. Change the CPU Clock Divider setting to speed up operation without PLL0, if desired.
4. Write to the Clock Source Selection Contr ol register to change the clock source if
5. Write to the PLL0CFG and make it effective with one feed sequence. The PLL0CFG
6. Enable PLL0 with one feed sequence.
7. Change the CPU Clock Divider setting for the operation with PLL0. It is critical to do
8. W ait for PLL0 to achieve lock by monito ring the PLOCK0 bit in the PLL0STAT register ,
9. Connect PLL0 with one feed sequence.
UM10360
Chapter 4: LPC17xx Clocking and power control
needed.
can only be updated when PLL0 is disabled.
this before connecting PLL0.
or using the PLOCK0 interrupt, or wait for a fixed time when the input clock to PLL0 is
slow (i.e. 32 kHz). The value of PLOCK0 may not be stable when the PLL reference
frequency (FREF, the frequency of REFCLK, which is equal to the PLL input
frequency divided by the pre-divider value) is less than 100 kHz or greater than
20 MHz. In these cases, the PLL may be assumed to be stable after a start-up time
has passed. This time is 500 µs when FREF is greater than 400 kHz and 200 / FREF
seconds when FREF is less than 400 kHz.
It is very important not to merge any steps above. For example, do not update the
PLL0CFG and enable PLL0 simultaneously with the same feed sequence.
PLL1 receives its clock input from the main oscillator only and can be used to provide a
fixed 48 MHz clock only to the USB subsystem. This is an option in addition to the
possibility of generating the USB clock from PLL0.
PLL1 is disabled and powered off on reset. If PLL1 is left disabled, the USB clock can be
supplied by PLL0 if everything is set up to provide 48 MHz through that route. If PLL1 is
enabled and connected via the PLL1CON register (see Section 4.6.2
selected to drive the USB subsystem (see Figure 7
PLL1 activation is controlled via the PLL1CON register . PLL1 mu ltiplier and divide r values
are controlled by the PLL1CFG register. These two registers are protected in order to
prevent accidental alteration of PLL1 parameters or deactivation of PLL1. The protection
is accomplished by a feed sequence similar to that of the Watchdog Timer. Details are
provided in the description of the PLL1FEED register.
PLL1 accepts an input clock frequency in the range of 10 MHz to 25 MHz only. The input
frequency is multiplied up to the range of 48 MHz for the USB clock using a Current
Controlled Oscillator (CCO). The multiplier can be an integer value from 1 to 32 (for USB,
the multiplier value cannot be higher than 4. The CCO operates in the range of 156 MHz
to 320 MHz, so there is an additional divider in the loop to keep the CCO within its
frequency range while PLL1 is providing the desired output frequency. The output divider
may be set to divide by 2, 4, 8, or 16 to produce the output clock. Since the minimum
output divider value is 2, it is insured that the output of PLL1 has a 50% duty cycle. A
block diagram of PLL1 is shown in Figure 10
UM10360
Chapter 4: LPC17xx Clocking and power control
), it is automatically
).
.
4.6.1PLL1 register description
PLL1 is controlled by the registers shown in Table 29. More detailed descriptions follow.
Writes to any unused bits are ignored. A read of any unused bits will return a logic zero.
Warning: Improper setting of PLL1 values may result in incorrect operation of the
USB subsystem!
Table 29.PLL1 registers
NameDescriptionAccess Reset
PLL1CONPLL1 Control Register. Holding register for
updating PLL1 control bits. Values written to this
register do not take effect until a valid PLL1 feed
sequence has taken place.
PLL1STATPLL1 Status Register. Read-back register for
PLL1FEEDPLL 1 Feed Register. This register enables
Chapter 4: LPC17xx Clocking and power control
for updating PLL1 configuration values. Values
written to this register do not take effect until a
valid PLL1 feed sequence has taken place.
PLL1 control and configuration information. If
PLL1CON or PLL1CFG have been written to,
but a PLL1 feed sequence has not yet occurred,
they will not reflect the current PLL1 state.
Reading this register provides the actual values
controlling PLL1, as well as PLL1 status.
loading of PLL1 control and configuration
information from the PLL1CON and PLL1CFG
registers into the shadow registers that actually
affect PLL1 operation.
UM10360
Address
[1]
value
R/W00x400F C0A4
RO00x400F C0A8
WONA0x400F C0AC
[1] Reset Value reflects the data stored in used bits only. It does not include reserved bits content.
Fig 10. PLL1 block diagram
4.6.2PLL1 Control register (PLL1CON - 0x400F C0A0)
The PLL1CON register contains the bits that enable and connect PLL1. Enabling PLL1
allows it to attempt to lock to the current settings of the multiplier and divider values.
Connecting PLL1 causes the USB subsystem to run from the PLL1 output clock. Changes
to the PLL1CON register do not take effect until a corre ct PLL feed sequence has been
given (see Section 4.6.6
Table 30.PLL1 Control register (PLL1CON - address 0x400F C0A0) bit description
BitSymbolDescriptionReset
0PLLE1PLL1 Enable. When one, and after a valid PLL1 feed, this bit will
1PLLC1PLL1 Connect. Setting PLLC to one after PLL1 has been enabled and
31:2-Reserved, user software should not write ones to reserved bits. The
PLL1 must be set up, enabled, and lock established before it may be used as a clock
source for the USB subsystem. The hardware does not insure that the PLL is locked
before it is connected nor does it automatically disconnect the PLL if lock is lost during
operation.
activate PLL1 and allow it to lock to the requested frequency. See
PLL1STAT register, Table 32
locked, then followed by a valid PLL1 feed sequence causes PLL1 to
become the clock source for the USB subsystem via the USB clock
divider. See PLL1STAT register, Table 32
value read from a reserved bit is not defined.
.
.
value
0
0
NA
The PLL1CFG register contains the PLL1 multiplier and divider values. Chan ges to the
PLL1CFG register do not take effect until a correct PLL1 feed sequence has been given
(see Section 4.6.6
are found in Section 4.6.9
4:0MSEL1PLL1 Multiplier value. Supplies the value "M" in the PLL1 frequency
6:5PSEL1PLL1 Divider value. Supplies the value "P" in the PLL1 frequency
31:7-Reserved, user software should not write ones to reserved bits. The
). Calculations for the PLL1 frequency, and multiplier and divider values
.
calculations.
Note: For details on selecting the right value for MSEL1 see
Section 4.6.8
calculations.
Note: For details on selecting the right value for PSEL1 see
Section 4.6.8
value read from a reserved bit is not defined.
.
.
4.6.4PLL1 Status register (PLL1STAT - 0x400F C0A8)
The read-only PLL1STAT register provides the actual PLL1 parameters that are in effect
at the time it is read, as well as the PLL1 status. PLL1STAT may disagree with values
found in PLL1CON and PLL1CFG because changes to those registers do not take effect
until a proper PLL1 feed has occurred (see Section 4.6.6 “
Table 32.PLL1 Status register (PLL1STAT - address 0x400F C0A8) bit description
BitSymbolDescriptionReset
4:0MSEL1Read-back for the PLL1 Multiplier value. This is the value currently
6:5PSEL1Read-back for the PLL1 Divider value. This is the value currently
7-Reserved, user software should not write ones to reserved bits.
8PLLE1_STAT Read-back for the PLL1 Enable bit. When one, PLL1 is currently
9PLLC1_STAT Read-back for the PLL1 Connect bit. When PLLC and PLLE are
10PLOCK1Reflects the PLL1 Lock status. When zero, PL L1 is not locked.
31:11 -Reserved, user software should not write ones to reserved bits.
UM10360
Chapter 4: LPC17xx Clocking and power control
value
0
used by PLL1.
0
used by PLL1.
NA
The value read from a reserved bit is not defined.
0
activated. When zero, PLL1 is turned off. This bit is automatically
cleared when Power-down mode is activated.
0
both one, PLL1 is connected as the clock source for the
microcontroller. When either PLLC or PLLE is zero, PLL1 is
bypassed and the oscillator clock is used directly by the
microcontroller. This bit is automatically cleared when Power-down
mode is activated.
0
When one, PLL1 is locked onto the requested frequency.
NA
The value read from a reserved bit is not defined.
4.6.4.1 PLL1 modes
The combinations of PLLE1 and PLLC1 are shown in Table 33.
Table 33.PLL1 control bit combinat ions
PLLC1PLLE1PLL1 Function
00PLL1 is turned off and disconnected.
01PLL1 is active, but not yet connected. PLL1 can be connected after PLOCK1
is asserted.
10Same as 00 combination. This prevents the possibility of PLL1 being
connected without also being enabled.
11PLL1 is active and has been connected. The clock for the USB subsystem is
sourced from PLL1.
4.6.5PLL1 Interrupt: PLOCK1
The PLOCK1 bit in the PLL1STAT register reflects the lock status of PLL1. When PLL1 is
enabled, or parameters are changed, the PLL requires some time to establish lock under
the new conditions. PLOCK1 can be monitored to determine when the PLL may be
connected for use.
PLOCK1 is connected to the interrupt controller. This allows for software to turn on the
PLL and continue with other functions without having to wait for the PLL to achieve lock.
When the interrupt occurs, the PLL may be connected, and the interrupt disabled.
PLOCK1 appears as interrupt 48 in Table 50
whenever PLL1 is locked, so if the interrupt is used, the interrupt service routine must
disable the PLOCK1 interrupt prior to exiting.
A correct feed sequence must be written to the PLL1FEED register in order for cha nges to
the PLL1CON and PLL1CFG registers to take effect. The feed sequence is:
1. Write the value 0xAA to PLL1FEED.
2. Write the value 0x55 to PLL1FEED.
The two writes must be in the correct sequence, and there must be no other register
access in the same address space (0x400F C000 to 0x400F FFFF) between them.
Because of this, it may be necessary to disable interrupts for the duration of the PLL feed
operation, if there is a possibility that an interrupt service routine could write to another
register in that space. If either of the feed values is incorrect, or one of the previously
mentioned conditions is not met, any changes to the PLL1CON or PLL1CFG register will
not become effective.
Table 34.PLL1 Feed register (PLL1FEED - address 0x400 F C0AC) bit description
BitSymbolDescriptionReset
7:0PLL1FEEDThe PLL1 feed sequence must be written to this register in order for
31:8-Reserved, user software should not write ones to reserved bits. The
UM10360
Chapter 4: LPC17xx Clocking and power control
value
0x00
PLL1 configuration and control register changes to take effect.
NA
value read from a reserved bit is not defined.
4.6.7PLL1 and Power-down mode
Power-down mode automatically turns off and disconnects activated PLL(s). Wake-up
from Power-down mode does not automatically restore PLL settings, this must be done in
software. Typically, a routine to activate the PLL, wait for lock, and then connect the PLL
can be called at the beginning of any interrupt service routine that might be called due to
the wake-up. It is important not to attempt to restart a PLL by simply feeding it when
execution resumes after a wake-up from Power-down mode. This would enable and
connect the PLL at the same time, before PLL lock is established.
If activity on the USB data lines is not selected to wake the microcontroller from
Power-down mode (see Section 4.8.8
the Main PLL (PLL0) and the USB PLL (PLL1) will be automatically be turned off and
disconnected when Power-down mode is invoked, as described above. However, if the
USB activity interrupt is enabled and USB_NEED_CLK = 1 (see Table 191
description of USB_NEED_CLK), it is not possible to go into Power-down mode and any
attempt to set the PD bit will fail, leaving the PLLs in the current state.
USBCLKthe PLL1 output frequency (48 MHz for USB)
MPLL1 Multiplier value from the MSEL1 bits in the PLL1CFG register
PPLL1 Divider value from the PSEL1 bits in the PLL1CFG register
The PLL1 output frequency (when the PLL is both active and connected) is given by:
UM10360
Chapter 4: LPC17xx Clocking and power control
the frequency from the crystal oscillator
the frequency of the PLL1 current controlled oscillator
USBCLK = M × F
or USBCLK = F
OSC
CCO
/ (2 × P)
The CCO frequency can be computed as:
= USBCLK × 2 × P or F
F
CCO
CCO
= F
× M × 2 × P
OSC
The PLL1 inputs and settings must meet the following criteria:
• F
is in the range of 10 MHz to 25 MHz.
OSC
• USBCLK is 48 MHz.
• F
is in the range of 156 MHz to 320 MHz.
CCO
4.6.9Procedure for determining PLL1 settings
The PLL1 configuration for USB may be determined as follows:
1. The desired PLL1 output frequency is USBCLK = 48 MHz.
2. Choose an oscillator frequency (F
multiple of F
meaning that the possible values for F
OSC
24 MHz.
3. Calculate the value of M to configure the MSEL1 bits. M = USBCLK / F
case, the possible values for M = 2, 3, or 4 (F
value written to the MSEL1 bits in PLL1CFG is M − 1 (see Table 37
4. Find a value for P to configure the PSEL1 bits, such that F
frequency limits of 156 MHz to 320 MHz. F
2 × P. It follows that P = 2 is the only P value to yield F
value written to the PSEL1 bits in PLL1CFG is ‘01’ for P= 2 (see Table 36
The output of the PLL0 must be divided down for u se by the CPU and the USB subsystem
(if used with PLL0, see Section 4.6
frequency can be determined independently from the USB subsystem, which always
requires 48 MHz with a 50% duty cycle for proper operation.
UM10360
Chapter 4: LPC17xx Clocking and power control
). Separate dividers are provided such that the CPU
The CCLKCFG register controls the division of the PLL0 output before it is used by the
CPU. When PLL0 is bypassed, the division may be by 1. When PLL0 is running, the
output must be divided in order to bring the CPU clock frequency (CCLK) within operating
limits. An 8-bit divider allows a range of options, includin g slowing CPU oper ation to a low
rate for temporary power savings without turning off PLL0.
Note: when the USB interface is used in an application, CCLK must be at least 18 MHz in
order to support internal operations of the USB subsystem.
7:0CCLKSELSelects the divide value for creating the CPU clock (CCLK)
31:8-Reserved, user software should not write ones to reserved
UM10360
Chapter 4: LPC17xx Clocking and power control
description
value
0x00
from the PLL0 output.
0pllclk is divided by 1 to produce the CPU clock. This setting is
not allowed when the PLL0 is connected, because the rate
would always be greater than the maximum allowed CPU
clock.
1pllclk is divided by 2 to produce the CPU clock. This setting is
not allowed when the PLL0 is connected, because the rate
would always be greater than the maximum allowed CPU
clock.
2pllclk is divided by 3 to produce the CPU clock.
3pllclk is divided by 4 to produce the CPU clock.
4pllclk is divided by 5 to produce the CPU clock.
::
255pllclk is divided by 256 to produce the CPU clock.
NA
bits. The value read from a reserved bit is not defined.
The CCLK is derived from the PLL0 output signal, divided by CCLKSEL + 1. Having
CCLKSEL = 2 results in CCLK being one third of the PLL0 output, CCLKSEL = 3 results in
CCLK being one quarter of the PLL0 output, etc.
This register is used only if the USB PLL (PLL1) is not connected (via the PLLC1 bit in
PLL1CON). If PLL1 is connected, its output is automatically used as the USB clock
source, and PLL1 must be configured to supply the correct 48 MHz clock to the USB
subsystem. If PLL1 is not connected, the USB subsystem will be driven by PLL0 via the
USB clock divider.
The USBCLKCFG register controls the division of the PLL0 output before it is used by the
USB subsystem.The PLL0 output must be divided in order to bring the USB clock
frequency to 48 MHz with a 50% duty cycle. A 4-bit divider allows obtaining the correct
USB clock from any even multiple of 48 MHz (i.e. any multiple of 96 MHz) within the PLL
operating range.
Remark: The Internal RC oscillator should not be used to drive PLL0 when the USB is
using PLL0 as a clock source because a more precis e clo ck is neede d for USB
specification compliance (see Table 17
3:0USBSELSelects the divide value for creating the USB clock from the
31:4-Reserved, user software should not write ones to reserved
4.7.3Peripheral Clock Selection registers 0 and 1 (PCLKSEL0 0x400F C1A8 and PCLKSEL1 - 0x400F C1AC)
A pair of bits in a Peripheral Clock Selection register controls the rate of the clock signal
that will be supplied to the corresponding peripheral as specified in Table 40
Table 42
description
.
UM10360
Chapter 4: LPC17xx Clocking and power control
PLL0 output. Only the values shown below can produce even
number multiples of 48 MHz from the PLL0 output.
Warning: Improper setting of this value will result in incorrect
operation of the USB interface.
5PLL 0 output is divided by 6. PLL0 output must be 288 MHz.
7PLL 0 output is divided by 8. PLL0 output must be 384 MHz.
9PLL0 output is divided by 10. PLL0 output must be 480 MHz.
bits. The value read from a reserved bit is not defined.
, Table 41 and
value
0
NA
Remark: The peripheral clock for the RTC block is fixed at CCLK/8.
1:0PCLK_WDTPeripheral clock selection for WDT.00
3:2PCLK_TIMER0Peripheral clock selection for TIMER0.00
5:4PCLK_TIMER1Peripheral clock selection for TIMER1.00
7:6PCLK_UART0Peripheral clock selection for UART0.00
9:8PCLK_UART1Peripheral clock selection for UART1.00
11:10-Reserved.NA
13:12PCLK_PWM1Peripheral clock selection for PWM1.00
15:14PCLK_I2C0Peripheral clock selection for I
17:16PCLK_SPIPeripheral clock selection for SPI.00
19:18-Reserved.NA
21:20PCLK_SSP1Peripheral clock selection for SSP1.00
23:22PCLK_DACPeripheral clock selection for DAC.00
25:24PCLK_ADCPeripheral clock selection for ADC.00
27:26PCLK_CAN1Peripheral clock selection for CAN1.
29:28PCLK_CAN2Peripheral clock selection for CAN2.
31:30PCLK_ACFPeripheral clock selection for CAN acceptance filtering.
2
C0.00
[1]
[1]
[1]
00
00
00
[1] PCLK_CAN1 and PCLK_CAN2 must have the same PCLK divide value when the CAN function is used.
1:0PCLK_QEIPeripheral clock selection for the Quadrature Encoder
3:2PCLK_GPIOINTPeripheral clock selection for GPIO interrupts.00
5:4PCLK_PCBPeripheral clock selection for the Pin Connect block.00
7:6PCLK_I2C1Peripheral clock selection for I
9:8-Reserved.NA
1 1:10PCLK_SSP0Peripheral clock selection for SSP0.00
13:12PCLK_TIMER2Peripheral clock selection for TIMER2.00
15:14PCLK_TIMER3Peripheral clock selection for TIMER3.00
17:16PCLK_UART2Peripheral clock selection for UART2.00
19:18PCLK_UART3Peripheral clock selection for UART3.00
21:20PCLK_I2C2Peripheral clock selection for I
23:22PCLK_I2SPeripheral clock selection for I
25:24-Reserved.NA
27:26PCLK_RITPeripheral clock selection for Repetitive Interrupt Timer.00
29:28PCLK_SYSCONPeripheral clock selection for the System Control block.00
31:30PCLK_MCPeripheral clock selection for the Motor Control PWM.00
description
Interface.
UM10360
Chapter 4: LPC17xx Clocking and power control
value
00
2
C1.00
2
C2.00
2
S.00
Table 42.Peripheral Clock Selection register bit values
PCLKSEL0 and PCLKSEL1
FunctionReset
individual peripheral’ s clock
select options
00PCLK_peripheral = CCLK/400
01PCLK_peripheral = CCLK
10PCLK_peripheral = CCLK/2
11PCLK_peripheral = CCLK/8, except for CAN1, CAN2, and
The LPC17xx supports a variety of power control featur es: Sleep mode, Deep Sleep
mode, Power-down mode, and Deep Power-d own mode. The CPU clock rate may also be
controlled as needed by changing clock sources, re-configuring PLL values, and/or
altering the CPU clock divider value. This allows a trade-off of power versus processing
speed based on application requirements. In addition, Peripheral Power Control allows
shutting down the clocks to individual on-chip peripherals, allowing fine tuning of power
consumption by eliminating all dynamic power use in any peripherals that are not required
for the application.
Entry to any reduced power mode begins with the execution of either a WFI (Wait For
Interrupt) or WFE (Wait For Exception) instruction by the Cortex-M3. The Cortex-M3
internally supports two reduced power modes: Sleep and Deep Sleep. These are sele cted
by the SLEEPDEEP bit in the cortex-M3 System Control Register. Power-down and Deep
Power-down modes are selected by bits in the PCON register. See Table 44
register contains flags that indicate whether entry into each reduced power mode actu ally
occurred.
UM10360
Chapter 4: LPC17xx Clocking and power control
. The same
The LPC17xx also implements a separate power domain in order to allow turning off
power to the bulk of the device while maintaining operation of the Real Time Clock.
Reduced power modes have some limitation during debug, see Section 33.5
information.
4.8.1Sleep mode
Note: Sleep mode on the LPC17xx corresponds to the Idle mode on LPC2xxx series
devices. The name is changed because ARM has incorpor ated portions of reduced power
mode control into the Cortex-M3. LPC17xx documentation uses the Cortex-M3
terminology where applicable.
When Sleep mode is entered, the clock to the core is stopped, and the SMFLAG bit in
PCON is set, see Table 44
sequence but re-enabling the clock to the ARM core.
In Sleep mode, execution of instructions is suspended until either a Reset or an interrupt
occurs. Peripheral functions continue operation during Sleep mode and may generate
interrupts to cause the processor to resume execution. Sleep mode eliminates dynamic
power used by the processor itself, memory systems and related controllers, and internal
buses.
The GPDMA may operate in Sleep mode to access AHB SRAMs and peripherals with
GPDMA support, but the GPDMA cannot access the flash memory or the main SRAM,
which are disabled in order to save power.
for more
.Resumption from the Sleep mode does not need any special
Wake-up from Sleep mode will occur whenever any enabled interrupt occurs.
4.8.2Deep Sleep mode
Note: Deep Sleep mode on the LPC17xx corresponds to the Sleep mode on LPC23xx
and LPC24xx series devices. The name is changed because ARM has incorporated
portions of reduced power mode control into the Cortex-M3. LPC17x x documentation
uses the Cortex-M3 terminology where ap plicab le .
When the chip enters the Deep Sleep mode, the main oscillator is powered down, nearly
all clocks are stopped, and the DSFLAG bit in PCON is set, see Table 44
remains running and can be configured to drive the Watchdog Timer, allowing the
Watchdog to wake up the CPU. The 32 kHz RTC oscillator is not stopped and RTC
interrupts may be used as a wake-up source. The flash is left in the standby mode
allowing a quick wake-up. The PLLs are automatically turned off and disconnected. The
CCLK and USBCLK clock dividers automatically get reset to zero.
The processor state and registers, peripheral registers, and internal SRAM values are
preserved throughout Deep Sleep mode and the logic levels of chip pins remain static.
The Deep Sleep mode can be terminated and normal operation resumed by either a
Reset or certain specific interrupts that are able to function without clocks. Since all
dynamic operation of the chip is suspended, Deep Sleep mode reduces chip power
consumption to a very low value.
On the wake-up of Deep Sleep mode, if the IRC was used before entering Deep Sleep
mode, a 2-bit IRC timer starts counting and the code execution and peripherals activities
will resume after the timer expires (4 cycles). If the main external oscillator was used, the
12-bit main oscillator timer starts counting and the code execution will resume when the
timer expires (4096 cycles). The user must remember to re-configure any required PLLs
and clock dividers after the wake-up.
UM10360
Chapter 4: LPC17xx Clocking and power control
. The IRC
Wake-up from Deep Sle ep mode can be brou ght about by NM I, External Interru pts EINT0
through EINT3, GPIO interrupts, the Ethernet Wake-on-LAN interrupt, Brownout Detect,
an RTC Alarm interrupt, a Watchdog Timer timeout, a USB input pin transition (USB
activity interrupt), or a CAN input pin transition, when the related interrupt is enabled.
Wake-up will occur whenever any enabled interrupt occurs.
4.8.3Power-down mode
Power-down mode does everything that Deep Sleep mode does, but also turns off the
flash memory . Entry to Power-down mode causes the PDFLAG bit in PCON to be set, see
Table 44
before execution of code or data access in the flash memory can be accomplished.
When the chip enters Power-down mode, the IRC, the main oscillator, and all clocks are
stopped. The RTC remains running if it has been enabled and RTC interrupts may be
used to wake up the CPU. The flash is forced into Power-down mode. The PLLs are
automatically turned off and disconnected. The CCLK and USBCLK clock dividers
automatically get reset to zero.
Upon wake-up from Power-down mode, if the IRC was used before entering Power-do wn
mode, after IRC-start-up time (about 60 μs), the 2-bit IRC timer starts counting and
expiring in 4 cycles. Code execution can then be resumed immediately following the
expiration of the IRC timer if the code was running from SRAM. In the meantime, the flash
wake-up timer measures flash start-up time of about 100 μs. When it times out, access to
the flash is enabled. The user must remember to re-configure any required PLLs and
clock dividers after the wake-up.
. This saves more power, but requires waiting for resumption of flash operation
Wake-up from Power-down m ode can be brought abou t by NMI, External Interrupt s EINT0
through EINT3, GPIO interrupts, the Ethernet Wake-on-LAN interrupt, Brownout Detect,
an RTC Alarm interrupt, a USB input pin transition (USB activity inte rrupt), or a CAN in put
pin transition, when the related interrupt is enabled.
In Deep Power-down mode, power is shut off to the entire chip with the exception of the
Real-Time Clock, the RESET
Power-down mode causes the DPDFLAG bit in PCON to be set, see Table 44
To optimize power conservation, the user has the additional option of turning off or
retaining power to the 32 kHz oscillator. It is also possible to use external circuitry to turn
off power to the on-chip regulator via the V
Power-down mode.Power to the on-chip regulator must be restored before device
operation can be restarted.
Wake-up from Deep Power-down mode will occur when an external reset signal is
applied, or the RTC interrupt is enabled and an RTC interrupt is generated.
4.8.5Peripheral power control
A Power Control for Peripherals feature allows individual peripherals to be turned off if
they are not needed in the application, resulting in additional power savings. This is
detailed in the description of the PCONP register.
UM10360
Chapter 4: LPC17xx Clocking and power control
pin, the WIC, and the RTC backup registers. Entry to Deep
.
DD(REG)(3V3)
pins after entering Deep
4.8.6Register description
The Power Control function uses registers shown in Table 43. More detailed descrip tion s
follow.
Table 43.Power Control registers
NameDescriptionAccess Reset
PCONPower Control Register. This register contains
control bits that enable some reduced power
operating modes of the LPC17xx. See Table 44
PCONPPower Control for Peripherals Register. This
register contains control bits that enable and
disable individual peripheral functions, allowing
elimination of power consumption by peripherals
that are not needed.
[1]Reset Value reflects the data stored in used bits only. It does not include reserved bits content.
4.8.7Power Mode Control register (PCON - 0x400F C0C0)
Controls for some reduced power modes and other power related controls are contained
in the PCON register, as described in Table 44
Table 44.Power Mode Control register (PCON - address 0x400F C0C0) bit description
BitSymbolDescriptionReset
0PM0Power mode control bit 0. This bit controls entry to the Power-down
1PM1Power mode control bit 1. T his bit controls entry to the Deep
2BODRPM Brown-Out Reduced Power Mode. When BODRPM is 1, the
3BOGDBrown-Out Global Disable. When BOGD is 1, the Brown-Out Detect
4BORDBrown-Out Reset Disable. When BORD is 1, the BOD will not rese t
7:3-Reserved, user software should not write ones to reserved bits. The
8SMFLAGSleep Mode entry flag. Set when the Sleep mode is successfully
9DSFLAGDeep Sleep entry flag. Set when the Deep Sleep mode is successfully
10PDFLAGPower-down entry flag. Set when the Power-down mode is
11DPDFLAG Deep Power-down entry flag. Set when the Deep Power-down mode
31:12 -Reserved, user software should not write ones to reserved bits. The
UM10360
Chapter 4: LPC17xx Clocking and power control
.
mode. See Section 4.8.7.1
Power-down mode. See Section 4.8.7.1
Brown-Out Detect circuitry will be turned off when chip Power-down
mode or Deep Sleep mode is entered, resulting in a further reduction
in power usage. However, the possibility of using Brown-Out Detect as
a wake-up source from the reduced power mode will be lost.
When 0, the Brown-Out Detect function remains active during
Power-down and Deep Sleep modes.
See the System Control Block chapter for details of Brown-Out
detection.
circuitry is fully disabled at all times, and does not consume power.
When 0, the Brown-Out Detect circuitry is enabled.
See the System Control Block chapter for details of Brown-Out
detection.
the device when the V
reset trip level. The Brown-Out interrupt is not affected.
When BORD is 0, the BOD reset is enabled.
See the Section 3.5
value read from a reserved bit is not defined.
entered. Cleared by software writing a one to this bit.
entered. Cleared by software writing a one to this bit.
successfully entered. Cleared by software writing a one to this bit.
is successfully entered. Cleared by software writing a one to this bit.
value read from a reserved bit is not defined.
below for details.
below for details.
DD(REG)(3V3)
voltage dips goes below the BOD
for details of Brown-Out detection.
value
0
0
0
0
0
NA
[1][2]
0
[1][2]
0
[1][2]
0
[1][3]
0
NA
[1] Only one of these flags will be valid at a specific time.
[2] Hardware reset only for a power-up of core power or by a brownout detect event.
[3] Hardware reset only for a power-up event on Vbat.
The PM1and PM0 bits in PCON allow entering reduced power modes as needed. The
encoding of these bits allows backward compatibility with devices that previously only
supported Sleep and Power-down modes. Table 45
three reduced power modes supported by the LPC17xx.
Table 45.Encoding of reduced power mode s
PM1, PM0Description
00Execution of WFI or WFE enters either Sleep or Deep Sleep mode as defined by the
01Execution of WFI or WFE enters Power-down mode if the SLEEPDEEP bit in the
10Reserved, this setting should not be used.
11Execution of WFI or WFE enters Deep Power-down mode if the SLEEPDEEP bit in
4.8.8Wake-up from Reduced Power Modes
Any enabled interrupt can wake up the CPU from Sleep mode. Certain interrupts can
wake up the processor if it is in either Deep Sleep mode or Power-down mode.
UM10360
Chapter 4: LPC17xx Clocking and power control
below shows the encoding for the
SLEEPDEEP bit in the Cortex-M3 System Control Register.
Cortex-M3 System Control Register is 1.
the Cortex-M3 System Control Register is 1.
Interrupts that can occur during Deep Sleep or Power-down mode will wake up the CPU if
the interrupt is enabled. After wake-up, execution will continue to the appropriate interrupt
service routine. These interrupts are NMI, External Interrupt s EINT0 through EINT3, GPIO
interrupts, Ethernet Wake-on-LAN interrupt, Brownout Detect, RTC Alarm, CAN Activity
Interrupt, and USB Activity Interrupt. In addition, the watchdog timer can wake up the part
from Deep Sleep mode if the watchdog timer is being clocked by the IRC oscillator. For
the wake-up process to take place the corresponding interrupt must be enabled in the
NVIC. For pin-related peripheral functions, the related functions must also be mapped to
pins.
The CAN Activity Interrupt is generated by activity on the CAN bus pins, and the USB
Activity Interrupt is generated by activity on the USB bus pins. These interrupts are only
useful to wake up the CPU when it is on Deep Sleep or Power-down mode, when th e
peripheral functions are powered up, but not active. Typically, if these interrupts are used,
their flags should be polled just before enabling the interrupt and entering the desired
reduced power mode. This can save time and power by avoiding an immediate wake-up.
Upon wake-up, the interrupt service can turn off the related activity interrupt, do any
application specific setup, and exit to await a normal peripheral interrupt.
In Deep Power-down mode, internal power to most of the device is removed, which limits
the possibilities for waking up from this mode. Wake-up from Deep Power-down mode will
occur when an external reset signal is applied, or the RTC interrupt is enabled and an
RTC interrupt is generated.
4.8.9Power Control for Peripherals register (PCONP - 0x400F C0C4)
The PCONP register allows turning off selected peripheral functions for the purpose of
saving power. This is accomplished by gating off the clock source to the specified
peripheral blocks. A few peripheral functions cannot be turned off (i.e. the Watchdog timer,
the Pin Connect block, and the System Control block).
Some peripherals, particularly those that include analog functions, may consume power
that is not clock dependent. These peripherals may cont ain a separate d isable control that
turns off additional circuitry to reduce power. Information on peripheral specific power
saving features may be found in the chapter describing that peri pheral.
UM10360
Chapter 4: LPC17xx Clocking and power control
Each bit in PCONP controls one peripheral as shown in Table 46
.
If a peripheral control bit is 1, that peripheral is enabled. If a peripheral control bit is 0, that
peripheral’s clock is disabled (gated off) to conserve power. For example if bit 19 is 1, the
2
C1 interface is enabled. If bit 19 is 0, the I2C1 interface is disabled.
I
Important: valid read from a peripheral register and valid write to a peripheral
register is possible only if that peripheral is enabled in the PCONP register!
Table 46.Power Control for Peripherals register (PCONP - address 0x400F C0C4) bit
description
Bit SymbolDescriptionReset
value
0-Reserved.NA
1PCTIM0Timer/Counter 0 power/clock control bit.1
2PCTIM1Timer/Counter 1 power/clock control bit.1
3PCUART0UART0 power/clock control bit.1
4PCUART1UART1 power/clock control bit.1
5-Reserved.NA
6PCPWM1PWM1 power/clock control bit.1
7PCI2C0The I
8PCSPIThe SPI interface power/clock control bit.1
9PCRTCThe RTC power/clock control bit.1
10PCSSP1The SSP 1 interface power/clock control bit.1
1 1-Reserved.NA
12PCADCA/D converter (ADC) power/clock control bit.
13PCCAN1CAN Controller 1 power/clock control bit.0
14PCCAN2CAN Controller 2 power/clock control bit.0
15PCGPIOPower/clock control bit for IOCON, GPIO, and GPIO interrupts.1
16PCRITRepetitive Interrupt Timer power/clock control bit.0
17PCMCPWM Motor Control PWM0
18PCQEIQuadrature Encoder Interface power/clock control bit.0
19PCI2C1The I
20-Reserved.NA
21PCSSP0The SSP0 interface power/clock control bit.1
22PCTIM2Timer 2 power/clock control bit.0
23PCTIM3Timer 3 power/clock control bit.0
24PCUART2UART 2 power/clock control bit.0
25PCUART3UART 3 power/clock control bit.0
26PCI2C2I
2
C0 interface power/clock control bit.1
Note: Clear the PDN bit in the AD0CR before clearing this bit, and set
Table 46.Power Control for Peripherals register (PCONP - address 0x400F C0C4) bit
Bit SymbolDescriptionReset
27PCI2SI2S interface power/clock control bit.0
28-Reserved.NA
29PCGPDMAGPDMA function power/clock control bit.0
30PCENETEthernet block power/clock control bit.0
31PCUSBUSB int erface power/clock control bit.0
Note that the DAC peripheral does not have a control bit in PCONP. To enable the DAC,
its output must be selected to appear on the related pin, P0.26, by configuring the
PINSEL1 register. See Section 8.5.2 “
0x4002 C004)”.
4.8.10Power control usage notes
After every reset, the PCONP register contains the valu e th at e nables sele cted in te rfaces
and peripherals controlled by the PCONP to be enabled. Therefore, apart from proper
configuring via peripheral dedicated registers, the user’s application might have to access
the PCONP in order to start using some of the on-board peripherals.
UM10360
Chapter 4: LPC17xx Clocking and power control
description
value
Pin Function Select Register 1 (PINSEL1 -
Power saving oriented systems should have 1s in the PCONP register only in positions
that match peripherals really used in the application. All other bits, declared to be
"Reserved" or dedicated to the peripherals not used in the current application, must be
cleared to 0.
4.8.1 1 Power domains
The LPC17xx provides two independent power domains that allow the bulk of the device
to have power removed while maintaining operation of the Real Time Clock.
The VBAT pin supplies power only to the RTC domain. The RTC requires a minimum of
power to operate, which can be supplied by an external battery. Whenever the device core
power is present, that power is used to operate the RTC, causing no power drain from a
battery when main power is available.
The LPC17xx begins operation at power-up and when awakened from Power-down mode
by using the 4 MHz IRC oscillator as the clock source. This allows chip operation to begin
quickly. If the main oscillator or one or both PLLs are needed by the application, software
will need to enable these features and wait for them to stabilize before they are used as a
clock source.
When the main oscillator is initially activated, the wake-up timer allows sof twa re to ensure
that the main oscillator is fully functional before the processor uses it as a clock source
and starts to execute instructions. This is important at power-on, all types of Reset, and
whenever any of the aforementioned functions are turned off for any reason. Since the
oscillator and other functions are turned off during Power-down mode, any wake-up of the
processor from Power-down mode makes use of the Wake-up Timer.
The Wake-up Timer monitors the crystal oscillator as the means of checking whether it is
safe to begin code execution. When power is applied to the chip, or some event caused
the chip to exit Power-down mode, some time is required for the oscillator to produce a
signal of sufficient amplitude to drive the clock logic. The amount of time depends on
many factors, including the rate of V
of crystal and its electrical character ist i c s (i f a q uar tz cr ystal is used), as well as any other
external circuitry (e.g. capacitors), and the characteristics of the oscillator itself under the
existing ambient conditions.
UM10360
Chapter 4: LPC17xx Clocking and power control
DD(REG)(3V3)
ramp (in the case of power on), the type
Once a clock is detected, the Wake-up Timer counts a fixed number of clocks (4,096),
then sets the flag (OSCST AT bit in the SCS register) that indicates that the main oscillator
is ready for use. Software can then switch to the main oscillator and start any required
PLLs. Refer to the Main Oscillator description in this chapter for details.
For system test and development purposes, any one of several internal clocks may be
brought out on the CLKOUT function available on the P1.27 pin, as shown in Figure 12
Clocks that may be observed via CLKOUT are the CPU clock (cclk), the main oscillator
(osc_clk), the internal RC oscillator (irc_osc), the USB clock (usb_clk), and the RTC clock
(rtc_clk).
The CLKOUTCFG register controls the selection of the internal clock that appears on the
CLKOUT pin and allows dividing the clock by an integer value up to 16. The divider can be
used to produce a system clock that is related to one of the on-chip clocks. For most clock
sources, the division may be by 1. When the CPU clock is selected and is higher than
approximately 50 MHz, the output must be divided in order to bring the frequen cy within
the ability of the pin to switch with reasonable logic levels.
Note: The CLKOUT multiplexer is designed to switch cleanly, without glitches, between
the possible clock sources. The divider is also designed to allow changing the divide value
without glitches.
3:0CLKOUTSELSelects the clock source for the CLKOUT function.0
value
0000Selects the CPU clock as the CLKOUT source.
0001Selects the main oscillator as the CLKOUT source.
0010Selects the Internal RC oscillator as the CLKOUT source.
0011Selects the USB clock as the CLKOUT source.
0100Selects the RTC oscillator as the CLKOUT source.
others Reserved, do not use these settings.
The flash accelerator block in the LPC17xx allows maximization of the perfo rmance of the
Cortex-M3 processor when it is running code from flash memory, while also saving power.
The flash accelerator also provides speed and power improvement s for data accesses to
the flash memory.
5.2 Flash accelerator blocks
The flash accelerator is divided into several functional blocks:
• AHB-Lite bus interface, accessible by the Cortex-M3 I-code and D-code buses, as
well as by the General Purpose DMA Controller
• An array of eight 128-bit buffers
• Flash accelerator control logic, including ad dre ss com pare and fla sh co nt ro l
• A flash memory interface
Figure 13
Fig 13. Simplified block diagram of the flash accelerator showing potential bus connections
shows a simplified diagram of the flash accelerator blocks and data paths.
In the following descriptions, the term “fetch” applies to an explicit flash read request from
the CPU. “Prefetch” is used to denote a flash read of instructions beyond the current
processor fetch address.
5.2.1Flash memory bank
There is one bank of flash memory controlled by the LPC17xx flash accelerator.
Flash programming operations are not controlled by the flash accelerator, but are handled
as a separate function. A Boot ROM contains flash programming algorithms that may be
called as part of the application program, and a loader that may be run to allow
programming of the flash memory.
Since the flash memory does not allow accesses du ring pr og ra m m ing and eras e
operations, it is necessary for the flash accelerator to force the CPU to wait if a memory
access to a flash address is requested while the flash memory is busy with a
programming operation. Under some conditions, this delay could result in a Watchdog
time-out. The user will need to be aware of this possibility and take steps to insure that an
unwanted Watchdog reset doe s not ca use a system failure while programming or erasing
the flash memory.
In order to preclude the possibility of stale data being read from the flash memory, the
LPC17xx flash accelerator buffers are automatically invalidated at the beginning of any
flash programming or erase operation. Any subsequent read from a flash address will
cause a new fetch to be initiated after the flash operation has completed.
5.3 Register description
The flash accelerator is controlled by the register shown in Table 48. More detailed
descriptions follow.
T able 48. Summary of flash accelerator registers
NameDescriptionAccess Reset
FLASHCFGFlash Accelerator Configuration Register.
Chapter 5: LPC17xx Flash accelerator
Controls flash access timing. See Table 49
UM10360
Address
[1]
value
R/W0x303A 0x400F C000
.
[1] Reset Value reflects the data stored in defined bits only. It does not include reserved bits content.
Configuration bits select the flash access time, as shown in Table 49. The lower bits of
FLASHCFG control internal flash accelerator functions and should not be altered.
Following reset, flash accelerator functions are enabled and flash access timing is set to a
default value of 4 clocks.
Changing the FLASHCFG register value causes the flash accelerator to invalidate all of
the holding latches, resulting in new reads of flash information as required. This
guarantees synchronization of the flash accelerator to CPU operation.
11:0--Reserved, user software should not change these bits from the reset value.0x03A
15:12 FLASHTIMFlash access time. The value of this field plus 1 gives the number of CPU clocks used
31:16 -Reserved. The value read from a reserved bit is not defined.NA
value
0x3
for a flash access.
Warning: improper setting of this value may result in incorrect operation of the device.
0000Flash accesses use 1 CPU clock. Use for up to 20 MHz CPU clock.
0001Flash accesses use 2 CPU clocks. Use for up to 40 MHz CPU clock.
0010Flash accesses use 3 CPU clocks. Use for up to 60 MHz CPU clock.
0011Flash accesses use 4 CPU clocks. Use for up to 80 MHz CPU clock.
0100Flash accesses use 5 CPU clocks. Use for up to 100 MHz CPU clock.
Use for up to 120 Mhz for LPC1759 and LPC1769 only.
0101Flash accesses use 6 CPU clocks. This “safe” setting will work under any conditions.
Other Intended for potential future hig her speed devices.
5.5 Operation
Simply put, the flash accelerator attempts to have the next Cortex-M3 instruction that will
be needed in its latches in time to prevent CPU fetch stalls. The LPC17xx uses one bank
of flash memory. The flash accelerator includes an array of eight 128-bit buffers to store
both instructions and data in a configurable manner. Each 128-bit buffer in the array can
include four 32-bit instructions, eight 16-bit instructions or some combination of the two.
During sequential code execution, a buffer typically contains the current instruction and
the entire flash line that contains that instruction, or one flash line of data contai ning a
previously requested address. Buffers are marked according to how they are used (as
instruction or data buffers), and when they have been accessed. This information is used
to carry out the buffer replacement strategy.
The Cortex-M3 provides a separate bus for instruction access (I-code) and data access
(D-code) in the code memory space. These buses, plus the General Purpose DMA
Controllers’s master port, are arbitrated by the AHB multilaye r ma tr ix. Any acce ss to the
flash memory’s address space is presented to the flash accelerator.
If a flash instruction fetch and a flash data access from the CPU occur at the same time,
the multilayer matrix gives precedence to the data access. This is because a stalled data
access always slows down execution, while a stalled instruction fetch often does not.
When the flash data access is concluded, any flash fetch or prefetch that had been in
progress is re-initiated.
Branches and other program flow changes cause a break in the sequential flow of
instruction fetches described above. Buffer replacemen t strategy in the flash accelerator
attempts to maximize the chances that potentially reusable information is retained until it
is needed again.
If an attempt is made to write directly to the flash memory without using the normal flash
programming interface (via Boot ROM function calls), the flash accelerator generates an
error condition. The CPU treats this error as a data abort. The GPDMA handles error
conditions as described in Section 31.4.1.6.3
When an Instruction Fetch is not satisfied by existing contents of the buffer array, nor has
a prefetch been initiated for that flash line, the CPU will be stalled while a fetch is initiated
for the related 128-bit flash line. If a prefetch has been initiated but not yet comp leted, the
CPU is stalled for a shorter time since the required flash access is already in progress.
UM10360
Chapter 5: LPC17xx Flash accelerator
.
Typically, a flash prefetch is begun whenever an access is made to a just prefetched
address, or to a buffer whose immediate successor is not already in another buffer. A
prefetch in progress may be aborted by a data access, in order to minimize CPU stalls.
A prefetched flash line is latched within the flash memory, but the flash accelerator does
not capture the line in a buffer until the CPU presents an address that is contained within
the prefetched flash line. If the core presents an instruction address that is not already
buffered and is not contained in the prefetched flash line, the prefetched line will be
discarded.
Some special cases include the possibility that the CPU will request a data access to an
address already contained in an instruction buffer. In this case, the data will be read from
the buffer as if it was a data buffer. The reverse case, if the CPU requests an instruction
address that can be satisfied from an existin g data buffer, causes the instruction to be
supplied from the data buffer, and the buffer to be changed into an instruction buffer. This
causes the buffer to be handled dif ferently when the flas h accelerator is determining which
buffer is to be overwritten next.
The Nested Vectored Interrupt Controller (NVIC) is an integral part of the Cortex-M3. The
tight coupling to the CPU allows for low interrupt latency and efficient processing of late
arriving interrupts.
Refer to the Cortex-M3 User Guide Section 34.4.2
6.3 Interrupt sources
Table 50 lists the interrupt sources for each peripheral function. Each peripheral device
may have one or more interrupt lines to the Vectored Interrupt Controller. Each line may
represent more than one interrupt source, as noted.
Exception numbers relate to where entries are stored in the exception vector table.
Interrupt numbers are used in some other contexts, such as software interrupts.
In addition, the NVIC handles the Non-Maskable Interrupt (NMI). In order for NMI to
operate from an external signal, the NMI function must be connected to the relate d device
pin (P2.10 / EINT0n / NMI). When connected, a logic 1 on the pin will cause the NMI to be
processed. For details, refer to the Cortex-M3 User Guide that is an appendix to this User
Manual.
Transmit Holding Register Empty (THRE)
Rx Data Available (RDA)
Character Time-out Indicator (CTI)
End of Auto-Baud (ABEO)
Auto-Baud Time-Out (ABTO)
6220x58UART1Rx Line Status (RLS)
Transmit Holding Register Empty (THRE)
Rx Data Available (RDA)
Character Time-out Indicator (CTI)
Modem Control Change
End of Auto-Baud (ABEO)
Auto-Baud Time-Out (ABTO)
7230x5CUART 2Rx Line Status (RLS)
Transmit Holding Register Empty (THRE)
Rx Data Available (RDA)
Character Time-out Indicator (CTI)
End of Auto-Baud (ABEO)
Auto-Baud Time-Out (ABTO)
8240x60UART 3Rx Line Status (RLS)
Transmit Holding Register Empty (THRE)
Rx Data Available (RDA)
Character Time-out Indicator (CTI)
End of Auto-Baud (ABEO)
Auto-Baud Time-Out (ABTO)
22380x98ADCA/D Converter end of conversion
23390x9CBODBro w n Ou t de te ct
24400xA0USBUSB_INT_REQ_LP, USB_INT_REQ_HP, USB_INT_REQ_DMA
25410xA4CANCAN Common, CAN 0 Tx, CAN 0 Rx, CAN 1 Tx, CAN 1 Rx
26420xA8GPDMAIntStatus of DMA channel 0, IntStatus of DMA channel 1
27430xACI
28440xB0EthernetWakeupInt, SoftInt, TxDoneInt , TxF ini sh ed In t, TxErrorInt,
The Cortex-M3 incorporates a mechanism that allows remapping the interrupt vector table
to alternate locations in the memory map. This is controlled via the Vector Table Offset
Register (VTOR) contained in the Cortex-M3.
The vector table may be located anywhere within the bottom 1 GB of Cortex-M3 address
space. The vector table should be located on a 256 word (1024 byte) boundary to insure
alignment on LPC17xx family devices. Refer to Section 34.4.3.5
Guide appended to this manual for details of the Vector Table Offset feature.
ARM describes bit 29 of the VTOR (TBLOFF) as selecting a memory region, either code
or SRAM. For simplicity, this bit can be thought as simply part of the address offset since
the split between the “code” space and the “SRAM” space occurs at the location
corresponding to bit 29 in a memory address.
Examples:
To place the vector table at the beginning of the “local” static RAM, starting at address
0x1000 0000, place the value 0x1000 0000 in the VTOR register. This indicates address
0x1000 0000 in the code space, since bit 29 of the VTOR equals 0.
To place the vector table at the beginning of the AHB static RAM, starting at address
0x2007 C000, place the value 0x2007 C000 in the VTOR register. This indicates address
0x2007 C000 in the SRAM space, since bit 29 of the VTOR equals 1.
The following table summarizes the registers in the NVIC as implemented in the LPC17 xx.
The Cortex-M3 User Guide Section 34.4.2
Table 51. NVIC register map
NameDescriptionAccess Reset
ISER0 to
ISER1
ICER0 to
ICER1
ISPR0 to
ISPR1
ICPR0 to
ICPR1
IABR0 to
IABR1
IPR0 to
IPR8
STIRSoftware Trigger Interrupt Register. This register allows software to
Interrupt Set-Enable Registers. These 2 registers allow enabling
interrupts and reading back the interrupt enables for specific
peripheral functions.
Interrupt Clear-Enable Registers. These 2 registers allow disabling
interrupts and reading back the interrupt enables for specific
peripheral functions.
Interrupt Set-Pending Registers. These 2 registers allow changing
the interrupt state to pending and reading back the interrupt
pending state for specific peripheral functions.
Interrupt Clear-Pending Registers. These 2 registers allow
changing the interrupt state to not pending and reading back the
interrupt pending state for specific peripheral functions.
Interrupt Active Bit Registers. These 2 registers allow reading the
current interrupt active state for specific peripheral functions.
Interrupt Priority Registers. These 9 registers allow assigning a
priority to each interrupt. Each register contains the 5-bit priority
fields for 4 interrupts.
The ISER0 register allows enabling the first 32 peripheral interrupts, or for reading the
enabled state of those interrupts. The rema ining interrupts are enabled via the ISER1
register (Section 6.5.2
registers (Section 6.5.3
1ISE_TIMER0Timer 0 Interrupt Enable. See functional description for bit 0.
2ISE_TIMER1Timer 1. Interrupt Enable. See functional description for bit 0.
3ISE_TIMER2Timer 2 Interrupt Enable. See functional description for bit 0.
4ISE_TIMER3Timer 3 Interrupt Enable. See functional description for bit 0.
5ISE_UART0UART0 Interrupt Enable. See functional description for bit 0.
6ISE_UART1UART1 Interrupt Enable. See functional description for bit 0.
7ISE_UART2UART2 Interrupt Enable. See functional description for bit 0.
8ISE_UART3UART3 Interrupt Enable. See functional description for bit 0.
9ISE_PWMPWM1 Interrupt Enable. See functional description for bit 0.
10ISE_I2C0I
11ISE_I2C1I
12ISE_I2C2I
13ISE_SPISPI Interrupt Enable. See functional description for bit 0.
14ISE_SSP0SSP0 Interrupt Enable. See functional description for bit 0.
15ISE_SSP1SSP1 Interrupt Enable. See functional description for bit 0.
16ISE_PLL0PLL0 (Main PLL) Interrupt Enable. See functional description for bit 0.
17ISE_RTCReal Time Clock (RTC) Interrupt Enable. See functional description for bit 0.
18ISE_EINT0External Interrupt 0 Interrupt Enable . See f unctional description for bit 0.
19ISE_EINT1External Interrupt 1 Interrupt Enable . See f unctional description for bit 0.
20ISE_EINT2External Interrupt 2 Interrupt Enable . See f unctional description for bit 0.
21ISE_EINT3External Interrupt 3 Interrupt Enable . See f unctional description for bit 0.
22ISE_ADCADC Interrupt Enable. See functional description for bit 0.
23ISE_BODBOD Interrupt Enable. See functional description for bit 0.
24ISE_USBUSB Interrupt Enable. See functional description for bit 0.
25ISE_CANCAN Interrupt Enable. See functional description for bit 0.
26ISE_DMAGPDMA Interrupt Enable. See functional description for bit 0.
27ISE_I2SI
28ISE_ENETEthernet Interrupt Enable. See functional description for bit 0.
29ISE_RITRepetitive Interrupt Timer Interrupt Enable. See functional description for bit 0.
30ISE_MCPWMMotor Control PWM I nterrupt Enable. See functional description for bit 0.
31ISE_QEIQuadrature Encoder Interface Interrupt Enable. See functional description for bit 0.
Write: writing 0 has no effect, writing 1 enables the interrupt.
Read: 0 indicates that the interrupt is disabled, 1 indicates that the interrupt is enabled.
2
C0 Interrupt Enable. See functional description for bit 0.
2
C1 Interrupt Enable. See functional description for bit 0.
2
C2 Interrupt Enable. See functional description for bit 0.
2
S Interrupt Enable. See functional description for bit 0.
). Disabling interrupts is done through the ICER0 and ICER1
The ISER1 register allows enabling the second group of peripheral interrupts, or for
reading the enabled state of those interrupts. Disabling int erru pts is done throu g h the
ICER0 and ICER1 registers (Section 6.5.3
1ISE_USBACTUSB Activity Interrupt Enable. See functional description for bit 0.
2ISE_CANACTCAN Activity Interrupt Enable. See functional description for bit 0.
31:3 -Reserved, user software should not write ones to reserved bits. The value read from a reserved bit
Write: writing 0 has no effect, writing 1 enables the interrupt.
Read: 0 indicates that the interrupt is disabled, 1 indicates that the interrupt is enabled.
The ICER0 register allows disabling the first 32 peripheral interrupts, or for reading the
enabled state of those interrupts. The remaining interrupts are disabled via the ICER1
register (Section 6.5.4
registers (Section 6.5.1
1ICE_TIMER0Timer 0 Interrupt Disable. See functional description for bit 0.
2ICE_TIMER1Timer 1. Interrupt Disable. See functional description for bit 0.
3ICE_TIMER2Timer 2 Interrupt Disable. See functional description for bit 0.
4ICE_TIMER3Timer 3 Interrupt Disable. See functional description for bit 0.
5ICE_UART0UART0 Interrupt Disable. See functional description for bit 0.
6ICE_UART1UART1 Interrupt Disable. See functional description for bit 0.
7ICE_UART2UART2 Interrupt Disable. See functional description for bit 0.
8ICE_UART3UART3 Interrupt Disable. See functional description for bit 0.
9ICE_PWMPWM1 Interrupt Disable. See functional description for bit 0.
10ICE_I2C0I
11ICE_I2C1I
12ICE_I2C2I
13ICE_SPISPI Interrupt Disable. See functional description for bit 0.
14ICE_SSP0SSP0 Interrupt Disable. See functional description for bit 0.
15ICE_SSP1SSP1 Interrupt Disable. See functional description for bit 0.
16ICE_PLL0PLL0 (Main PLL) Interrupt Disable. See functional description for bit 0.
17ICE_RTCReal Time Clock (RTC) Interrupt Disable. See functional description for bit 0.
18ICE_EINT0External Interrupt 0 Interrupt Disable. See functional description for bit 0.
19ICE_EINT1External Interrupt 1 Interrupt Disable. See functional description for bit 0.
20ICE_EINT2External Interrupt 2 Interrupt Disable. See functional description for bit 0.
21ICE_EINT3External Interrupt 3 Interrupt Disable. See functional description for bit 0.
22ICE_ADCADC Interrupt Disable. See functional description for bit 0.
23ICE_BODBOD Interrupt Disable. See functional description for bit 0.
24ICE_USBUSB Interrupt Disable. See functional description for bit 0.
25ICE_CANCAN Interrupt Disable. See functional description for bit 0.
26ICE_DMAGPDMA Interrupt Disable. See functional description for bit 0.
27ICE_I2SI
28ICE_ENETEthernet Interrupt Disable. See functional description for bit 0.
29ICE_RITRepetitive Interrupt Timer Interrupt Disable. See functional description for bit 0.
30ICE_MCPWMMotor Control PWM Interrupt Disable. See functional description for bit 0.
31ICE_QEIQuadrature Encoder Interface Interrupt Disable. See functional descriptio n for bit 0.
Write: writing 0 has no effect, writing 1 disables the interrupt.
Read: 0 indicates that the interrupt is disabled, 1 indicates that the interrupt is enabled.
2
C0 Interrupt Disable. See functional description for bit 0.
2
C1 Interrupt Disable. See functional description for bit 0.
2
C2 Interrupt Disable. See functional description for bit 0.
2
S Interrupt Disable. See functional description for bit 0.
). Enabling interrupts is done through the ISER0 and ISER1
The ICER1 register allows disabling the second group of peripheral interrupts, or for
reading the enabled state of those interrupts. Enabling interru p ts is done throug h th e
ISER0 and ISER1 registers (Section 6.5.1
1ICE_USBACTUSB Activity Interrupt Disable. See functional description for bit 0.
2ICE_CANACTCAN Activity Interrupt Disable. See functional description for bit 0.
31:3 -Reserved, user software should not write ones to reserved bits. The value read from a reserved bit
Write: writing 0 has no effect, writing 1 disables the interrupt.
Read: 0 indicates that the interrupt is disabled, 1 indicates that the interrupt is enabled.
The ISPR0 register allows setting the pending state of th e first 32 pe ripher al inter rupts, or
for reading the pending state of those interrupts. The remaining interrupts can have their
pending state set via the ISPR1 register (Section 6.5.6
interrupts is done through the ICPR0 and ICPR1 registers (Section 6.5.7
1ISP_TIMER0Timer 0 Interrupt Pending set. See functional description for bit 0.
2ISP_TIMER1Timer 1. Interrupt Pending set. See functional description for bit 0.
3ISP_TIMER2Timer 2 Interrupt Pending set. See functional description for bit 0.
4ISP_TIMER3Timer 3 Interrupt Pending set. See functional description for bit 0.
5ISP_UART0UART0 Interrupt Pending set. See functional description for bit 0.
6ISP_UART1UART1 Interrupt Pending set. See functional description for bit 0.
7ISP_UART2UART2 Interrupt Pending set. See functional description for bit 0.
8ISP_UART3UART3 Interrupt Pending set. See functional description for bit 0.
9ISP_PWMPWM1 Interrupt Pending set. See functional description for bit 0.
10ISP_I2C0I
11ISP_I2C1I
12ISP_I2C2I
13ISP_SPISPI Interrupt Pending set. See functional description for bit 0.
14ISP_SSP0SSP0 Interrupt Pending set. See functional description for bit 0.
15ISP_SSP1SSP1 Interrupt Pending set. See functional description for bit 0.
16ISP_PLL0PLL0 (Main PLL) Interrupt Pending set. See functional description for bit 0.
17ISP_RTCReal Time Clock (RTC) Interrupt Pending set. See functional description for bit 0.
18ISP_EINT0External Interrupt 0 Interrupt Pendin g set. See functional description for bit 0.
19ISP_EINT1External Interrupt 1 Interrupt Pendin g set. See functional description for bit 0.
20ISP_EINT2External Interrupt 2 Interrupt Pendin g set. See functional description for bit 0.
21ISP_EINT3External Interrupt 3 Interrupt Pendin g set. See functional description for bit 0.
22ISP_ADCADC Interrupt Pending set. See functional description for bit 0.
23ISP_BODBOD Interrupt Pending set. See functional description for bit 0.
24ISP_USBUSB Interrupt Pending set. See functional description for bit 0.
25ISP_CANCAN Interrupt Pending set. See functional description for bit 0.
26ISP_DMAGPDMA Interrupt Pending set. See functional description for bit 0.
27ISP_I2SI
28ISP_ENETEthernet Interrupt Pending set. See functional description for bit 0.
29ISP_RITRepetitive Interrupt Timer Interrupt Pending set. See functional description for bit 0.
30ISP_MCPWMMotor Control PWM I nterrupt Pending set. See functional description for bit 0.
31ISP_QEIQuadrature Encoder Interface Interrupt Pending set. See functional description for bit 0.
Write: writing 0 has no effect, writing 1 changes the interrupt state to pending.
Read: 0 indicates that the interrupt is not pending, 1 indicates that the int errupt is pending.
2
C0 Interrupt Pending set. See functional description for bit 0.
2
C1 Interrupt Pending set. See functional description for bit 0.
2
C2 Interrupt Pending set. See functional description for bit 0.
2
S Interrupt Pending set. See functional description for bit 0.
The ISPR1 register allows setting the pending state of the second group of peripheral
interrupts, or for reading the pending state of those interrupts. Clearing the pending sta te
of interrupts is done through the ICPR0 and ICPR1 registers (Section 6.5.7
1ISP_USBACTUSB Activity Interrupt Pending set. See functional description for bit 0.
2ISP_CANACTCAN Activity Interrupt Pending set. See functional description for bit 0.
31:3 -Reserved, user software should not write ones to reserved bits. The value read from a reserved bit
Write: writing 0 has no effect, writing 1 changes the interrupt state to pending.
Read: 0 indicates that the interrupt is not pending, 1 indicates that the int errupt is pending.
The ICPR0 register allows clearing the pending state of the fir st 32 peripheral interrupts,
or for reading the pending state of those interrupts. The remaining interrupts can have
their pending state cleared via the ICPR1 register (Section 6.5.8
state of interrupts is done through the ISPR0 and ISPR1 registers (Section 6.5.5
Section 6.5.6
Table 58. Interrupt Clear-Pending Register 0 reg is t er (ICPR0 - 0xE000 E280)
BitNameFunction
0ICP_WDTWatchdog Timer Interrupt Pending clear.
1ICP_TIMER0Timer 0 Interrupt Pending clear. See functional description for bit 0.
2ICP_TIMER1Timer 1. Interrupt Pending clear. See functional description for bit 0.
3ICP_TIMER2Timer 2 Interrupt Pending clear. See functional description for bit 0.
4ICP_TIMER3Timer 3 Interrupt Pending clear. See functional description for bit 0.
5ICP_UART0UART0 Interrupt Pending clear. See functional description for bit 0.
6ICP_UART1UART1 Interrupt Pending clear. See functional description for bit 0.
7ICP_UART2UART2 Interrupt Pending clear. See functional description for bit 0.
8ICP_UART3UART3 Interrupt Pending clear. See functional description for bit 0.
9ICP_PWMPWM1 Interrupt Pending clear. See functional description for bit 0.
10ICP_I2C0I
11ICP_I2C1I
12ICP_I2C2I
13ICP_SPISPI Interrupt Pending clear. See functional description for bit 0.
14ICP_SSP0SSP0 Interrupt Pending clear. See functional description for bit 0.
15ICP_SSP1SSP1 Interrupt Pending clear. See functional description for bit 0.
16ICP_PLL0PLL0 (Main PLL) Interrupt Pending clear. See functional description for bit 0.
17ICP_RTCReal Time Clock (RTC) Interrupt Pending clear. See functional description for bit 0.
18ICP_EINT0External Interrupt 0 Interrupt Pending clear. See functional description for bit 0.
19ICP_EINT1External Interrupt 1 Interrupt Pending clear. See functional description for bit 0.
20ICP_EINT2External Interrupt 2 Interrupt Pending clear. See functional description for bit 0.
21ICP_EINT3External Interrupt 3 Interrupt Pending clear. See functional description for bit 0.
22ICP_ADCADC Interrupt Pending clear. See functional description for bit 0.
23ICP_BODBOD Interrupt Pending clear. See functional description for bit 0.
24ICP_USBUSB Interrupt Pending clear. See functional description for bit 0.
25ICP_CANCAN Interrupt Pending clear. See functional description for bit 0.
26ICP_DMAGPDMA Interrupt Pending clear. See functional description for bit 0.
27ICP_I2SI
28ICP_ENETEthernet Interrupt Pending clear. See functional description for bit 0.
29ICP_RITRepetitive Interrupt Timer Interrupt Pending clear. See functional description for bit 0.
30ICP_MCPWMMotor Control PWM Interrupt Pending clear. See functional description for bit 0.
31ICP_QEIQuadrature Encoder Interface Interrupt Pending clear. See functional description for bit 0.
Write: writing 0 has no effect, writing 1 changes the interrupt state to not pending.
Read: 0 indicates that the interrupt is not pending, 1 indicates that the int errupt is pending.
2
C0 Interrupt Pending clear. See functional description for bit 0.
2
C1 Interrupt Pending clear. See functional description for bit 0.
2
C2 Interrupt Pending clear. See functional description for bit 0.
2
S Interrupt Pending clear. See functional description for bit 0.
The ICPR1 register allows clearing the pending state of the second group of peripheral
interrupts, or for reading the p ending st ate of those interrupt s. Setting the pe nding st ate of
interrupts is done through the ISPR0 and ISPR1 registers (Section 6.5.5
1ICP_USBACTUSB Activity Interrupt Pending clear. See functional description for bit 0.
2ICP_CANACTCAN Activity Interrupt Pending clear. See functional description for bit 0.
31:3 -Reserved, user software should not write ones to reserved bits. The value read from a reserved bit
Write: writing 0 has no effect, writing 1 changes the interrupt state to not pending.
Read: 0 indicates that the interrupt is not pending, 1 indicates that the int errupt is pending.
6.5.9Interrupt Active Bit Register 0 (IABR0 - 0xE000 E300)
The IABR0 register is a read-only register that allows reading the active state of the first
32 peripheral interrupts. This allows determining which peripherals are asserting an
interrupt to the NVIC, and may also be pending if there are enabled. The remaining
interrupts can have their active state read via the IABR1 register (Section 6.5.10
Table 60. Interrupt Active Bit Register 0 (IABR0 - 0xE000 E300)
BitNameFunction
0IAB_WDTWatchdog Timer Interrupt Active.
1IAB_TIMER0Timer 0 Interrupt Active. See functional description for bit 0.
2IAB_TIMER1Timer 1. Interrupt Active. See functional description for bit 0.
3IAB_TIMER2Timer 2 Interrupt Active. See functional description for bit 0.
4IAB_TIMER3Timer 3 Interrupt Active. See functional description for bit 0.
5IAB_UART0UART0 Interrupt Active. See functional description for bit 0.
6IAB_UART1UART1 Interrupt Active. See functional description for bit 0.
7IAB_UART2UART2 Interrupt Active. See functional description for bit 0.
8IAB_UART3UART3 Interrupt Active. See functional description for bit 0.
9IAB_PWMPWM1 Interrupt Active. See functional description for bit 0.
10IAB_I2C0I
11IAB_I2C1I
12IAB_I2C2I
13IAB_SPISPI Interrupt Active. See functional description for bit 0.
14IAB_SSP0SSP0 Interrupt Active. See functional description for bit 0.
15IAB_SSP1SSP1 Interrupt Active. See functional description for bit 0.
16IAB_PLL0PLL0 (Main PLL) Interrupt Active. See functional description for bit 0.
17IAB_RTCReal Time Clock (RTC) Interrupt Active. See functional description for bit 0.
18IAB_EINT0External Interrupt 0 Interrupt Active. See functional description for bit 0.
19IAB_EINT1External Interrupt 1 Interrupt Active. See functional description for bit 0.
20IAB_EINT2External Interrupt 2 Interrupt Active. See functional description for bit 0.
21IAB_EINT3External Interrupt 3 Interrupt Active. See functional description for bit 0.
22IAB_ADCADC Interrupt Active. See functional description for bit 0.
23IAB_BODBOD Interrupt Active. See functional description for bit 0.
24IAB_USBUSB Interrupt Active. See functional description for bit 0.
25IAB_CANCAN Interrupt Active. See functional description fo r bit 0.
26IAB_DMAGPDMA Interrupt Active. See functional description for bit 0.
27IAB_I2SI
28IAB_ENETEthernet Interrupt Active. See functional description for bit 0.
29IAB_RITRepetitive Interrupt Timer Interrupt Active. See functional description for bit 0.
30IAB_MCPWMMotor Control PWM I nt errupt Active. See functional description for bit 0.
31IAB_QEIQuadratu re Enco d er In te rfa ce Int er rup t Active. See functional description for bit 0.
Read: 0 indicates that the interrupt is not active, 1 indicates that the interrupt is active.
2
C0 Interrupt Active. See functional description for bit 0.
2
C1 Interrupt Active. See functional description for bit 0.
2
C2 Interrupt Active. See functional description for bit 0.
2
S Interrupt Active. See functional description for bit 0.
6.5.10Interrupt Active Bit Register 1 (IABR1 - 0xE000 E304)
The IABR1 register is a read-only register that allows reading the active state of the
second group of peripheral interrupts. This allows determining which peripherals are
asserting an interrupt to the NVIC, and may also be pen d ing if ther e ar e en a bled.
Table 61. Interrupt Active Bit Register 1 (IABR1 - 0xE000 E304)
BitNameFunction
0IAB_PLL1PLL1 (USB PLL) Interrupt Active.
1IAB_USBACTUSB Activity Interrupt Active. See functional description for bit 0.
2IAB_CANACTCAN Activity Interrupt Active. See functional description for bit 0.
31:3 -Reserved, user software should not write ones to reserved bits. The value read from a reserved bit
Read: 0 indicates that the interrupt is not active, 1 indicates that the interrupt is active.
The IPR0 register controls the priority of the first 4 periphera l interrupts. Each interr upt can
have one of 32 priorities, where 0 is the highest priority.
The IPR1 register controls the priority of the second group of 4 peripheral inter rupts. Each
interrupt can have one of 32 priorities, where 0 is the highest priority.
The IPR2 register controls the priority of the third group of 4 peripheral interrupts. Each
interrupt can have one of 32 priorities, where 0 is the highest priority.
The IPR3 register controls the priority of the fourth group of 4 peripheral interrupts. Each
interrupt can have one of 32 priorities, where 0 is the highest priority.
2:0UnimplementedThese bits ignore writes, and read as 0.
7:3IP_I2C2I
10:8UnimplementedThese bits ignore writes, and read as 0.
15:11 IP_SPISPI Interrupt Priority. See functional description for bits 7-3.
18:16 UnimplementedThese bits ignore writes, and read as 0.
23:19 IP_SSP0SSP0 Interrupt Priority. See functional description for bits 7-3.
26:24 UnimplementedThese bits ignore writes, and read as 0.
31:27 IP_SSP1SSP1 Interrupt Priority. See functional description for bits 7-3.
The IPR4 register controls the priority of the fifth group of 4 peripheral interrupts. Each
interrupt can have one of 32 priorities, where 0 is the highest priority.
The IPR5 register controls the priority of the sixth group of 4 peripheral interrupts. Each
interrupt can have one of 32 priorities, where 0 is the highest priority.
The IPR6 register controls the priority of the seventh group of 4 peripheral interrupts. Each
interrupt can have one of 32 priorities, where 0 is the highest priority.
The IPR7 register controls the priority of the eighth group of 4 peripheral interrupts. Each
interrupt can have one of 32 priorities, where 0 is the highest priority.
The IPR8 register controls the priority of the ninth and last group of 4 peripheral interrupts.
Each interrupt can have one of 32 priorities, where 0 is the highest priority.
The STIR register provides an alternate way for software to generate an interrupt, in
addition to using the ISPR registers. This mechanism can only be used to generate
peripheral interrupts, not system exceptions.
By default, only privileged software can write to the STIR register. Unprivileged software
can be given this ability if privileged software sets the USERSETMPEND bit in the CCR
register (see Section 34.4.3.8
I/O pins on the LPC17xx are 5V tolerant and have input hysteresis unless indicated in the
table below. Crystal pins, power pins, and reference voltage pins are not 5V tolerant. In
addition, when pins are selected to be A to D converter inputs, they are no longer 5V
tolerant and must be limited to the voltage at the ADC positive reference pin (
DTR1 — Data Terminal Ready output for UART1. Can also be configured
to be an RS-485/EIA-485 output enable signal.
SCL1 — I
I/O
pad, see Section 19.1
2
C1 clock input/output (this pin does not use a specialized I2C
for details).
-I/OP0[21] — General purpose digital input/output pin.
I
RI1 — Ring Indicator input for UART1.
I
RD1 — CAN1 receiver input.
P0[22] — General purpose digital input/output pin.
O
RTS1 — Request to Send output for UART1. Can also be configured to be
an RS-485/EIA-485 output enable signal.
O
TD1 — CAN1 transmitter output.
P0[23] — General purpose digital input/output pin. When configured as an
ADC input, digital section of the pad is disabled.
AD0[0] — A/D converter 0, input 0.
I
I/O
I2SRX_CLK — Receive Clock. It is driven by the master and received by
the slave. Corresponds to the signal SCK in the
I
CAP3[0] — Capture input for Timer 3, channel 0.
P0[24] — General purpose digital input/output pin. When configured as an
ADC input, digital section of the pad is disabled.
I
AD0[1] — A/D converter 0, input 1.
I/O
I2SRX_WS — Receive Word Select. It is driven by the master and
received by the slave. Corresponds to the signal WS in the
specification.
I
CAP3[1] — Capture input for Timer 3, channel 1.
P0[25] — General purpose digital input/output pin. When configured as an
ADC input, digital section of the pad is disabled.
I
AD0[2] — A/D converter 0, input 2.
I/O
I2SRX_SDA — Receive data. It is driven by the transmitter and read by
the receiver. Corresponds to the signal SD in the
O
TXD3 — Transmitter output for UART3.
P0[26] — General purpose digital input/output pin. When configured as an
ADC input or DAC output, the digital section of the pad is disabled.
I
AD0[3] — A/D converter 0, input 3.
O
AOUT — D/A converter output.
I
RXD3 — Receiver input for UART3.
P0[27] — General purpose digital input/output pin. Open-drain 5 V tolerant
2
digital I/O pad, compatible with I
C-bus specifications for 100 kHz standard
mode, 400 kHz Fast Mode, and 1 MHz Fast Mode Plus. This pad requires
an external pull-up to provide output functionality. When power is switched
2
off, this pin connected to the I
2
C lines. Open-drain configuration applies to all functions on this pin.
I
I/O
SDA0 — I
Section 19.1
I/O
USB_SDA — USB port I
2
C0 data input/output (this pin uses a specialized I2C pad, see
for details).
C-bus is floating and does not disturb the
2
C serial data (OTG transceiver).
I2S bus specification.
I2S bus
I2S bus specification.
NXP Semiconductors
Table 73. Pin description …continued
SymbolLQFP
100
P0[28] / SCL0 /
24-I/OP0[28] — General purpose digital input/output pin. Open-drain 5 V tolerant
USB_SCL
P0[29] / USB_D
P0[30] / USB_D
+2922I/OP0[29] — General purpose digital input/output pin. Pad provides digital I/O
−3023I/OP0[30] — General purpose digital input/output pin. Pad provides digital I/O
P1[0] to P1[31]I/O
P1[0] /
9576I/O
ENET_TXD0
P1[1] /
9475I/O
ENET_TXD1
P1[4] /
9374I/O
ENET_TX_EN
P1[8] /
9273I/O
ENET_CRS
P1[9] /
9172I/O
ENET_RXD0
P1[10] /
9071I/O
ENET_RXD1
P1[14] /
8970I/O
ENET_RX_ER
P1[15] /
8869I/O
ENET_REF_CLK
P1[16] /
87-I/O
ENET_MDC
P1[17] /
86
ENET_MDIO
LQFP 80Type Description
I/O
I/O
I/O
I/O
O
O
O
I
I
I
I
I
O
-I/OP1[17] — General purpose digital input/output pin.
I/O
UM10360
Chapter 7: LPC17xx Pin configuration
2
digital I/O pad, compatible with I
mode, 400 kHz Fast Mode, and 1 MHz Fast Mode Plus. This pad requires
an external pull-up to provide output functionality. When power is switched
off, this pin connected to the I
2
C lines. Open-drain configuration applies to all functions on this pin.
I
SCL0 — I
Section 19.1
USB_SCL — USB port I
2
C0 clock input/output (this pin uses a specialized I2C pad, see
for details).
2
and USB functions. It is designed in accordance with the USB
specification, revision 2.0 (Full-speed and Low-speed mode only).
USB_D+ — USB bidirectional D+ line.
and USB functions. It is designed in accordance with the USB
specification, revision 2.0 (Full-speed and Low-speed mode only).
USB_D− — USB bidirectional D− line.
Port 1: Port 1 is a 32-bit I/O port with individual direction controls for each
bit. The operation of port 1 pins depends upon the pin function selected via
the pin connect block. Pins 2, 3, 5, 6, 7, 11, 12, and 13 of this port are not
available.
P1[0] — General purpose digital input/output pin.
ENET_TXD0 — Ethernet transmit data 0.
P1[1] — General purpose digital input/output pin.
ENET_TXD1 — Ethernet transmit data 1.
P1[4] — General purpose digital input/output pin.
ENET_TX_EN — Ethernet transmit data enable.
P1[8] — General purpose digital input/output pin.
ENET_CRS — Ethernet carrier sense.
P1[9] — General purpose digital input/output pin.
ENET_RXD0 — Ethernet receive data.
P1[10] — General purpose digital input/output pin.
ENET_RXD1 — Ethernet receive data.
P1[14] — General purpose digital input/output pin.
ENET_RX_ER — Ethernet receive error.
P1[15] — General purpose digital input/output pin.
ENET_REF_CLK — Ethernet reference clock.
P1[16] — General purpose digital input/output pin.
ENET_MDC — Ethernet MIIM clock.
2118I/OP1[30] — General purpose digital input/output pin. When configured as an
2017I/O
7560I/O
7459I/O
7358I/O
7055I/O
LQFP 80Type Description
-I/OP1[27] — General purpose digital input/output pin.
O
I
I
O
I
O
O
I
O
I
I
I/O
I
O
O
O
I
O
I
O
O
I
O
UM10360
Chapter 7: LPC17xx Pin configuration
CLKOUT — Clock output pin.
USB_OVRCR — USB port Over-Current status.
CAP0[1] — Capture input for Timer 0, channel 1.
P1[28] — General purpose digital input/output pin.
MCOA2 — Motor control PWM channel 2, output A.
PCAP1[0] — Capture input for PWM1, channel 0.
MAT0[0] — Match output for Timer 0, channel 0.
P1[29] — General purpose digital input/output pin.
MCOB2 — Motor control PWM channel 2, output B.
PCAP1[1] — Capture input for PWM1, channel 1.
MAT0[1] — Match output for Timer 0, channel 0.
ADC input, digital section of the pad is disabled.
V
— Monitors the presence of USB bus power.
BUS
Note: This signal must be HIGH for USB reset to occur.
AD0[4] — A/D converter 0, input 4.
P1[31] — General purpose digital input/output pin. When configured as an
ADC input, digital section of the pad is disabled.
SCK1 — Serial Clock for SSP1.
AD0[5] — A/D converter 0, input 5.
Port 2: Port 2 is a 32-bit I/O port with individual direction controls for each
bit. The operation of port 2 pins depends upon the pin function selected via
the pin connect block. Pins 14 through 31 of this port are not available.
P2[0] — General purpose digital input/output pin.
PWM1[1] — Pulse Width Modulator 1, channel 1 output.
TXD1 — Transmitter output for UART1.
P2[1] — General purpose digital input/output pin.
PWM1[2] — Pulse Width Modulator 1, channel 2 output.
RXD1 — Receiver input for UART1.
P2[2] — General purpose digital input/output pin.
PWM1[3] — Pulse Width Modulator 1, channel 3 output.
CTS1 — Clear to Send input for UART1.
TRACEDATA[3] — Trace data, bit 3.
P2[3] — General purpose digital input/output pin.
PWM1[4] — Pulse Width Modulator 1, channel 4 output.
DCD1 — Data Carrier Detect input for UART1.
TRACEDATA[2] — Trace data, bit 2.