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: