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”