The LPC82x are an ARM Cortex-M0+ based, low-cost 32-bit MCU family operating at
CPU frequencies of up to 30 MHz. The LPC82x support up to 32 KB of flash memory and
8 KB of SRAM.
2
The peripheral complement of the LPC82x includes a CRC engine, four I
interfaces, up to three USARTs, up to two SPI interfaces, one multi-rate timer,
self-wake-up timer, and state-configurable timer with PWM function (SCTimer/PWM), a
DMA, one 12-bit ADC and one analog comp arator, function-configurable I/O port s through
a switch matrix, an input pattern match engine, and up to 29 general-purpose I/O pins.
C-bus
1.2 Features
Remark: For additional documentation, see Section 35.2 “References”
.
• System:
– ARM Cortex-M0+ processor (revision r0p1), running at frequencies of up to
30 MHz with single-cycle multiplier and fast single-cycle I/O port.
– ARM Cortex-M0+ built-in Nested Vectored Interrupt Controller (NVIC).
– System tick timer.
– AHB multilayer matrix.
– Serial Wire Debug (SWD) with four break points and two watch points. JTAG
boundary scan (BSDL) supported.
– Micro Trace Buffer (MTB)
• Memory:
– Up to 32 KB on-chip flash programming memory with 64 Byte page write and
erase. Code Read Protection (CRP) supported.
– 8 KB SRAM.
• ROM API support:
– bootloader.
– On-chip ROM APIs for ADC, SPI, I2C, USART, power configuration (power
profiles) and integer divide.
– Flash In-A pp licatio n Pro gr a mm in g (IAP ) an d In- Sys te m Pro gr a mmin g (ISP).
• Digital peripherals:
– High-spe e d GPI O in te r fac e co nn ec te d to the ARM Cort ex -M 0 + IO bu s wit h up t o
32 General-Purpose I/O (GPIO) pins with configurable pull-up/pull-down resistors,
programmable open-drain mode, input inverter, and glitch filter. GPIO direction
control supports independent set/clear/toggle of individual bits.
– High-current source output driver (20 mA) on four pins.
– High-current sink driver (20 mA) on two true open-drain pins.
– GPIO interrupt generation capability with boolean pattern-matching feature on
eight GPIO inputs.
– Switch matrix for flexible configuration of each I/O pin function.
– CRC engine.
– DMA with 18 channels and 9 trigger inputs.
UM10800
• Timers:
– State Configurable Timer (SCTimer/PWM) with input and output functions
(including capture and match) for timing and PWM applica tio ns .
– Four channel Multi-Rate Timer (MRT) for repetitive interrupt generation at up to
four programmable, fixed rates.
– Self-Wake-up Timer (WKT) clocked from either the IRC, a low-power,
low-frequency internal oscillator, or an external clock input in the always-on power
domain.
– Windowed Watchdog timer (WWDT).
• Analog peripherals:
– One 12-bit ADC with up to 12 input channels with multiple internal and external
trigger inputs and with sample rates of up to 1.2 Msamples/s. The ADC supports
two independent conversion sequences.
– Comparator with four input pins and external or internal reference voltage.
• Serial peripherals:
– Three USART interfaces with pin functions assigned through the switch matrix and
one common fractional baud rate generator.
– Two SPI controllers with pin functions assigned through the switch matrix.
2
– Four I
on two true open-drain pins and listen mode. Three I2Cs support data rates up to
400 kbit/s on standard digital pins.
C-bus interfaces. One I2C supports Fast-mode plus with 1 Mbit/s data rates
• Clock generation:
– 12 MHz internal RC oscillator trimmed to 1.5 % accuracy that can optionally be
used as a system clock.
– Crystal oscillator with an operating range of 1 MHz to 25 MHz.
– Programmable watchdog oscillator with a frequency range of 9.4 kHz to 2.3 MHz.
– PLL allows CPU operation up to the maximum CPU rate without the need for a
high-frequency crystal. May be run from the system oscillator, the external clock
input, or the internal RC oscillator.
– Clock output function with divider that can reflect all internal clock sources.
• Power control:
– Integrated PMU (Power Management Unit) to minimize power consumption.
– Reduced power modes: Sleep mode, Deep-sleep mode, Power-down mode, and
Deep power-down mode.
– Wake-up from Deep-sleep and Power-down modes on activity on USART, SPI,
and I2C peripherals.
– Timer-controlled self-wake-up from Deep power-down mode.
– Power-On Reset (POR).
The ARM Cortex-M0+ core runs at an operating frequency of up to 30 MHz. Integrated in
the core are the NVIC and Serial Wire Debug with four breakpoints and two watch points.
The ARM Cortex-M0+ core supports a single-cycle I/O enabled port (IOP) for fast GPIO
access at address 0xA000 0000. The ARM Cortex M0+ core version is r0p1.
The core includes a single-cycle multiplier and a system tick timer (SysTick).
The memory mapping is identical for all LPC82x parts. Different LPC82x parts support
different flash and SRAM memory sizes.
2.2 General description
The LPC82x incorporates several distinct memory regions. Figure 2 shows the overall
map of the entire address space from the user program viewpoint following reset.
The APB peripheral area is 512 KB in size and is divided to allow for up to 32 peripher als.
Each peripheral is allocated 16 KB of space simplifying the address decoding.
The registers incorporated into the ARM Cortex-M0+ core, such as NVIC, SysTick, and
sleep mode control, are located on the private pe rip h er al bus.
The GPIO port and pin interrupt/pattern match registers are accessed by the ARM
Cortex-M0+ single-cycle I/O enabled port (IOP).
• Contains the bootloader with In-System Programming (ISP) facility and the following
APIs:
– In-Application Programming (IAP) of flash memory
– Power profiles for optimizing power consumption and system performance
– USART driver
– ADC driver
– SPI driver
– I2C driver
– Integer divide routines
3.3 Basic configuration
The clock to the ROM is enabled by default. No configuration is required to use the ROM
APIs.
3.4 Pin description
When the ISP entry pin is pulled LOW on reset, the part enters ISP mode and the ISP
command handler starts up. In ISP mode, pin PIO0_0 is connected to function U0_RXD
and pin PIO0_4 is connected to function U0_TXD on the USART0 block.
Table 3.Pin location in ISP mode
ISP entry pinUSART RXDUSART TXD
PIO0_12PIO0_0PIO0_4
3.5 General description
3.5.1Bootloader
The bootloader controls initial operation after reset and also provides the means to
accomplish programming of the flash memory via USART. This could be initial
programming of a blank device, erasure and re-programming of a previously programmed
device, or programming of the flash memory by the application program in a running
system.
The bootloader code is executed every time the part is powered on or reset. The
bootloader can execute the ISP command handler or the user application code. A LOW
level after reset at the ISP entry pin is consider ed as an external ha rdware requ est to st art
the ISP command handler via USART.
UM10800
Chapter 3: LPC82x Boot ROM
For details on the boot process, see Section 3.6.2 “Remark: SRAM location 0x1000 0000 to 0x1000 0050 is not used by the bootloader and
the memory content in this area is retained during reset. SRAM memory is not retained
when the part powers down or enters Deep power-down mode.
Assuming that power supply pins are at their nominal levels when the rising edge on
RESET
the decision whether to continue with user code or ISP handler is made. The bootloader
performs the following steps (see Figure 4
Remark: The sampling of pin the ISP entry pin can be disabled through programming
flash location 0x0000 02FC (see Section 25.5.3 “
pin is generated, it may take up to 3 ms before the ISP entry pin is sampled and
1. If the watchdog overflow flag is set, the bootloader checks whether a valid user code
is present. If the watchdog overflow flag is not set, the ISP entry pin is checked.
2. If there is no request for the ISP command handler execution (ISP entry pin is
sampled HIGH after reset), a search is made for a valid user program.
3. If a valid user program is found then th e exec ution contr ol is transferred to it. If a valid
user program is not found, the bootloader attempts to load a valid user program via
the USART interface.
3.5.2ROM-based APIs
Boot process”.
):
Code Read Protection (CRP)”).
Once the part has booted, the user can access several APIs located in the boot ROM to
access the flash memory, optimize power consumption, and operate the USART and I2C
peripherals.
The structure of the boot ROM APIs is shown in Figure 3
The boot rom structure should be included as follows:
typedef struct {
} LPC_ROM_API_T;
#define ROM_DRIVER_BASE (0x1FFF1FF8UL)
Table 4.API calls
API DescriptionReference
Flash IAPFlash In-Application programmingTable 330
Power profiles APIConfigure system clock and power consumptionTable 343
Integer divide routines32-bit integer divide routinesTable 399
I2C driverI2C ROM driverTable 364
SPI driver SPI ROM driverTable 356
ADC driverADC ROM driverTable 385
UART driverUSART ROM driverTable 346
UM10800
Chapter 3: LPC82x Boot ROM
const uint32_t reserved0; /*!< Reserved */
const uint32_t reserved1; /*!< Reserved */
const uint32_t reserved2; /*!< Reserved */
const PWRD_API_T *pPWRD; /*!< Power API function table base address */
const ROM_DIV_API_T *divApiBase; /*!< Divider API function table base address */
const I2CD_API_T *pI2CD;/*!< I2C driver routines functions table */
const uint32_t reserved5; /*!< Reserved */
const SPID_API_T *pSPID; /*!< SPI driver API function table base address */
const ADCD_API_T *pADCD; /*!< ADC driver API function table base address */
const UARTD_API_T *pUARTD; /*!< USART driver API function table base address */
3.6 Functional description
3.6.1Memory map after any reset
The boot block is 12 KB in size. The boot block is located in the memory region starting
from the address 0x1FFF 0000. The bootloader is designed to run from this memory area,
but both the ISP and IAP software use parts of the on-chip RAM. The RAM usage is
described in Section 25.7.2 “
vectors residing in the boot block of the on-chip flash memory also become active after
reset, i.e., the bottom 512 bytes of the boot block are also visible in the memory region
starting from the address 0x0000 0000.
3.6.2Boot process
During the boot process, the bootloader checks if there is valid user code in flash. The
criterion for valid user code is as follows:
The reserved Cortex-M0+ exception vector location 7 (offset 0x0000 001C in the vector
table) should contain the 2’s complement of the check-sum of table entries 0 through 6.
This causes the checksum of the first 8 table entries to be 0. The bootloader code
checksums the first 8 locations in sector 0 of the flash. If the result is 0, then execution
control is transferred to the user code.
Memory and interrupt use for ISP and IAP”. The interrupt
If the signature is not valid, the auto-baud routine synchronizes with the host via serial po rt
USART0. The host should send a ’?’ (0x3F) as a synchronization character and wait for a
response. The host side serial port settings should be 8 data bits, 1 stop bit and no parity.
The auto-baud routine measures the bit time of the received synchronizatio n character in
terms of its own frequency (the 12 MHz IRC frequency) and programs the baud rate
generator of the serial port. It also sends an ASCII string ("Synchronized<CR><LF>") to
the host. In response, the host should send the same string ("Synchronized<CR><LF>").
The bootloader auto-baud routine looks at the received characters to verify
synchronization. If synchronization is verified then "OK<CR><LF>" string is sent to the
host. The host should respond by sending the crysta l fr equen cy ( in kHz) at which th e part
is running. The response is required for backward compatibility of the bootloader code
and, on the LPC800, is ignored. The bootloader configures the part to run at the 12 MHz
IRC frequency.
Once the crystal frequency response is received, the part is initialized and the ISP
command handler is invoked. For safety reasons an "Unlock" command is required be fore
executing the commands resulting in flash erase/write operations and the "Go" command.
The rest of the commands can be executed without the unlock command. The Unlock
command is required to be executed once per ISP session. The Unlock command is
explained in Table 313 “
(1) The boot-code is implementing auto-baud in software.
(2) This step is included for backward compatibility and the response is ignored by the bootloader.
• Controls system exceptions and peripheral interrupts.
• The NVIC supports 32 vectored interrupts.
• Four programmable interrupt priority levels with hardware priority level masking.
• Software interrupt generation using the ARM exceptions SVCall and PendSV (see
Ref. 3
).
• Support for NMI.
• ARM Cortex M0+ Vector table offset register VTOR implemented.
4.3 General description
The Nested Vecto red Interrupt Controller (NVIC) is an integral p art of the Cortex-M0+. The
tight coupling to the CPU allows for low interrupt latency and efficient processing of late
arriving interrupts.
4.3.1Interrupt sources
Table 5 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. Interrupts with the same priority level are
serviced in the order of their interrupt number.
See Ref. 3
Table 5.Connection of interrupt sources to the NVIC
Interrupt
number
0SPI0_IRQSPI0 interruptSee Table 193 “
1SPI1_IRQSPI1 interruptSame as SPI0_IRQ
2-Reserved3UART0_IRQUSART0 interruptSee Table 179 “
NameDescriptionFlags
for a detailed description of the NVIC and the NVIC register description.
SPI Interrupt Enable read and Set
register (INTENSET, addresses 0x4005 800C (SPI0),
0x4005 C00C (SPI1)) bit description”.
USART Interrupt Enable read and set
register (INTENSET, address 0x4006 400C (USART0),
0x4006 800C (USART1), 0x4006C00C (USART2)) bit
description”
Table 5.Connection of interrupt sources to the NVIC
Interrupt
number
26PININT2_IRQPin interrupt 2 or pattern
27PININT3_IRQPin interrupt 3 or pattern
28PININT4_IRQPin interrupt 4 or pattern
29PININT5_IRQPin interrupt 5 or pattern
30PININT6_IRQPin interrupt 6 or pattern
31PININT7_IRQPin interrupt 7 or pattern
NameDescriptionFlags
match engine slice 2
interrupt
match engine slice 3
interrupt
match engine slice 4
interrupt
match engine slice 5
interrupt
match engine slice 6
interrupt
match engine slice 7
interrupt
UM10800
PSTAT - pin interrupt status
PSTAT - pin interrupt status
PSTAT - pin interrupt status
PSTAT - pin interrupt status
PSTAT - pin interrupt status
PSTAT - pin interrupt status
4.3.2Non-Maskable Interrupt (NMI)
The part supports the NMI, which can be triggered by an peripheral interrupt or triggered
by software. The NMI has the highest priority exception other than the reset.
You can set up any peripheral interrupt listed in Table 5
register in the SYSCON block (Table 48
NMI exception and normal interrupt, disable the interr upt in the NVIC when you configure
it as NMI.
4.3.3Vector table offset
The vector table contains the reset value of the st ack pointer and the start addresses, also
called exception vectors, for all exception handlers. On system reset, the vector table is
located at address 0x0000 0000. Software can write to the VTOR register in the NVIC to
relocate the vector table start address to a different memory location. For a description of
the VTOR register, see the ARM Cortex-M0+ documentation (Ref. 3
as NMI using the NMISRC
). To avoid using the same peripheral interrupt as
The ISER0 register allows to enable peripheral interrupts or to read the enabled state of
those interrupts. Disable interrupts through the ICER0 (Section 4.4.2
The bit description is as follows for all bits in this register:
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.
Table 7.Interrupt Set Enable Register 0 register (ISER0, address 0xE000 E100) bit
The ICER0 register allows disabling the peripheral interrupts, or for reading the enabled
state of those interrupts. Enable interrupts through the ISER0 registers (Section 4.4.1
The bit description is as follows for all bits in this register:
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 the per iph er al int er ru pts, or for
reading the pending state of those interrupt s. Clear the pending state of interrupts thr ough
the ICPR0 registers (Section 4.4.4
The bit description is as follows for all bits in this register:
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 interrupt is
pending.
Table 9.Interrupt set pending register 0 register (ISPR0, address 0xE000 E200) bit
The ICPR0 register allows clearing the pending state of the peripheral interrupts, or for
reading the pending state of those interrupts. Set the pend in g state of inter ru p ts through
the ISPR0 register (Section 4.4.3
The bit description is as follows for all bits in this register:
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 interrupt is
The IABR0 register is a read-only register that allows reading the active state of the
peripheral interrupts. Use this register to determine which peripherals are asserting an
interrupt to the NVIC and may also be pending if there ar e en a ble d.
The system configuration block is identical for all LPC820 parts.
5.2 Features
• Clock control
– Configure the system PLL.
– Configure system oscillator and watchdog oscillator.
– Enable clocks to individual peripherals and memories.
– Configure clock output.
– Configure clock dividers, digital filter clock, and USART baud rate clock.
• Monitor and release reset to individual peripherals.
• Select pins for external pin interrupts and pattern match engine.
• Configuration of reduced power modes.
• Wake-up control.
• BOD configuration.
• MTB trace start and stop.
• Interrupt latency control.
• Select a source for the NMI.
• Calibrate system tick timer.
5.3 Basic configuration
Configure the SYSCON block as follows:
• The SYSCON uses the CLKIN, CLKOUT, RESET, and XTALIN/OUT pins. Configure
the pin functions through the switch matrix. See Section 5.4
• No clock configuration is needed. The clock to the SYSCON block is always enabled.
By default, the SYSCON block is clocked by the IRC.
5.3.1Set up the PLL
The PLL creates a stable output clock at a higher frequency than the input clock. If you
need a main clock with a frequency higher than the 12 MHz IRC clock, use the PLL to
boost the input frequency.
1. Power up the system PLL in the PDRUNCFG register.
Section 5.6.33 “
2. Select the PLL input in the SYSPLLCLKSEL register. You have the following input
options:
3. Update the PLL clock source in the SYSPLLCLKUEN register.
4. Configure the PLL M and N dividers.
5. Wait for the PLL to lock by monitoring the PLL lock status.
5.3.2Configure the main clock and system clock
The clock source for the registers and memories is derived from main clock. The main
clock can be sourced from the IRC at a fixed clock frequency of 12 MHz or from the PLL.
The divided main clock is called the system clock and clocks the core, the memories, and
the peripherals (register interfaces and peripheral clocks).
UM10800
Chapter 5: LPC82x System configuration (SYSCON)
– IRC: 12 MHz internal oscillator.
– System oscillator: External crystal oscillator using the XTALIN/XTALOUT pins.
– External clock input CLKIN. Select this pin through the switch matrix.
Section 5.6.9 “
Section 5.6.10 “
Section 5.6.3 “
Section 5.6.4 “
System PLL clock source select register”
System PLL clock source update register”
System PLL control register”
System PLL status register”
1. Select the main clock. You have the following options:
– IRC: 12 MHz internal oscillator (default).
– PLL output: You must configure the PLL to use the PLL output.
Section 5.6.11 “
2. Update the main clock source.
Section 5.6.12 “
3. Select the divider value for the system clock. A divider value of 0 disables the system
clock.
Section 5.6.13 “
4. Select the memories and peripherals that are operating in your application and
therefore must have an active clock. The core is always clocked.
Section 5.6.14 “
Main clock source select register”
Main clock source update enable register”
System clock divider register”
System clock control register”
5.3.3Set up the system oscillator using XTALIN and XTALOUT
To use the system oscillator with the LPC800, you need to assign the XTALIN and
XT ALOUT pins, which connect to the external crystal, through the fixed-pin function in the
switch matrix. XTALIN and XTALOUT can only be assigned to pins PIO0_8 and PIO0_9.
1. In the IOCON block, remove the pull-up and pull-down resistors in the IOCON
registers for pins PIO0_8 and PIO0_9.
2. In the switch matrix block, enable the 1-bit functions for XTALIN and XTALOUT.
3. In the SYSOSCCTRL register, disable the BYPASS bit and select the oscillator
frequency range according to the desired oscillator output clock.
CLKOUTOanyCLKOUT clock output.PINASSIGN8Table 75
CLKINIPIO0_1/ACMP_I2/CLKIN External clock input to the system
XTALINIPIO0_8/XTALINInput to the system oscillator.PINENABLE0Table 79
XTALOUT OPIO0_9/XTALOUTOutput from the system oscillator.PINENABLE0Table 79
RESETIRESET/PIO0_5External reset inputPINENABLE0Table 79
PINENABLE0Table 79
PLL. Disable the ACMP_I2 function
in the PINENABLE register.
5.5 General description
5.5.1Clock generation
The system control block generates all clocks for the chip. Only the low-power oscillator
used for wake-up timing is controlled by the PMU. Except for the USART clock and the
clock to configure the glitch filters of the digital I/O pins, the clocks to the core and
peripherals run at the same frequency. The maximum system clock frequency is 30 MHz.
See Figure 5
.
Remark: The main clock frequency is limited to 100 MHz.
The system control block controls the power to the analog components such as the
oscillators and PLL, the BOD, and the analog comparator. For details, see the following
registers:
Section 5.6.31 “
Section 5.6.3 “System PLL control register”
Section 5.6.6 “Watchdog oscillator control register”
Section 5.6.5 “System oscillator control register”
The system control block configures analog blocks that can remain running in the reduced
power modes (the BOD and the watchdog oscillator for safe operation) and enables
various interrupts to wake up the chip when the internal clocks are shut down in
Deep-sleep and Power-down modes. For details, see the following registers:
The system memory remap register selects whether the exception ve ctors are read from
boot ROM, flash, or SRAM. By default, the flash memory is mapped to address
0x0000 0000. When the MAP bits in the SYSMEMREMAP register are set to 0x0 or 0x1,
the boot ROM or RAM respectively are mapped to the bottom 512 bytes of the memory
map (addresses 0x0000 0000 to 0x0000 0200).
Table 22.System memory remap register (SYSMEMREMAP, address 0x4004 8000) bit
description
BitSymbolValueDescriptionReset
value
1:0MAPSystem memory remap. Value 0x3 is reserved.0x2
0x0Bootloader Mode. Interrupt vectors are re-mapped to Boot
ROM.
0x1Use r RAM Mode. Interrupt vectors are re-mapped to Static
RAM.
0x2Use r Flash Mode. Interrupt vectors are not re-mapped and
reside in Flash.
31:2--Reserved-
5.6.2Peripheral reset control register
The PRESETCTRL register allows software to reset specific peripherals. A zero in any
assigned bit in this register resets the specified peripheral. A 1 clears the reset and allows
the peripheral to operate.
Table 23.Peripheral reset control register (PRESETCTRL, address 0x4004 8004) bit
Table 23.Peripheral reset control register (PRESETCTRL, address 0x4004 8004) bit
BitSymbolValueDescriptionReset
14I2C1_RST_NI2C1 reset control1
15I2C2_RST_NI2C2 reset control1
16I2C3_RST_NI2C3 reset control1
23:17--Reserved24ADC_RST_NADC reset control1
28:25--Reserved29DMA_RST_NDMA reset control1
31:30--Reserved-
UM10800
Chapter 5: LPC82x System configuration (SYSCON)
description
value
0Assert the I2C1 reset.
1Clear the I2C1 reset.
0Assert the I2C2 reset.
1Clear the I2C2 reset.
0Assert the I2C3 reset.
1Clear the I2C3 reset.
0Assert the ADC reset.
1Clear the ADC reset.
0Assert the DMA reset.
1Clear the DMA reset.
5.6.3System PLL control register
This register connects and enables the system PLL and co nfigures the PLL m ultiplier and
divider values. The PLL accepts an input frequency from 10 MHz to 25 MHz from various
clock sources. The input frequency is multiplied to a higher frequency and then divided
down to provide the actual clock used by the CPU, peripherals, and memories. The PLL
can produce a clock up to the maximum allowed for the CPU.
Remark: The divider values for P and M must be selected so that the PLL output clock
frequency FCLKOUT is lower than 100 MHz.
Table 24.System PLL control register (SYSPLLCTRL, address 0x4004 8008) bit description
BitSymbolValueDescriptionReset
4:0M SELFeedback divider value. The division value M is the
programmed MSEL value + 1.
00000: Division ratio M = 1
to
11111: Division ratio M = 32
T able 24.System PLL control register (SYSPLLCTRL, address 0x4004 8008) bit description
BitSymbolValueDescriptionReset
6:5PSELPost divider ratio P. The division ratio is 2 P.0
0x0P = 1
0x1P = 2
0x2P = 4
0x3P = 8
31:7--Reserved. Do not write ones to reserved bits.-
5.6.4System PLL status register
This register is a Read-only register and supplies the PLL lock status (see
Section 5.7.4.1
Table 25.System PLL status register (SYSPLLSTAT, address 0x4004 800C) bit description
BitSymbolValueDescriptionReset
0LOCKPLL lock status0
31:1--Reserved-
).
0PLL not locked
1PLL locked
value
value
5.6.5System oscillator control register
This register configures the frequency range for the system oscillator. The system
oscillator itself is powered on or off in the PDRUNCFG register. See Table 54
Table 26.System oscillator control register (SYSOSCCTRL, address 0x4004 8020) bit
description
BitSymbolValueDescriptionReset
0BYPASSBypass system oscillator0x0
0Disabled. Oscillator is not bypassed.
1Enabled. PLL input (sys_osc_clk) is fed directly
from the XTALIN pin bypassing the oscillator. Use
this mode when using an external clock source
instead of the crystal oscillator.
1FREQRANGEDetermines oscillator frequency range.0x0
01 - 20 MHz frequency range.
115 - 25 MHz frequency range
31:2--Reserved0x00
5.6.6Watchdog oscillator control register
This register configures the watchdog oscillator. The oscillator consists of an analog and a
digital part. The analog part contains the oscillator function and generates an analog clock
(Fclkana). With the digital part, the analog output clock (Fclkana) can be divided to the
required output clock frequency wdt_osc_clk. The analog output freque ncy (Fclkana) can
be adjusted with the FREQSEL bits between 600 kHz and 4.6 MHz. With the digital part
Fclkana will be divided (divider ratios = 2, 4,...,64) to wdt_osc_clk using the DIVSEL bits.
The output clock frequency of the watchdog oscillator can be calculated as
wdt_osc_clk = Fclkana/(2 (1 + DIVSEL)) = 9.3 kHz to 2.3 MHz (nominal values).
Remark: Any setting of the FREQSEL bits will yield a Fclkana value within 40% of the
listed frequency value. The watchdog oscillator is the clock source with the lowest power
consumption. If accurate timing is required, use the IRC or system oscillator.
Remark: The frequency of the watchdog oscillator is undefined after reset. The watchdog
oscillator frequency must be programmed by writing to the WDTOSCCTRL register before
using the watchdog oscillator.
Table 27.Watchdog oscillator control register (WDTOSCCTRL, address 0x4004 8024) bit
BitSymbolValueDescriptionReset
4:0DIVSELSelect divider for Fclkana.
8:5FREQSELSelect watchdog oscillator analog output frequen cy
This register can be used to re-trim the on-chip 12 MHz oscillator. Note that the
factory-preset trim value is written to this register by the boot code on start-up.
The SYSRSTSTAT register shows the source of the latest reset event. The bits are
cleared by writing a one to any of the bits. The POR event clears all other bits in this
register. If another reset signal - for example the external RESET
after the POR signal is negated, then its bit is set to detected. Write a one to clear the
reset.
UM10800
Chapter 5: LPC82x System configuration (SYSCON)
pin - remains asserted
The reset value given in Table 29
Table 29.System reset status register (SYSRSTSTAT, address 0x4004 8030) bit description
BitSymbolValueDescriptionReset
0PORPOR reset status0
0No POR detected
1POR detected. Writing a one clears this reset.
1EXTRSTStatus of the external RESET
0No reset event detect ed .
1Reset detected. Writing a one clears this reset.
2WDTStatus of the Watchdog reset0
0No WDT reset detected
1WDT reset detected. Writing a one clears this reset.
3BODStatus of the Brown-out detect reset0
0No BOD reset detected
1BOD reset detected. Writing a one clears this reset.
4SYSRSTStatus of the software system reset0
0No System reset detected
1System reset detected. Writing a one clears this reset.
31:5--Reserved-
applies to the POR reset.
value
pin. External reset status.0
5.6.9System PLL clock source select register
This register selects the clock source for the system PLL. The SYSPLLCLKUEN register
(see Section 5.6.10
T able 30.System PLL clock source select register (SYSPLLCLKSEL, address 0x4004 8040)
This register updates the clock source of the system PLL with the new input clock after the
SYSPLLCLKSEL register has been written to. In order for the update to take effect, first
write a zero to the SYSPLLUEN register and then write a one to SYSPLLUEN.
This register selects the main system clock, which can be the system PLL (sys_pllclkout),
or the watchdog oscillator, or the IRC oscillator. The main system clock clocks the core,
the peripherals, and the memories.
UM10800
Chapter 5: LPC82x System configuration (SYSCON)
0x4004 8044) bit description
0No change
1Update clock source
Bit 0 of the MAINCLKUEN register (see Section 5.6.12
the update to take effect.
This register updates the clock source of the main clock with the new input clock after the
MAINCLKSEL register has been written to. In order for the update to take effect, first write
a zero to bit 0 of this register, then write a one.
This register controls how the main clock is divided to provide the system clock to the
core, memories, and the peripherals. The system clock can be shut down completely by
setting the DIV field to zero.
Table 34.System clock divider register (SYSAHBCLKDIV, address 0x4004 8078) bit
BitSymbolDescriptionReset
7:0DIVSystem AHB clock divider values
31:8-Reserved-
5.6.14System clock control register
The SYSAHBCLKCTRL register enables the clocks to individual system and peripheral
blocks. The system clock (bit 0) provides the clock for the AHB, the APB br idge , th e ARM
Cortex-M0+, the SYSCON block, and the PMU. This clock cannot be disabled.
Table 35.System clock control register (SYSAHBCLKCTRL, address 0x4004 8080) bit
BitSymbolValueDescriptionReset
0SYSEnables the clock for the AHB, the APB bridge, the
1ROMEnables clock for ROM.1
2RAM0_1Enables clock for SRAM0 and SRAM1.1
3FLASHREGEnables clock for flash register interface.1
4FLASHEnables clock for flash.1
5I2C0Enables clock for I2C0.0
6GPIOEnables clock for GPIO port registers and GPIO pin
UM10800
Chapter 5: LPC82x System configuration (SYSCON)
description
value
0x01
0: System clock disabled.
1: Divide by 1.
to
255: Divide by 255.
description
value
1
Cortex-M0+ core clocks, SYSCON, and the PMU.
This bit is read only and always reads as 1.
Table 35.System clock control register (SYSAHBCLKCTRL, address 0x4004 8080) bit
BitSymbolValueDescriptionReset
20--Reserved21I2C1Enables clock to I2C1.0
22I2C2Enables clock to I2C2.0
23I2C3Enables clock to I2C3.0
24ADCEnables clock to ADC.0
25--Reserved26MTBEnables clock to micro-trace buffer control registers.
28:27--Reserved29DMAEnables clock to DMA.0
31:30--Reserved-
description
UM10800
Chapter 5: LPC82x System configuration (SYSCON)
…continued
value
0Disable
1Enable
0Disable
1Enable
0Disable
1Enable
0Disable
1Enable
0
Turn on this clock when using the micro-trace buffer
for debug purposes.
0Disable
1Enable
0Disable
1Enable
5.6.15USART clock divider register
This register configures the clock for the fractional baud rate generator and all USARTs.
The UART clock can be disabled by setting the DIV field to zero (this is the default
setting).
T able 36.USART clock divider register (UARTCLKDIV, address 0x4004 8094) bit description
This register updates the clock source of the CLKOUT pin with the new clock after the
CLKOUTSEL register has been written to. In order for the update to t ake effect at the input
of the CLKOUT pin, first write a zero to bit 0 of this register, then write a one.
U_PCLK = UARTCLKDIV/(1 + MULT/DIV).
UARTCLKDIV is the USART clock configured in the UARTCLKDIV register.
The fractional portion (1 + MULT/DIV) is determined by the two USART fractional divider
registers in the SYSCON block:
1. The DIV value programmed in this register is the denominator of the divider used by
2. The MULT value of the fractional divider is programmed in the UARTFRGMULT
Remark: To use of the fractional baud rate generator, you must write 0xFF to this r egister
to yield a denominator value of 256. All other values are not supported.
See also:
UM10800
Chapter 5: LPC82x System configuration (SYSCON)
the fractional rate generator to create the fractional component of U_PCLK.
register. See Table 41
.
Section 13.3.1 “
Configure the USART clock and baud rate”
Section 13.7.1 “Clocking and baud rates”
T able 40.USART fractional generator divider value register (UARTFRGDIV, address 0x4004
80F0) bit description
BitSymbolDescriptionReset
7:0DIVDenominator of the fractional divider. DIV is equal to the programmed
value +1. Always set to 0xFF to use with the fractional baud rate
generator.
31:8-Reserved-
5.6.20USART fractional generator multiplier value register
All USART peripherals share a common clock U_PCLK, which can be adjusted by a
fractional divider:
U_PCLK = UARTCLKDIV/(1 + MULT/DIV).
UARTCLKDIV is the USART clock configured in the UARTCLKDIV register.
The fractional portion (1 + MULT/DIV) is determined by the two USART fractional divider
registers in the SYSCON block:
value
0
1. The DIV denominator of the fractional divider value is programmed in the
UARTFRGDIV register. See Table 40
.
2. The MULT value programmed in this register is the numerator of th e fractiona l divider
value used by the fractional rate generator to create the fractional component to the
baud rate.
0STARTTrace start command. Writing a one to this bit sets the TST AR T signal
1STOPTrace stop command. Writing a one to this bit sets the TSTOP signal
31:2-Reserved0
UM10800
Chapter 5: LPC82x System configuration (SYSCON)
0x4004 80F4) bit description
value
0
value.
.
bit description
value
0
to the MTB to HIGH and starts tracing if the TSTARTEN bit in the
MTB master register is set to one as well.
0
in the MTB to HIGH and stops tracing if the TSTOPEN bit in the MTB
master register is set to one as well.
5.6.22POR captured PIO status register 0
The PIOPORCAP0 register captures the state of GPIO port 0 at power-on-r eset. Each bit
represents the reset state of one GPIO pin. This register is a read- on ly status register.
Table 43.POR captured PIO status register 0 (PIOPORCAP0, address 0x400 4 8100) bit
description
BitSymbolDescriptionReset value
17:0PIOSTATState of PIO0_17 through PIO0_0 at power-on resetImplementation
31:18 -Reserved.-
5.6.23IOCON glitch filter clock divider registers 6 to 0
These registers individually configure the seven peripheral input clocks
(IOCONFILTR_PCLK) to the IOCON programmable glitch filter. The clocks can be shut
down by setting the DIV bits to 0x0.
Table 44.IOCON glitch filter clock divider registers 6 to 0 (IOCONCLKDIV[6:0], ad dress
BitSymbolDescriptionReset value
7:0DIVIOCON glitch filter clock divider values
31:8-Reserved0x00
5.6.24BOD control register
The BOD control register selects four separate threshold values for sending a BOD
interrupt to the NVIC and for forced reset. Reset and interrupt threshold values listed in
Table 45
Both the BOD interrupt and the BOD reset, depending on the value of bit BODRSTENA in
this register, can wake-up the chip from Sleep, Deep-sleep, and Power-down modes.
UM10800
Chapter 5: LPC82x System configuration (SYSCON)
0x4004 8134 (IOCONCLKDIV6) to 0x004 814C (IOCONFILT CLKDIV0)) bit
description
0
0: Disable IOCONFILTR_PCLK.
1: Divide by 1.
to
255: Divide by 255.
are typical values.
See the LPC800 data sheet for the BOD reset and interrupt levels.
Table 45.BOD control register (BODCTRL, address 0x4004 8150) bit description
BitSymbolValue DescriptionReset
1:0BODRSTLEVBOD reset level0
0x0Reserved.
0x1Level 1.
0x2Level 2.
0x3Level 3.
3:2BODINTVALBOD interrupt level0
0x0Reserved
0x1Level 1.
0x2Level 2.
0x3Level 3.
4BODRSTENABOD reset enable0
0Disable reset function.
1Enable reset function.
31:5 --Reserved0x00
5.6.25System tick counter calibration register
value
This register determines the value of the SYST_CALIB register.
The IRQLA TENCY r egister is an eight-b it register which specifies the minimum number of
cycles (0-255) permitted for the system to respond to an interrupt request. The intent of
this register is to allow the user to select a trade-off between interrupt response time and
determinism.
Setting this parameter to a very low value (e.g. zero) will guarantee the best possible
interrupt performance but will also introduce a significant degree of uncertainty and jitter.
Requiring the system to always take a larger number of cycles (whethe r it need s it o r not)
will reduce the amount of uncertainty but may not necessarily eliminate it.
Theoretically, the ARM Cortex-M0+ core should always be able to service an interrupt
request within 15 cycles. However, system factors external to the cpu, such as bus
latencies or peripheral response times, can increase the time required to complete a
previous instruction before an interrupt can be serviced. Therefore, accurately specifying
a minimum number of cycles that will ensure determinism will depend on the application.
The default setting for this register is 0x010.
Table 47.IRQ latency register (IRQLATENCY, address 0x4004 8170) bit description
BitSymbolDescriptionReset
7:0LATENCY8-bit latency value0x010
31:8-Reserved-
UM10800
Chapter 5: LPC82x System configuration (SYSCON)
value
5.6.27NMI source selection register
The NMI source selection register selects a peripheral interrupt as source for the NMI
interrupt of the ARM Cortex-M0+ core. For a list of all peripheral interrupts and their IRQ
numbers see Table 5
Remark: When you want to change the interr upt source for the NMI, you must first disable
the NMI source by setting bit 31 in this register to 0. Then change the source by updating
the IRQN bits and re-enable the NMI source by setting bit 31 to 1.
Table 48.NMI source selectio n register (NMISRC, address 0x4004 8174) bit description
BitSymbol DescriptionReset
4:0IRQNThe IRQ number of the interrupt that acts as the Non-Maskable Interrupt
30:5-Reserved31NMIEN Write a 1 to this bit to enable the Non-Maskable Interrupt (NMI) source
Remark: If the NMISRC register is used to select an interrupt as the source of
Non-Maskable interrupts, and the selected interrupt is enabled, one interrupt request can
result in both a Non-Maskable and a normal interrupt. This can be avoided by disabling
the normal interrupt in the NVIC.
. For a description of the NMI functionality, see Section 4.3.2.
Each of these 8 registers selects one pin from all digital pins as the source of a pin
interrupt or as the input to the pattern match e ngine. To select a pin for any of the eight pin
interrupts or pattern match en gine inputs, write the GPIO port pin number as 0 to 28 for
pins PIO0_0 to PIO0_28 to the INTPIN bits. For example, setting INTPIN to 0x5 in
PINTSEL0 selects pin PIO0_5 for pin interrupt 0.
Remark: The GPIO port pin number serves to identify the pin to the PINTSEL register.
Any digital input function, including GPIO, can be assigned to this pin through the switch
matrix.
Each of the 8 pin interrupts must be enabled in the NVIC using interrupt slots # 24 to 31
(see Table 5
To use the selected pins for pin interrupts or the pattern match engine, see Section 10.5.2
The bits in this register (BOD_PD and WDTOSC_OD) can be programmed to control
aspects of Deep-sleep and Power-down modes. The bits are loaded into corresponding
bits of the PDRUNCFG register when Deep-sleep mode or Power-down mode is entered.
Remark: Hardware forces the analog blocks to be powered down in Deep-sleep and
Power-down modes. An exception are the BOD and watchdog oscillator, which can be
configured to remain running through this register. The WDTOSC_PD value written to the
PDSLEEPCFG register is overwritten if the LOCK bit in the WWDT MOD register (see
Table 52.Deep-sleep configuration register (PDSLEEPCFG, address 0x4004 8230) bit
BitSymbolValue DescriptionReset value
2:0-Reserved.0b111
3BOD_PDBOD power-down control for Deep-sleep and
5:4-Reserved.1 1
6WDTOSC_PDWatchdog oscillator power-down control for
15:7-Reserved0b111111111
31:16 --Reserved0
UM10800
Chapter 5: LPC82x System configuration (SYSCON)
description
1
Power-down mode
0Powered
1Powered down
1
Deep-sleep and Power-down mode. Changing
this bit to powered-down has no effect when the
LOCK bit in the WWDT MOD register is set. In
this case, the watchdog oscillator is always
running.
0Powered
1Powered down
5.6.32Wake-up configuration register
This register controls the power configuration of the device when waking up from
Deep-sleep or Power-down mode.
Table 53.Wake-up configuration register (PDAWAKECFG, address 0x4004 8234) bit
11:8-Reserved. Always write these bits as 0b11010b1101
14:12 -Reserved. Always write these bits as 0b1100b110
15ACMPAnalog comparator wake-up configuration1
31:16 --Reserved0
description
UM10800
Chapter 5: LPC82x System configuration (SYSCON)
…continued
1
Changing this bit to powered-down has no effect
when the LOCK bit in the WWDT MOD register is
set. In this case, the watchdog oscillator is always
running.
0Powered
1Powered down
0Powered
1Powered down
0Powered
1Powered down
5.6.33Power configuration register
The PDRUNCFG register controls the power to the various analog blocks. This register
can be written to at any time while the chip is running, and a write will take effect
immediately with the exception of the power-down signal to the IRC.
To avoid glitches when powering down the IRC, the IRC clock is automatically switched
off at a clean point. Therefore, for the IRC a delay is possible before the powe r-down st ate
takes effect.
The system oscillator requires typically 500 μs to start up after the SYSOSC_PD bit has
been changed from 1 to 0. There is no hardware flag to monitor the state of the system
oscillator. Therefore, add a software delay of about 500 μs before using the system
oscillator after power-up.
Table 54.Power configuration register (PDRUNCFG, address 0x4004 8238) bit description
Table 54.Power configuration register (PDRUNCFG, address 0x4004 8238) bit description
BitSymbolValueDescriptionReset value
3BOD_PDBOD power down0
0Powered
1Powered down
4ADC_PDADC wake -up configuration1
0Powered
1Powered down
5SYSOSC_PDCrystal oscillator power down. After power-up,
add a software delay of approximately 500 μs
before using.
0Powered
1Powered down
6WDTOSC_PDWatchdog oscillator power down. Changing
this bit to powered-down has no effect when
the LOCK bit in the WWDT MOD register is
set. In this case, the watchdog oscillator is
always running.
0Powered
1Powered down
7SYSPLL_PDSystem PLL power down1
0Powered
1Powered down
1 1:8-Reserved. Always write these bits as 0b11010b1101
14:12-Reserved. Always write these bits as 0b1100b110
15ACMPAnalog comparator power down1
0Powered
1Powered down
31:16--Reserved0
1
1
5.6.34Device ID register
This device ID register is a read-only register and contains the part ID for each part. This
register is also read by the ISP/IAP commands (see Table 324
Table 55.Device ID register (DEVICE_ID, address 0x4004 83F8) bit description
Reset has the following sources: the RESET pin, Watchdog Reset, Power-On Reset
(POR), and Brown Out Detect (BOD). In addition, there is an ARM software reset.
UM10800
Chapter 5: LPC82x System configuration (SYSCON)
The RESET
the operating voltage attains a usable level, starts the IRC causing reset to remain
asserted until the external Reset is de-asserted, the oscillator is running, and the flash
controller has completed its initialization.
On the assertion of any reset source (ARM core software reset, POR, BOD reset, External
reset, and Watchdog reset), the following processes are initiated:
1. The IRC starts up. After the IRC-start-up time (maximum of 6 s on power-up), the
IRC provides a stable clock output.
2. The flash is powered up. This takes approximately 100 s. Then the flash initialization
sequence is started, which takes about 250 cycles.
3. The boot code in the ROM starts. The boot code performs the boot tasks and may
jump 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.
pin is a Schmitt trigger input pin. Assertion of chip Reset by any source, once
5.7.2Start-up behavior
See Figure 6 for the start-up timing after reset. The IRC is the default clock at Reset and
provides a clean system clock shortly after the supply volt age reaches the thresh old value
of 1.8 V.
The brown-out detection circuit includes up to three levels for monitoring the voltage on
the V
pin. If this voltage falls below one of the selected levels, the BOD asserts an
DD
interrupt signal to the NVIC or issues a reset, depending on the value of the BODRSTENA
bit in the BOD control register (Table 45
).
The interrupt signal can be enabled for interrupt in the Interrupt Enable Register in the
NVIC (see Table 6
) in order to cause a CPU interrupt; if not, software can monitor the
signal by reading a dedicated status register.
If the BOD interrupt is enabled in the STARTERP1 register (see Table 51
) and in the
NVIC, the BOD interrupt can wake up the chip from Deep-sleep and power-do wn mode .
If the BOD reset is enabled, the forced BOD re set can wake up the chip from Deep-sleep
or Power-down mode.
5.7.4System PLL functional description
The LPC82X uses the system PLL to create the clocks for the core and peripherals.
The block diagram of this PLL is shown in Figure 7. The input frequency range is 10 MHz
to 25 MHz. The input clock is fed directly to the Phase-Freq ue n cy Det ec to r (PF D). This
block compares the phase and frequency of its inputs, and generates a control signal
when phase and/ or frequency do not match. The loop filter filters these control signals
and drives the current controlled oscillator (CCO), which generates the main clock and
optionally two additional phases. The CCO frequency range is 156 MHz to 320 MHz.
These clocks are either divided by 2xP by the programmable post divider to create the
output clocks, or are sent directly to the outputs. The main output clock is then divided by
M by the programmable feedback divider to generate the feedback clock. The output
signal of the phase-frequency detector is also monitored by the lock detector, to signal
when the PLL has locked on to the input clock.
Remark: The divider values for P and M must be selected so that the PLL output clock
frequency FCLKOUT is lower than 100 MHz because the main clock is limited to a
maximum frequency of 100 MHz
5.7.4.1Lock detector
The lock detector measures the phase difference between the rising edges of the input
and feedback clocks. Only when this difference is smaller than the so called “lock
criterion” for more than eight consecutive input clock periods, the lock output switches
from low to high. A single too large phase difference immediately resets the counter and
causes the lock signal to drop (if it was high). Requiring eig h t phase me asurements in a
row to be below a certain figure ensures that the lock detector will not indicate lock until
both the phase and frequency of the input and feedback clocks are very well aligned. This
effectively prevents false lock indications, and thus ensures a glitch free lock signal.
5.7.4.2Power-down control
To reduce the power consumption when the PLL clock is not needed, a PLL Power-down
mode has been incorporated. This mode is enabled b y settin g th e SYSPLL_PD bit to on e
in the Power-down configuration register (Table 54
reference will be turned off, the oscillator and the phase-frequency detector will be
stopped and the dividers will enter a reset state. While in PLL Power-down mode, the lock
output will be low to indicate that the PLL is not in lock. When the PLL Power-down mode
is terminated by setting the SYSPLL_PD bit to zero, the PLL will resume its normal
operation and will make the lock signal high once it has regained lock on the input clock.
5.7.4.3Divider ratio programming
5.7.4.3.1Post divider
The division ratio of the post divider is controlled by the PSEL bits. The division ratio is two
times the value of P selected by PSEL bits as shown in Table 24
output clock with a 50% duty cycle.
5.7.4.3.2Feedback divi de r
The feedback divider’s division ratio is controlled by the MSEL bits. The division ratio
between the PLL ’s outp ut clock and the input clock is the decim al value on MSEL bits pl us
one, as specified in Table 24
5.7.4.3.3Changing the divider values
UM10800
Chapter 5: LPC82x System configuration (SYSCON)
. This guarantees an
.
Changing the divider ratio while the PLL is running is not recommended. As there is no
way to synchronize the change of the MSEL and PSEL values with the dividers, the risk
exists that the counter will read in an undefined value, which could lead to unwanted
spikes or drops in the frequency of the output clock. The recommended way of changing
between divider settings is to power down the PLL, ad just the divider settings and then let
the PLL start up again.
5.7.4.4Frequency selection
The PLL frequency equations use the following parameters (also see Figure 7):
Table 56.PLL frequency parameters
ParameterSystem PLL
FCLKINFrequency of sys_pllclkin (input clock to the system PLL) from the
SYSPLLCLKSEL multiplexer (see Section 5.6.9
FCCOFrequency of the Current Controlled Oscillator (CCO); 156 to 320 MHz.
FCLKOUTFrequency of sys_pllclkout. This is the PLL output frequency and must be
< 100 MHz.
PSystem PLL post divider ratio; PSEL bits in SYSPLLCTRL (see
Section 5.6.3
MSystem PLL feedback divider register; MSEL bits in SYSPLLCTRL (see
Section 5.6.3
5.7.4.4.1Normal mode
).
).
).
In this mode the post divider is enabled, giving a 50% duty cycle clock with the following
frequency relations:
In this mode, the internal current reference will be turned off, the oscillator and the
phase-frequency detector will be stopped and the dividers will enter a reset state. While in
PLL Power-down mode, the lock output will be low, to indicate that the PLL is not in lock.
When the PLL Power-down mode is terminated by SYSPLL_PD bit to zero in the
Power-down configuration register (Table 54
and will make the lock signal high once it has regained lock on the input clock.
Chapter 6: LPC82x Reduced power modes and power
management
Rev. 1.2 — 5 October 2016User manual
6.1 How to read this chapter
The LPC82x provides an on-chip API in the boot ROM to optimize power consumption in
active and sleep modes. See Section 26.1
Read this chapter to configure the reduced power modes De ep-sleep mod e, Power-down
mode, and Deep power-down mode.
Remark: The external clock input WKTCL KIN on the wake-up timer is not availabl e on the
TSSOP20 package.
6.2 Features
.
• Reduced power modes control
• Low-power oscillator control
• Five general purpose backup registers to retain data in Deep power-down mode
6.3 Basic configuration
The PMU is always on as long as V
If using the WAKEUP function, disable the hysteresis for the WAKEUP pad in the
DPDCTRL register when the supply voltage VDD is below 2.2 V. See Table 63
If using the WKTCLKIN function, disable the hysteresis for that pin in the DPDCTRL
register. See Table 63
6.3.1Low power modes in the ARM Cortex-M0+ core
Entering and exiting the low power modes is always controlled by the ARM Cortex-M0+
core. The SCR register is the software interface for controlling the core’s actions when
entering a low power mode. The SCR register is located on the ARM private peripheral
bus. For details, see Ref. 3
6.3.1.1System control register
The System control register (SCR) controls entry to and exit from a low power state. This
register is located on the private peripheral bus and is a R/W register with reset value of
0x0000 0000. The SCR register allows to put the ARM core into sleep mode or the entire
system in Deep-sleep or Power-down mode. To set the low power state with
SLEEPDEEP = 1 to either deep-sleep or power-down or to enter the Deep power-down
mode, use the PCON register (Table 61
T able 58. System control register (SCR, address 0xE000 ED10) bit description
BitSymbolDescriptionReset
0-Reserved.0
1SLEEPONEXIT Indicates sleep-on-exit when returning from Handler mode to
2SLEEPDEEPControls whether the processor uses sleep or deep-sleep as
3-Reserved.0
4SEVONPENDSend Event on Pending bit:
31:5-Reserved.0
UM10800
Chapter 6: LPC82x Reduced power modes and power management
value
0
Thread mode:
0 = do not sleep when returning to Thread mode.
1 = enter sleep, or deep sleep, on return from an ISR to
Thread mode.
Setting this bit to 1 enables an interrupt driven application to
avoid returning to an empty main application.
0
its low power mode:
0 = sleep
1 = deep sleep.
0
0 = only enabled interrupts or events can wake-up the
processor, disabled interrupts are excluded
1 = enabled events and all interrupts, including disabled
interrupts, can wake up the processor.
When an event or interrupt enters pending state, the event
signal wakes up the processor from WFE. If the processor is
not waiting for an event, the event is registered and affects
the next WFE.
The processor also wakes up on execution of an
instruction.
SEV
6.4 Pin description
In Deep power-down only the WAKEUP pin PIO0_4 and the self-wake-up timer clock
input WKTCLKIN on pin PIO0_28 are functional (if enabled). The WAKEUP function can
be disabled in the DPDCTRL register to lower the power consumption even more. In this
case, enable the self-wake-up timer to provide an internal wake-up signal. See
Section 6.6.3 “
Remark: When entering Deep power-down mode, an external pull-up resistor is required
on the WAKEUP pin to hold it HIGH. In addition, pull the RESET pin HIGH to prevent it
from floating while in Deep power-down mode.
Power on the LPC800 is controlled by the PMU, by the SYSCON block, and the ARM
Cortex-M0+ core. The following reduced power modes are supported in order from
highest to lowest power consumption:
UM10800
Chapter 6: LPC82x Reduced power modes and power management
Chapter 6: LPC82x Reduced power modes and power management
The sleep mode affects the ARM Cortex-M0+ core only. Peripherals and memories
are active.
The Deep-sleep and power-down modes affect the core and the entire system with
memories and peripherals. Before entering deep-sleep or power-down, you must
switch the main clock to the IRC to provide a clock signal that can be shut down
cleanly.
a. In Deep-sleep mode, the peripherals receive no internal clocks. The flash is in
standby mode. The SRAM memory and all peripheral registers as well as the
processor maintain their internal states. The WWDT, WKT, and BOD can remain
active to wake up the system on an interrupt.
b. In Power-down mode, the peripherals receive no internal clocks. The internal
SRAM memory and all peripheral registers as well as the processor maintain their
internal states. The flash memory is powered down. The WWDT, WKT, and BOD
can remain active to wake up the system on an interrupt.
For maximal power savings, the entire system is shut down except for the general
purpose registers in the PMU and the self-wake-up timer. Only the general purpose
registers in the PMU maintain their internal states. The part can wake up on a pulse
on the WAKEUP pin or when the self-wake-up timer times out. On wake-up, the part
reboots.
Remark: The part is in active mode when it is fully powered and operational after booting.
6.5.1Wake-up process
If the part receives a wake-up signal in any of the reduced power modes, it wakes up to
the active mode.
See these links for related registers and wake-up instructions:
• To configure the system after wake-up: Ta ble 53 “Wake-up configuration register
(PDAWAKECFG, address 0x4004 8234) bit description”.
• To use external interrupts for wake-up: Table 50 “Start logic 0 pin wake-up enable
register 0 (STARTERP0, address 0x4004 8204) bit description” and Table 49 “Pin
interrupt select registers (PINTSEL[0:7], address 0x4004 8178 (PINTSEL0) to 0x4004
8194 (PINTSEL7)) bit description”
• To enable external or internal signals to wake up the part from Deep-sleep or
Power-down modes: Table 51 “
(STARTERP1, address 0x4004 8214) bit description”
• To configure the USART to wake up the part: Section 13.3.2 “Configure the USART
for wake-up”
• For configuring the self-wake-up timer: Section 18.5
• For a list of all wake-up sources: Table 59 “Wake-up sources for reduced power
0x0Table 63
register. Also includes bits for
general purpose storage.
Reference
Page 66
NXP Semiconductors
6.6.1Power control register
The power control register selects whether one of the ARM Cortex-M0+ controlled
power-down modes (Sleep mode or Deep-sleep/Power-down mode) or the Deep
power-down mode is entered and provides the flags for Sleep or Deep-sleep /Power-down
modes and Deep power-down modes respectively.
Table 61.Power control register (PCON, address 0x4002 0000) bit description
BitSymbolValueDescriptionReset
2:0P MPower mode000
3NODPDA 1 in this bit prevents entry to Deep power-down mode
7:4--Reserved. Do not write ones to this bit.0
8SLEEPFLAGSleep mode flag0
10:9--Reserved. Do not write ones to this bit.0
11DPDFLAGDeep power-down flag0
31:12--Reserved. Do not write ones to this bit.0
UM10800
Chapter 6: LPC82x Reduced power modes and power management
value
0x0Default. The part is in active or sleep mode.
0x1Deep-sle ep mode. ARM WFI will enter Deep-sleep mode.
0x2Power-down mode. ARM WFI wil l enter Power-down
mode.
0x3Deep po wer-down mode. ARM WFI will enter
Deep-power down mode (ARM Cortex-M0+ core
powered-down).
0
when 0x3 is written to the PM field above, the
SLEEPDEEP bit is set, and a WFI is executed.
This bit is cleared only by power-on reset, so writing a one
to this bit locks the part in a mode in which Deep
power-down mode is blocked.
0Active mode. Read: No power-down mode entered. Part
is in Active mode.
Write: No effect.
1Low power mode. Read: Sleep, Deep-sleep or
Power-down mode entered.
Write: Writing a 1 clears the SLEEPFLAG bit to 0.
0Not Deep power-down. Read: Deep power-down mode
not entered.
Write: No effect.
1Deep power-down. Read: Deep power-down mode
entered.
Write: Clear the Deep power-down flag.
0
6.6.2General purpose registers 0 to 3
The general purpose registers retain data through the Deep power-down mode when
power is still applied to the V
Only a cold boot - when all power has been completely removed from the chip - will reset
the general purpose registers.
pin but the chip has entered Deep power-down mode.
DD
Page 67
NXP Semiconductors
T able 62.General purpose registers 0 to 3 (GPREG[0:3], address 0x4002 0004 (GPREG0) to
BitSymbolDescriptionReset
31:0GPDATAData retained during Deep power-down mode.0x0
6.6.3Deep power-down control register
The Deep power-down control register controls the low-power oscillator that can be used
by the self-wake-up timer to wake up from Deep power-down mode. In addition, this
register configures the functionality of the WAKEUP pin (pin PIO0_4).
The bits in the register not used for deep power-down control (bits 31:4) can be used for
storing additional data which are retained in Deep power -down mode in the same way as
registers GPREG0 to GPREG3.
UM10800
Chapter 6: LPC82x Reduced power modes and power management
0x4002 0010 (GPREG3)) bit description
value
Remark: If there is a possibility that the external voltage applied on pin V
drops below
DD
2.2 V during Deep power-down, the hysteresis of the WAKEUP input pin has to be
disabled in this register before entering Deep power-down mode in order for the chip to
wake up.
Remark: Enabling the low-power oscillator in Deep power-down mode increases the
power consumption. Only enable this oscillator if you need the self-wake-up timer to wake
up the part from Deep power-down mode. You may need the self-wake-up timer if the
wake-up pin is used for other purposes and the wake-up function is not available.
Table 63. Deep power down control register (DPDCTRL, address 0x4002 0014) bit description
BitSymbolValueDescriptionReset
0WAKEUPHYSWAKEUP pin hysteresis enable0
1WAKEPAD_
DISABLE
2LPOSCENEnable the low-power oscillator for use with the 10 kHz self-wake-up timer
0Disabled. Hysteresis for WAKEUP pin disabled.
1Enabled. Hysteresis for WAKEUP pin enabled.
WAKEUP pin disable. Setting this bit disables the wake-up pin, so it can be
used for other purposes.
Remark: Never set this bit if you intend to use a pin to wake up the part from
Deep power-down mode. You can only disable the wake-up pin if the
self-wake-up timer is enabled and configured.
Remark: Setting this bit is not necessary if Deep power-down mode is not
used.
0Enabled. The wake-up function is enabled on pin PIO0_4.
1Disabled. Setting this bit disables the wake-up function on pin PIO0_4.
clock. You must set this bit if the CLKSEL bit in the self-wake-up timer CTRL
bit is set.
Do not enable the low-power oscillator if the self-wake-up timer is clocked by
the divided IRC or the external clock input.
0Disabled.
1Enabled.
Chapter 6: LPC82x Reduced power modes and power management
Table 63. Deep power down control register (DPDCTRL, address 0x4002 0014) bit description
BitSymbolValueDescriptionReset
3LPOSCDPDENEnabl e the low-power oscillator in Deep power-down mode. Setting this bit
causes the low-power oscillator to remain running during Deep power-down
mode provided that bit 2 in this register is set as well.
You must set this bit for the self-wake-up timer to be able to wake up the part
from Deep power-down mode.
Remark: Do not set this bit unless you use the self-wake-up timer with the
low-power oscillator clock source to wake up from Deep power-down mode.
0Disabled.
1Enabled.
4WAKEUPCLKHYSExternal clock input for the self-wake-up timer WKTCLKIN hysteresis enable.0
0Disabled. Hysteresis for WAKEUP clock pin disabled.
1Enabled. Hysteresis for WAKEUP clock pin enabled.
5WAKECLKPAD_
DISABLE
0Disabled. Setting this bit disables external clock input on pin PIO0_28.
1Enabled. The external clock input for the self-wake-up timer is enabled on pin
31:6-Data retained during Deep power-down mode. 0x0
Disable the external clock input for the self-wake-up timer. Setting this bit
enables the self-wake-up timer clock pin WKTCLKLIN. To minimize power
consumption, especially in deep power-down mode, disable this clock input
when not using the external clock option for the self-wake-up timer.
PIO0_28.
…continued
value
0
0
6.7 Functional description
6.7.1Power management
The part supports a variety of power contr ol features. In Active mode, when the chip is
running, power and clocks to selected peripherals can be optimized for power
consumption. In addition, there are four special modes of processor power reduction with
different peripherals running: Sleep mode, Deep-sleep mode, Power-down mode, and
Deep power-down mode.
Table 64.Peripheral configuration in reduc ed power modes
Table 64.Peripheral configuration in reduc ed power modes
PeripheralSleep modeDeep-sleep
WDosc/WWDTsoftware configurablesoftware
Digital peripheralssoftware configurableoffoffoff
WKT/low-power
oscillator
Remark: The Debug mode is not supported in Sleep, Deep-sleep, Power-down, or Deep
power-down modes.
6.7.2Reduced power modes and WWDT lock features
The WWDT lock feature influences the power consumption in any of the power modes
because locking the WWDT clock source forces the watchdog oscillator to be on
independently of the Deep-sleep and Power-down mode software configuration through
the PDSLEEPCFG register. For details see Section 17.5. 3 “
features”.
UM10800
Chapter 6: LPC82x Reduced power modes and power management
mode
configurable
software configurablesoftware
configurable
Power-down
mode
software
configurable
software
configurable
Using the WWDT lock
Deep
power-down
mode
off
software
configurable
6.7.3Active mode
In Active mode, the ARM Cortex-M0+ core, memories, and pe ripherals are clocked by the
system clock or main clock.
The chip is in Active mode after reset and the default power configuration is determined
by the reset values of the PDRUNCFG and SYSAHBCLKCTRL registers. The power
configuration can be changed during run time.
6.7.3.1Power configuration in Active mode
Power consumption in Active mode is determined by the following configuration choices:
• The SYSAHBCLKCTRL register controls which memories and peripherals are
running (Table 35
).
• The power to various analog blocks (PLL, oscillators, the BOD circuit, and the flash
block) can be controlled at any time individually through the PDRUNCFG register
(Table 54 “
description”).
Power configuration register (PDRUNCFG, address 0x4004 8238) bit
• The clock source for the system clock can be selected from the IRC (default), the
system oscillator, or the watchdog oscillator (see Figure 5
• The system clock frequency can be selected by the SYSPLLCTRL (Table 24) and the
SYSAHBCLKDIV register (Table 34
).
• The USART and CLKOUT use individual peripheral clocks with their own clock
dividers. The peripheral clocks can be shut down through the corresponding clock
divider registers.
and related registers).
6.7.4Sleep mode
In Sleep mode, the system clock to the ARM Cortex-M0+ core is stopped and execution of
instructions is suspended until either a reset or an interrupt occurs.
Peripheral functions, if selected to be clocked in the SYSAHBCLKCTRL r egister, 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 proce ssor state and
registers, peripheral registers, and internal SRAM values are maintained, and the logic
levels of the pins remain static.
6.7.4.1Power configuration in Sleep mode
Power consumption in Sleep mode is configured by the same settings as in Active mode:
• The clock remains running.
• The system clock frequency remains the same as in Active mode, but the processor is
• Analog and digital peripherals are selected as in Active mode.
6.7.4.2Programming Sleep mode
The following steps must be performed to enter Sleep mode:
UM10800
Chapter 6: LPC82x Reduced power modes and power management
not clocked.
1. The PM bits in the PCON register must be set to the default value 0x0.
2. The SLEEPDEEP bit in the ARM Cortex-M0+ SCR register must be set to zero
(Table 58
3. Use the ARM Cortex-M0+ Wait-For-Interrupt (WFI) instruction.
).
6.7.4.3Wake-up from Sleep mode
Sleep mode is exited automatically when an interrupt enabled by the NVIC arrives at the
processor or a reset occurs. After wake-up due to an in terr up t, the micr ocon trolle r retu rns
to its original power configuration defined by the contents of the PDRUNCFG and the
SYSAHBCLKDIV registers. If a reset occurs, the microcontroller enters the default
configuration in Active mode.
6.7.5Deep-sleep mode
In Deep-sleep mode, the system clock to the processor is disabled as in Sleep mode. All
analog blocks are powered down, except for the BOD circuit and the watchdog oscillator,
which can be selected or deselected during Deep-sleep mode in the PDSLEEPCFG
register. The main clock, and therefore all peripheral clocks, are disabled except for the
clock to the watchdog timer if the watchdog oscillator is selected. The IRC is running, but
its output is disabled. The flash is in standby mode.
Deep-sleep mode eliminates all power used by analog p eriphera ls an d all dy namic powe r
used by the processor itself, memory systems and related controllers, and internal buses.
The processor state and registers, peripheral registers, and internal SRAM values are
maintained, and the logic levels of the pins remain static.
6.7.5.1Power configuration in Deep-sleep mode
Power consumption in Deep-sleep mode is determined by the Deep-sleep power
configuration setting in the PDSLEEPCFG (Table 52
) register:
• The watchdog oscillator can be left running in Deep-sleep mode if required for the
• The BOD circuit can be left running in Deep-slee p mode if r equir ed by th e application .
6.7.5.2Programming Deep-sleep mode
The following steps must be performed to enter Deep-sleep mode:
UM10800
Chapter 6: LPC82x Reduced power modes and power management
1. The PM bits in the PCON register must be set to 0x1 (Table 61
2. Select the power configuration in Deep-sleep mode in the PDSLEEPCFG (Table 52
register.
3. Select the power configuration after wake-up in the PDAWAKECFG (Table 53
register.
4. If any of the available wake-up interrupts are needed for wake-up, enable the
interrupts in the interrupt wake-up registers (Table 50
5. Select the IRC as the main clock. See Table 32
6. Write one to the SLEEPDEEP bit in the ARM Cortex-M0+ SCR register (Table 58
7. Use the ARM WFI instruction.
6.7.5.3Wake-up from Deep-sleep mode
The microcontroller can wake up from Deep-sleep mode in the following ways:
• Signal on one of the eight pin interrupts selected in Table 49. Each pin interrupt must
also be enabled in the STARTERP0 register (Table 50
• BOD signal, if the BOD is enabled in the PDSLEEPCFG register:
– BOD interrupt using the deep-sleep interrupt wake-up register 1 (Table 51
BOD interrupt must be enabled in the NVIC. The BOD interrupt must be selected in
the BODCTRL register.
– Reset from the BOD circuit. In this case, the BOD circuit must be enabled in the
PDSLEEPCFG register, and the BOD reset must be enabled in the BODCTRL
register (Table 45
).
• WWDT signal, if the watchdog oscillator is enabled in the PDSLEEPCFG register:
– WWDT interrupt using the interrupt wake-up register 1 (Table 51
interrupt must be enabled in the NVIC. The WWDT interrupt must be set in the
WWDT MOD register, and the WWDT must be enabled in the SYSAHBCLKCTRL
register.
– Reset from the watchdog timer. The WWDT reset must be set in the WWDT MOD
register. In this case, the watchdog oscillator must be running in Deep-sleep mode
(see PDSLEEPCFG register), and the WDT must be enabled in the
SYSAHBCLKCTRL register.
• Via any of the USART blocks if the USART is configured in synchronous mode. See
Section 13.3.2 “
Configure the USART for wake-up”.
• Via the I2C. See Section 15.3.3.
• Via any of the SPI blocks. See Section 14.3.1.
).
)
)
, Table 51) and in the NVIC.
.
).
) and in the NVIC.
). The
). The WWDT
6.7.6Power-down mode
In Power-down mode, the system clock to the processor is disabled as in Sleep mod e. All
analog blocks are powered down, except for the BOD circuit and the watchdog oscillator,
which must be selected or deselected during Power-down mode in the PDSLEEPCFG
register. The main clock and therefore all peripheral clocks are disabled except for the
clock to the watchdog timer if the watchdog oscillator is selected. The IRC itself and the
flash are powered down, decreasing power consumption compared to Deep-sleep mode.
Power-down mode eliminates all power used by analog peripherals and all dynamic
power used by the processor itself, memory systems and related controllers, and internal
buses. The processor state and registers, peripheral registers, and internal SRAM values
are maintained, and the logic levels of the pins remain static. Wake-up times are longer
compared to the Deep-sleep mode.
6.7.6.1Power configuration in Power-down mode
Power consumption in Power-down mode can be configured by the power configuration
setting in the PDSLEEPCFG (Table 52
(see Section 6.7.5.1
• The watchdog oscillator can be left running in Power-down mode if required for the
• The BOD circuit can be left running in Power-down mode if required by the
UM10800
Chapter 6: LPC82x Reduced power modes and power management
) register in the same way as for Deep-sleep mode
):
WWDT.
application.
6.7.6.2Programming Power-down mode
The following steps must be performed to enter Power-down mode:
1. The PM bits in the PCON register must be set to 0x2 (Table 61
2. Select the power configuration in Power-down mode in the PDSLEEPCFG (Table 52
register.
3. Select the power configuration after wake-up in the PDAWAKECFG (Table 53
register.
4. If any of the available wake-up interrupts are used for wake-up, enable the interrupts
in the interrupt wake-up registers (Table 50
5. Select the IRC as the main clock. See Table 32
6. Write one to the SLEEPDEEP bit in the ARM Cortex-M0+ SCR register (Table 58
7. Use the ARM WFI instruction.
6.7.6.3Wake-up from Power-down mode
The microcontroller can wake up from Power-down mode in the same way as from
Deep-sleep mode:
• Signal on one of the eight pin interrupts selected in Table 49. Each pin interrupt must
also be enabled in the STARTERP0 register (Table 50
• BOD signal, if the BOD is enabled in the PDSLEEPCFG register:
– BOD interrupt using the interrupt wake-up register 1 (Table 51
must be enabled in the NVIC. The BOD interrupt must be selected in the
BODCTRL register.
– Reset from the BOD circuit. In this case, the BOD reset must be enabled in the
BODCTRL register (Table 45
).
• WWDT signal, if the watchdog oscillator is enabled in the PDSLEEPCFG register:
In Deep power-down mode, power and clocks are shut off to the entire chip with the
exception of the WAKEUP pin and the self-wake-up timer.
During Deep power-down mode, the con tents of the SRAM and registers are not retained
except for a small amount of data which can be stored in the general purpose registers of
the PMU block.
UM10800
Chapter 6: LPC82x Reduced power modes and power management
– WWDT interrupt using the interrupt wake-up register 1 (Table 51). The WWDT
interrupt must be enabled in the NVIC. The WWDT interrupt must be set in the
WWDT MOD register.
– Reset from the watchdog timer. The WWDT reset must be set in the WWDT MOD
register.
– Via any of the USART blocks. See Section 13.3.2 “
wake-up”.
– Via the I2C. See Section 15.3.3
– Via any of the SPI blocks. See Section 14.3.1
.
Configure the USART for
.
All functional pins are tri-stated in Deep power-down mode except for the WAKEUP pin. In
this mode, you must pull the RESET
Remark: Setting bit 3 in the PCON register (Table 61
Deep-power down mode.
pin HIGH externally.
) prevents the part from entering
6.7.7.1Power configuration in Deep power-down mode
Deep power-down mode has no configuration options. All clocks, the core, and all
peripherals are powered down. Only the WAKEUP pin and the self-wake-up timer are
powered.
6.7.7.2Programming Deep power-down mode using the WAKEUP pin:
The following steps must be performed to enter Deep power-down mode when using the
WAKEUP pin for waking up:
1. Pull the WAKEUP pin externally HIGH.
2. Ensure that bit 3 in the PCON register (Table 61
3. Write 0x3 to the PM bits in the PCON register (see Table 61
4. Store data to be retained in the general purpose registers (Section 6.6.2
5. Write one to the SLEEPDEEP bit in the ARM Cortex-M0+ SCR register (Table 58
6. Use the ARM WFI instruction.
) is cleared.
).
).
).
6.7.7.3Wake-up from Deep power-down mode using the WAKEUP pin:
Pulling the WAKEUP pin LOW wakes up the LPC800 from Deep power-down, and the
part goes through the entire reset process.
1. On the WAKEUP pin, transition from HIGH to LOW.
– The PMU will turn on the on-chip voltage regulator. When the core voltage reaches
the power-on-reset (POR) trip point, a system reset will be triggered and the chip
re-boots.
The switch matrix is identical for all LPC82x parts.
7.2 Features
• Flexible assignment of digital peripheral functions to pins
• Enable/disable of analog functions
7.3 Basic configuration
Once configured, no clocks are needed for the switch matrix to function. The system clock
is needed only to write to or read from the pin assignment registers. After the switch matrix
is configured, disable the clock to the switch matrix block in the SYSAHBCLKCTRL
register.
Before activating a peripheral or enabling its interrupt, use the switch ma trix to connect the
peripheral to external pins.
The serial wire debug pins SWDIO and SWCLK are enabled by default on pins PIO0_2
and PIO0_3.
Remark: For the purpose of programming the pin functions through the switch matrix,
every pin except the power and ground pins is id entified in a package-inde pendent way by
its GPIO port pin number.
Remark: The switch matrix is reset by a system reset from the RESET
other resets.
Fig 8.Example: Connect function U0_RXD and U0_TXD to pins 4 and 14
A pin is identified for the purpose of programming the switch matrix by its default GPIO port pin number.
The switch matrix connects all internal signals listed in the table of movable functions
through the pin assignment registers to external pins on the package. External pins are
identified by their default GPIO pin number PIO0_n. Follow these steps to connect an
internal signal FUNC to an external pin. An example of a movable function is the UART
transmit signal TXD:
1. Find the pin function in the list of movable functions in Table 65
or in the data sheet.
2. Use the LPC800 data sheet to decide which pin x on the LPC800 p ackage to connect
the pin function to.
3. Use the pin description table to find the default GPIO function PIO0_n assigned to
package pin x. m is the pin number.
4. Locate the pin assignment register for the function FUNC in the switch matrix register
description.
5. Disable any special functions on pin PIO0_n in the PINENABLE0 register.
6. Program the pin number n into the bits assigned to the pin function.
The pin function is now connected to pin x on the package.
7.3.2Enable an analog input or other special function
The switch matrix enables functions that can only be assigned to one pin. Examples are
analog inputs, all GPIO pins, and the debug SWD pins.
Page 77
NXP Semiconductors
• If you want to assign a GPIO pin to a pin on any LPC800 package, disable any special
• For all other functions that are not in the table of movable functions, do the following:
7.3.3Changing the pin function assignment
Pin function assignments can be changed “on-the-fly” from one peripheral to another
while the part is running. To disconnect a peripheral from the pins and change the pin
function assignment, follow these steps:
1. Enable the clock to the switch matrix.
2. Find the pin assign register for the current pin function. For example, register
3. Set the corresponding bits in the PINASSIGN register to their default value 0xFF.
4. Clear all pending interrupts for the disconnected peripheral and ensure that the
5. In the pin assign register for the new pin function, program the pin number.
6. Disable the clock to the switch matrix.
UM10800
Chapter 7: LPC82x Switch matrix (SWM)
function available on this pin in the PINENABLE0 register and do not assign any
movable function to it.
By default, all pins except pins PIO0_2, PIO0_3, and PIO0_5 are assigned to GPIO.
a. Locate the function in the pin description table in the data sheet. This shows the
package pin for this function.
b. Enable the function in the PINENABLE0 register. All other possible functions on
this pins are now disabled.
PINASSIGN0 for pin function U0_RXD.
peripheral is in a defined state.
7.4 General description
The switch matrix connects internal signals (functions) to external pins. Functions are
signals coming from or going to a single pin on the package and coming from or going to
an on-chip peripheral block. Examples of functions are the GPIOs, the UART transmit
output (TXD), or the clock output CLKOUT. Many peripherals have several functions that
must be connected to external pins.
The switch matrix also enables the output driver for digital functions that are ou tputs. The
electrical pin characteristics for both inputs and outputs (internal pull-up/down resistors,
inverter, digital filter, open-drain mode) are configured by the IOCON block for each pin.
Most functions can be assigned through the switch matrix to any external pin that is not a
power or ground pin. These functions are called movable functions.
A few functions like the crystal oscillator pins (XTALIN/XTALOUT) or the analog
comparator inputs can only be assigned to one particular exte rnal pin with the appropria te
electrical characteristics. These functions are called fixed-pin functions. If a fixed-pin
function is not used, it can be replaced by any other movable function.
For fixed-pin analog functions, the switch matrix enables the analog input or output and
disables the digital pad.
GPIOs are special fixed-pin functions. Each GPIO is assigned to one and only one
external pin by default. External pins are therefore identified by their fixed-pin GPIO
function. The level on a digital input is always reflected in the GPIO por t register and in the
pin interrupt/pattern match state, if selected, regardless of which (digital) function is
assigned to the pin through the switch matrix.
IOCON
PIO0_m
package
pin x
DIGITAL PAD
ANALOG PAD
digital input
digital output
digital output ena
analog ena
analog i/o
SWM
UM10800
Chapter 7: LPC82x Switch matrix (SWM)
SYSCON
PINTSEL[7:0]
GPIO
PIO0_m
GPIO_INT_BMAT
U0_RXD
U0_TXD
U0_RTS
U0_CTS
U0_SCLK
USART0
PIN
INTERRUPT
Fig 9.Functional diagram of the switch matrix
Remark: From all movable and fixed-pin functions, you can assign multiple functions to
the same pin but no more than one output or bidirectional function (see Figure 9
following guidelines when assigning pins:
• It is allowed to connect one input signal on a pin to multiple internal inputs by
programming the same pin number in more than one PINASSIGN register.
Example:
You can enable the CLKIN input in the PINENABLE0 register on pin PIO0_1 and also
assign one ore more SCT inputs to pin PIO0_1 through the PINASSIGN registers to
feed the CLKIN into the SCT.
You can send the input on one pin to all SCT inputs to use as an SCT abort signal.
• It is allowed to let one digital output function control one or more digital inputs by
programming the same pin number in the PINASSIGN register bit fields for the output
and inputs.
Example:
You can loop back the USART transmit output to the receive inpu t by assigning the
same pin number to Un_RXD and Un_TXD.
• It is not allowed to connect more than one output or bidirectional function to a pin.
• When you assign any function to a pin through the switch matrix, the GPIO output
becomes disabled.
• Enabling any analog fixed-pin function disables all digital functions on the same pin.
7.4.1Movable functions
Table 65. Movable functions (assig n to pins PIO0_0 to PIO0_28 through switch matrix)
Function nameTypeDescriptionSWM Pin assign
U0_TXDOTransmitter output for USART0. PINASSIGN0Table 67
U0_RXDIReceiver input for USART0. PINASSIGN0Table 67
U0_RTSORequest To Send output for USART0.PINASSIGN0Table 67
U0_CTSIClear To Send input for USART0.PINASSIGN0Table 67
U0_SCLKI/OSerial clock input/output for USART0 in synchronous
U1_TXDOTransmitter output for USART1. PINASSIGN1Table 68
U1_RXDIReceiver input for USART1. PINASSIGN1Table 68
U1_RTSORequest To Send output for USART1.PINASSIGN1Table 68
U1_CTSIClear To Send input for USART1.PINASSIGN2Table 69
U1_SCLKI/OSerial clock input/output for USART1 in synchronous
U2_TXDOTransmitter output for USART2. PINASSIGN2Table 69
U2_RXDIReceiver input for USART2. PINASSIGN2Table 69
U2_RTSORequest To Send output for USART1.PINASSIGN3Table 70
U2_CTSIClear To Send input for USART1.PINASSIGN3Table 70
U2_SCLKI/OSerial clock input/output for USART1 in synchronous
SPI0_SCKI/OSerial clock for SPI0.PINASSIGN3Table 70
SPI0_MOSII/OMaster Out Slave In for SPI0.PINASSIGN4Table 71
SPI0_MISOI/OMaster In Slave Out for SPI0.PINASSIGN4Table 71
SPI0_SSEL0I/OSlave select 0 for SPI0.PINASSIGN4Table 71
SPI0_SSEL1I/OSlave select 0 for SPI1.PINASSIGN4Table 71
SPI0_SSEL2I/OSlave select 0 for SPI2.PINASSIGN5Table 72
SPI0_SSEL3I/OSlave select 0 for SPI3.PINASSIGN5Table 72
SPI1_SCKI/OSerial clock for SPI1.PINASSIGN5Table 72
SPI1_MOSII/OMaster Out Slave In for SPI1.PINASSIGN5Table 72
SPI1_MISOI/OMaster In Slave Out for SPI1.PINASSIGN6Table 73
SPI1_SSEL0I/OSlave select 0 for SPI1.PINASSIGN6Table 73
SPI1_SSEL1I/OSlave select 1 for SPI1.PINASSIGN6Table 73
SCT_PIN0IPin input 0 to the SCT input multiplexer.PINASSIGN6Table 73
SCT_PIN1IPin input 1 to the SCT input multiplexer.PINASSIGN7Table 74
SCT_PIN2IPin input 2 to the SCT input multiplexer.PINASSIGN7Table 74
SCT_PIN3IPin input 3 to the SCT input multiplexer.PINASSIGN7Table 74
SCT_OUT0OSCT output 0.PINASSIGN7Table 74
SCT_OUT1OSCT output 1.PINASSIGN8Table 75
The switch matrix consists of two blocks of pin-assignment registers PINASSIGN and
PINENABLE. Every function has an assigned field (1-bit or 8-bit wide) within this bank of
registers where you can program the external pin - identified by its GPIO function - you
want the function to connect to.
GPIOs range from PIO0_0 to PIO0_28 and, for assignment through the pin-assignmen t
registers, are numbered 0 to 28.
There are two types of functions which must be assigned to port pins in different ways:
1. Movable functions (PINASSIGN0 to 11):
All movable functions are digital functions. Assign movable functions to pin numbers
through the 8 bits of the PINASSIGN register associated with this function. Once the
function is assigned a pin PIO0_n, it is connected through this pin to a physical pin on
the package.
Remark: You can assign only one digital output function to an external pin at any
given time.
Remark: You can assign more than one digital input function to one external pin.
2. Fixed-pin functions (PINENABLE0):
Some functions require pins with special characteristics and cannot be moved to
other physical pins. Hence these functions are mapped to a fixed port pin. Examples
of fixed-pin functions are the oscillator pins or comparator inputs.
Each fixed-pin function is associated with one bit in the PINENABLE0 register which
selects or deselects the function.
– If a fixed-pin function is deselected, any movable function can be assigned to its
The IOCON block is identical for all LPC82x parts. Registers for pins that are not available
on a specific package are reserved.
Table 80.Pinout summary
PackagePins/configuration registers av ailable
TSSOP20PIO0_0 to PIO0_5; PIO0_8 to PIO0_15; PIO0_17; PIO0_23
HVQFN33PIO0_0 to PIO0_28
8.2 Features
The following electrical properties are configurable for each pin:
• Pull-up/pull-down resistor
• Open-drain mode
• Hysteresis
• Digital glitch filter with programmable time constant
• Analog mode (for a subset of pins, see the LPC82x data sheet)
The true open-drain pins PIO0_10 and PIO0_11 can be configured for different I2C-bus
speeds.
8.3 Basic configuration
Enable the clock to the IOCON in the SYSAHBCLKCTRL register (Table 35, bit 18). Once
the pins are configured, you can disable the IOC ON clock to cons er ve pow er.
Remark: If the open-drain pins PIO0_10 and PIO0_11 are not available on the package,
prevent the pins from internally floating as follows: Set bits 10 and 11 in the GPIO DIR0
register to 1 to enable the output driver and write 1 to bits 10 and 11 in the GPIO CLR0
register to drive the outputs LOW internally.
The pin function is determined entirely through the switch matrix. By default one of the
GPIO functions is assigned to each pin. The switch matrix can assign all functions from
the movable function table to any p in in the IOCON block or enable a special function like
an analog input on a specific pin.
Related links:
Table 65 “
Movable functions (assign to pins PIO0_0 to PIO0_28 through switch matrix)”
8.4.3Pin mode
The MODE bit in the IOCON register allows enabling or disabling an on-chip pull-up
resistor for each pin. By default all pull-up resistors are enabled except for the I
pins PIO0_10 and PIO0_11, which do not have a programmable pull-up resistor.
The repeater mode enables the pull-up resistor if the pin is high and enables the
pull-down resistor if the pin is low. This causes the pin to retain its last known state if it is
configured as an input and is not driven externally. Repeater mode may typically be used
to prevent a pin from floating (and potentially using significant power if it floats to an
indeterminate state) if it is temporarily not driven.
8.4.4Open-drain mode
An open-drain mode can be enabled for all digital I/O pins that are not the I2C-bus pins.
This mode is not a true open-drain mode. The input cannot be pulled up above V
Remark: As opposed to the true open-drain I2C-bus pins, digital pins with configurable
open-drain mode are not 5 V tolerant when V
8.4.5Analog mode
The switch matrix automatically configures the pin in analog mode whenever an analog
input or output is selected as the pin’s function.
8.4.6I2C-bus mode
UM10800
Chapter 8: LPC82x I/O configuration (IOCON)
.
DD
=0.
DD
The I2C-bus pins PIO0_10 and PIO0_11 can be programmed to support a true open-drain
mode independently of whether the I2C function is selected or another digital function. If
2
the I
C function is selected, all three I2C modes, Standard mode, Fast-mode, and
Fast-mode plus, are supported. A digital glitch filter can be configured for all functions.
Pins PIO0_10 and PIO0_11 operate as high-current sink drivers (20 mA) independently of
the programmed function.
Remark: Pins PIO0_10 and PIO0_11 are 5 V tolerant when V
operating voltage level.
8.4.7Programmable digital filter
All GPIO pins are equipped with a programmable, digital glitch filter. The filter rejects input
pulses with a selectable duration of shorter than one, two, or three cycles of a filter clock
(S_MODE = 1, 2, or 3). For each individual pin, the filter clock can be selected fro m one of
seven peripheral clocks PCLK0 to 6, which are derived from the main clock using the
IOCONCLKDIV0 to 6 registers. The filter can also be bypassed entirely.
Any input pulses of duration T
T
pulse
T
PCLKn
S_MODE
Input pulses of one filter clock cycle longer may also be rejected:
T
pulse
T
´ (S_MODE + 1)
PCLKn
pulse
= 0 and when VDD is at
DD
of either polarity will be rejected if:
Remark: The filtering ef fect is accomplished by requiring that the input signal be stable for
(S_MODE +1) successive edges of the filter clock before being passed on to the chip.
Enabling the filter results in delaying the signal to the internal logic and should be done
only if specifically required by an application. For high-speed or time critical functions
ensure that the filter is bypassed.
If the delay of the input signal must be minimized, select a faster PCLK and a higher
sample mode (S_MODE) to minimize the effect of the potential extra clock cycle.