• Modifications to the user manual applicable to parts LPC1311/01 and LPC1313/01 only:
– SSP1 added for part LPC1313FBD48/01 in Chapter 3 “LPC13xx System
configuration” and Chapter 14 “LPC13xx SSP0/1”.
– UART functions for part LPC1313FBD48/01 added in Table 128, Table 129,
Table 134, and Table 138.
– Use of IRC for entering deep power-down updated in Section 3.9.4.2
– Enable sequence for UART clock updated in Section 12.1.
– Chapter 5 “LPC13xx Power profiles”
– Register IOCON_DSR_LOC (Table 140
IOCON_RI_LOC (Table 142
– Programmable bit OD for pseudo open-drain mode added to IOCON registers in
The LPC13xx are ARM Cortex-M3 based microcontrollers for embedded applications
featuring a high level of integration and low power consumption. The ARM Cortex-M3 is a
next generation core that offers system enhancements such as enhanced debug features
and a higher level of support block integration.
The LPC13xx operate at CPU frequencies of up to 72 MHz. The ARM Cortex-M3 CPU
incorporates a 3-stage pipeline and uses a Harvard arc hit ec tu re with s eparate loca l
instruction and data buses as well as a third bus for peripherals. The ARM Cortex-M3
CPU also includes an internal prefetch unit that supports speculative branching.
The peripheral complement of the LPC13xx series includes up to 32 kB of flash memory,
up to 8 kB of data memory, USB Device , one Fast-mode Plus (FM+) I
UART, four general purpose timers, and up to 42 general purpose I/O pins.
1.2 How to read this manual
This user manual describes parts LPC1311, LPC1313, LPC1342, LPC1343. Part-specific
features and registers are listed at the beginning of each chapter.
Remark: The LPC13xx series consists of the LPC1300 series (parts LPC1311/13/42/43)
and the LPC1300L series (parts LPC1311/01 and LPC1313/01). The LPC1300L series
features the following enhancements over the LPC1300 series:
• Power profiles with lower power consumption in Active and Sleep modes.
• Four levels for BOD forced reset.
• Second SSP controller (LPC1313FBD48/01 only).
• Windowed Watchdog Timer (WWDT).
• Internal pull-up resistors pull up pins to full V
• Programmable pseudo open-drain mode for GPIO pins.
1.3 Features
DD
level.
2
C interface, one
• ARM Cortex-M3 processor, running at frequencies of up to 72 MHz.
• ARM Cortex-M3 built-in Nested Vectored Interrupt Controller (NVIC).
Figure 2 shows the memory and peripheral address space of the LPC13xx.
The AHB peripheral area is 2 MB in size and is divided to allow for up to 128 peripherals.
On the LPC13xx, the GPIO ports are the only AHB peripherals. The APB peripheral area
is 512 kB in size and is divided to allow for up to 32 peripherals. Each peripheral of either
type is allocated 16 kB of space. This allows simplifying the address decoding for each
peripheral.
All peripheral register addresses are 32-bit word aligned regardless of their size. An
implication of this is that word and half-word registers must be accessed all at once. For
example, it is not possible to read or write the upper byte of a word register separately.
PDAWAKECFGR/W0x234Power-down st ates after wake-up from
PDRUNCFGR/W0x238Power-down configuration register bits 8 and 10
are reserved for parts LPC1311 and LPC1313:
DescriptionRegister bits
offset
mode
Deep-sleep mode
reserved for
LPC1311/13
bits 8 and 10
bits 8 and 10
SSP1
The SSP1 block is available on the LPC1313FBD48/01 only. SSP1 related registers and
register bits are reserved for the following parts: LPC1311/13/42/43 and
LPC1311FHN33/01 and LPC1313FHN33/01.
BOD control
The number of programmable BOD levels for forced reset is different for the LPC1300 and
the LPC1300L series. See Table 5
. The BOD trip levels for the LPC1300 and LPC1300L
series are listed in the LPC1311/13/42/43 data sheet.
For HVQFN packages, the start logic control bits (see Table 44
for port pins PIO2_1 to PIO2_11 and PIO3_0, PIO3_1, and PIO3_3.
PIO reset status registers
For HVQFN packages, the reset status bits (see Table 40
port pins PIO2_1 to PIO2_11 and PIO3_0 and PIO3_1, and PIO3_3.
Entering Deep power-down mode
Status of the IRC before entering Deep power-down mode (see Section 3.9.4.2
to Table 51) are re se rve d
and Table 41) are reserved for
):
• IRC must be enabled for parts LPC1311/13/42/43.
• IRC status has no effect for parts LPC1311/01 and LPC1313/01.
Enabling sequence for UART cloc k
Requirements for enabling the UART peripheral clock:
• The UART pins must be configured in the IOCON block before the UART clock can be enabled
in the SYSAHBCLKCTRL register (Table 25) for parts LPC1311/13/42/43.
in the
• The sequence of configuring the UART pins and the UART clock has no effect for
parts LPC1311/01 and LPC1313/01.
The system configuration block controls oscillators, the power management unit, and
clock generation of the LPC13xx. Also included in this block are registers for setting the
priority for AHB access and a register for remapping flash, SRAM, and ROM memory
areas.
See Figure 3 for an overview of the LPC13xx Clock Generation Unit (CGU).
The LPC131x include three independent oscillators. These are the system oscillator, the
Internal RC oscillator (IRC), and the Watchdog oscillator. Each oscillator can be used for
more than one purpose as required in a particular application.
Following reset, the LPC131x will operate from the Internal RC oscillator until switched by
software. This allows systems to operate without any external crystal and the bootloader
code to operate at a known frequency.
The SYSAHBCLKCTRL register gates the system clock to the various peripherals and
memories. UART, SSP0/1, the SysTick timer, and the ARM trace clock have individual
clock dividers to derive peripheral clocks from the main clock.
The USB clock, if available, and the watchdog clock, can be derived from the oscillator
output or the main clock.
The main clock, and the clock outputs from the IRC, the system oscillator, and the
watchdog oscillator can be observed directly on the CLKOUT pin.
STARTSRP0R0x20CStart logic status register 0; bottom 32
interrupts
START APRP1R/W0x210Start logic edge control register 1; top 8
interrupts
STARTERP1R/W0x214Start logic signal enable register 1; top 8
interrupts
STARTRSRP1CLRW0x218Start logic reset register 1; top 8
interrupts
STARTSRP1R0x21CStart logic status register 1; top 8
interrupts
--0x220 - 0x22CReserved-PDSLEEPCFGR/W0x230Power-down states in Deep-sleep mode0x0000 0000 Table 53
PDAWAKECFGR/W0x234Power-down states after wake-up from
This register allows software to reset the SSP0/1 and I2C peripherals. Writing a 0 to the
SSP0/1_RST_N or I2C_RST_N bits resets the SSP0/1 or I2C peripherals. Writing a 1
de-asserts the reset.
UM10375
Chapter 3: LPC13xx System configuration
description
value
0x0Boot Loader Mode. Interrupt vectors are re-mapped to Boot
ROM.
0x1User RAM Mode. Interrupt vectors are re-mapped to Static
RAM.
0x2User Flash Mode. Interrupt vectors are not re-mapped and
reside in Flash.
Remark: Before accessing the SSP0/1 and I2C peripherals, write a 1 to this register to
ensure that the reset signals to the SSP0/1 and I2C are de-asserted.
Table 9.Peripheral reset control register (PRESETCTRL, address 0x4004 8004) bit
description
BitSymbolValue DescriptionReset
0SSP0_RST_NSSP0 reset control0
0Reset SSP0.
1De-assert SSP0 reset.
1I2C_RST_NI2C reset control0
0Reset I2C.
1De-asset I2C reset.
2SSP1_RST_NSSP1 reset control0
0Reset the SSP1.
1De-assert SSP1 reset.
31:3--Reserved0x00
3.5.3 System 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 up to a high frequency, then divided down
to provide the actual clock used by the CPU, peripherals, and optionally the USB
subsystem. Note that the USB subsystem has its own dedicated PLL. The PLL can
produce a clock up to the maximum allowed for the CPU, which is 72 MHz.
Table 10. System PLL control register (SYSPLLCTRL, address 0x4004 8008) bit description
BitSymbolValue DescriptionReset
4:0MSELFeedback divider value. The division value M is the
6:5PSELPost divider ratio P. The division ratio is 2 P.0x00
31:7--Reserved. Do not write ones to reserved bits.0x00
3.5.4 System PLL status register
This register is a Read-only register and supplies the PLL lock status (see Section 3.11.1).
Table 11. System PLL status register (SYSPLLSTAT, address 0x4004 800C) bit description
BitSymbolValue DescriptionReset
0LOCKPLL lock status0x0
31:1--Reserved0x00
UM10375
Chapter 3: LPC13xx System configuration
value
0x000
programmed MSEL value + 1.
00000: Division ratio M = 1
to
11111: Division ratio M = 32.
0x0P = 1
0x1P = 2
0x2P = 4
0x3P = 8
value
0PLL not locked
1PLL locked
3.5.5 USB PLL control register
The USB PLL is identical to the system PLL and is used to provide a dedicated clock to
the USB block if available (see Section 3.1
This register connects and enables the USB PLL and configures the PLL multiplier and
divider values. The PLL accepts an input frequency from 10 MHz to 25 MHz from various
clock sources. The input frequency is multiplied up to a high frequency, then divided down
to provide the actual clock 48 MHz clock used by the USB subsystem.
Remark: The USB PLL must be connected to the system oscillator for correct USB
operation (see Table 20
Table 12. USB PLL control regis t er (USBPLLCTRL, address 0x4004 8010) bit description
BitSymbolValue DescriptionReset
4:0MSELFeedback divider value. The division value M is the
This register configures the frequency range for the system oscillator.
Table 14. System oscillator control register (SYSOSCCTRL, address 0x4004 8020) bit
BitSymbolValueDescriptionReset
0BYPASSBypass system oscillator0x0
1FREQRANGEDetermines frequency range for Low-power
31:2--Reserved0x00
UM10375
Chapter 3: LPC13xx System configuration
description
value
0Oscillator is not bypassed.
1Bypass enabled. PLL input (sys_osc_clk) is fed
directly from the XTALIN and XTALOUT pins.
0x0
oscillator.
01 - 20 MHz frequency range.
115 - 25 MHz frequency range
3.5.8 Watchdog 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 500 kHz and 3.4 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)) = 7.8 kHz to 1.7 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 clock.
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 15. Watchdog oscillator control register (WDTOSCCTRL, address 0x4004 8024) bit
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, bu t if anothe r rese t signa l (e.g., EXT RST) re mains asserted af ter the POR signal
is negated, then its bit is set to detected.
Table 17. System reset status register (SYSRESSTAT, address 0x4004 8030) bit description
BitSymbolValueDescriptionReset
0PORPOR reset status0x0
1EXTRST0x0
2WDTStatus of the Watchdog reset0x0
3BODStatus of the Brown-out detect reset0x0
4SYSRSTStatus of the software system reset. The ARM software
31:5--Reserved0x00
Chapter 3: LPC13xx System configuration
0No POR detected
1POR detected
0No RESET
1RESET
0No WDT reset detected
1WDT reset detected
0No BOD reset detected
1BOD reset detected
reset has the same effect as the hardware reset using the
RESET
0No System reset detected
1System reset detected
event detected
detected
pin.
UM10375
value
0x0
3.5.11 System PLL clock source select register
This register selects the clock source for the system PLL. The SYSPLLCLKUEN register
(see Section 3 .5.12
Remark: The system oscillator must be selected if the system PLL is used to generate a
48 MHz clock to the USB block.
Remark: When switching clock sources, both clocks must be running before the clock
source is updated.
) must be toggled from LOW to HIGH for the update to take effect.
NXP Semiconductors
T able 18. System PLL clock source select register (SYSPLLCLKSEL, address 0x4004 8040)
BitSymbolValue DescriptionReset
1:0SELSystem PLL clock source0x00
31:2--Reserved0x00
3.5.12 System PLL clock source update enable register
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.
Remark: When switching clock sources, both clocks must be running before the clock
source is updated.
This register selects the clock source for the dedicated USB PLL. The USBPLLCLKUEN
register (see Section 3.5.14
effect.
Remark: When switching clock sources, both clocks must be running before the clock
source is updated in the USBPLLCLKUEN register. For USB operation, the clock source
must be switched from IRC to system oscillator with both the IRC and the system
oscillator running. After the switch, the IRC can be turned off.
T able 20. USB PLL clock source select register (USBPLLCLKSEL, address 0x4004 8048) bit
description
BitSymbolValue DescriptionReset
1:0SELUSB PLL clock source0x00
0x0IRC. The USB PLL clock source must be switched to system
) must be toggled from LOW to HIGH for the update to take
value
oscillator for correct USB operation.
NXP Semiconductors
3.5.14 USB PLL clock source update enable register
This register updates the clock source of the USB PLL with the new input clock after the
USBPLLCLKSEL register has been written to. In order for the update to take effect at the
USB PLL input, first write a zero to the USBPLLUEN register and then write a one to
USBPLLUEN.
Remark: The system oscillator must be selected in the USBPLLCLKSEL register in order
to use the USB PLL, and this register must be toggled to update the USB PLL clock with
the system oscillator.
Remark: When switching clock sources, both clocks must be running before the clock
source is updated.
T able 21. USB PLL clock source update enable register (USBPLLCLKUEN, address 0x4004
BitSymbolValueDescriptionReset value
0ENAEnable USB PLL clock source update0x0
31:1--Reserved0x00
UM10375
Chapter 3: LPC13xx System configuration
804C) bit description
0No change
1Update clock source
3.5.15 Main clock source select register
This register selects the main system clock which can be either any input to the system
PLL, the output from the system PLL (sys_pllclkout), or the watchdog or IRC oscillators
directly. The main system clock clocks the core, the peripherals and memories, and
optionally the USB block.
The MAINCLKUEN register (see Section 3.5.16
the update to take effect.
Remark: When switching clock sources, both clocks must be running before the clock
source is updated.
Table 22. Main clock source select register (MAINCLKSEL, address 0x4004 8070) bit
description
BitSymbolValue DescriptionReset value
1:0SELClock source for main clock0x00
0x0IRC oscillator
0x1Input clock to system PLL
0x2WDT oscillator
0x3System PLL clock out
31:2--Reserved0x00
) must be toggled from LOW to HIGH for
3.5.16 Main clock source update enable register
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 the MAINCLKUEN register and then write a one to MAINCLKUEN.
This register divides the main clock to provide the system clock to the core, memories,
and the peripherals. The system clock can be shut down completely by setting the DIV
bits to 0x0.
Table 24. System AHB clock divider register (SYSAHBCLKDIV, address 0x4004 8078) bit
BitSymbolDescriptionReset value
7:0DIVSystem AHB clock divider values
31:8-Reserved0x00
UM10375
Chapter 3: LPC13xx System configuration
bit description
0No change
1Update clock source
description
0x01
0: System clock disabled.
1: Divide by 1.
to
255: Divide by 255.
3.5.18 System AHB clock control register
The SYSAHBCLKCTRL register enables the clocks to individual system and peripheral
blocks. The system clock (sys_ahb_clk[0], bit 0 in the SYSAHBCLKCTRL register)
provides the clock for the AHB to APB bridge, the AHB matrix, the ARM Cortex-M3, the
Syscon block, and the PMU. This clock cannot be disabled.
Table 25. System AHB clock control register (SYSAHBCLKCTRL, address 0x4004 8080) bit
description
BitSymbolValueDescriptionReset
0SYSEnables clock for AHB to APB bridge, to the AHB
matrix, to the Cortex-M3 FCLK and HCLK, to the
SysCon, and to the PMU. This bit is read only.
0Reserved
1Enabled
Table 25. System AHB clock control register (SYSAHBCLKCTRL, address 0x4004 8080) bit
BitSymbolValueDescriptionReset
3FLASHREGEnables clock for flash register interface.1
4FLASHARRAYEnables clock for flash array access.1
5I2CEnables clock for I2C.0
6GPIOEnables clock for GPIO.1
7CT16B0Enables clock for 16-bit counter/timer 0.0
8CT16B1Enables clock for 16-bit counter/timer 1.0
9CT32B0Enables clock for 32-bit counter/timer 0.0
10CT32B1Enables clock for 32-bit counter/timer 1.0
11SSPEnables clock for SSP.1
12UARTEnables clock for UART. Note that for the
13ADCEnables clock for ADC.0
14USB_REGEnables clock for USB_REG.1
description
UM10375
Chapter 3: LPC13xx System configuration
…continued
value
0Disabled
1Enabled
0Disabled
1Enabled
0Disabled
1Enabled
0Disabled
1Enabled
0Disabled
1Enabled
0Disabled
1Enabled
0Disabled
1Enabled
0Disabled
1Enabled
0Disabled
1Enabled
0
LPC1311/13/42/43, the UAR T pins must be configured
in the IOCON block before the UART clock can be
enabled. For the LPC1311/01 and LPC1313/01 no
special enabling sequence is required.
0: Disable SSP0_PCLK.
1: Divide by 1.
to
255: Divide by 255.
31:8-Reserved0x00
3.5.20 UART clock divider register
This register configures the UART peripheral clock UART_PCLK. The UART_PCLK can
be shut down by setting the DIV bits to 0x0.
Remark: Note that for the LPC1311/13/42/43, the UART pins must be configured in the
IOCON block before the UART clock can be enabled. For the LPC1311/01 and
LPC1313/01 no special enabling sequence is required.
0: Disable SYSTICK timer clock.
1: Divide by 1.
to
255: Divide by 255.
31:8-Reserved0x00
0x00
3.5.24 USB clock source select register
This register selects the clock source for the USB usb_clk. The clock source can be either
the USB PLL output or the main clock, and the clock can be further divided by the
USBCLKDIV register (see Table 33
The USBCLKUEN register (see Section 3.5.25
the update to take effect.
Remark: When switching clock sources, both clocks must be running before the clock
source is updated. The default clock source for the USB controller is the USB PLL output.
For switching the clock source to the main clock, ensure that the system PLL and the USB
PLL are running to make both clock sources available for switching. The main clock must
be set to 48 MHz and configured with the main PLL and the system oscillator. After the
switch, the USB PLL can be turned off.
Table 31. USB clock source select register (USBCLKSEL, address 0x4004 80C0) bit
BitSymbolValue DescriptionReset
1:0SELUSB clock source0x00
31:2--Reserved0x00
UM10375
Chapter 3: LPC13xx System configuration
description
value
0x0USB PLL out
0x1Main clock
0x2Reserved
0x3Reserved
3.5.25 USB clock source update enable register
This register updates the clock source of the USB with the new input clock after the
USBCLKSEL register has been written to. In order for the update to take effect, first write
a zero to the USBCLKUEN register and then write a one to USBCLKUEN.
Remark: When switching clock sources, both clocks must be running before the clock
source is updated.
T able 32. USB clock source update enable register (USBCLKUEN, address 0x4004 80C4) bit
description
BitSymbolValueDescriptionReset value
0ENAEnable USB clock source update0x0
0No change
1Update clock source
31:1--Reserved0x00
3.5.26 USB clock divider register
This register allows the USB clock usb_clk to be divided to 48 MHz. The usb_clk can be
shut down by setting the DIV bits to 0x0.
Table 33. USB clock divider register (USBCLKDIV, address 0x4004 80C8) bit description
BitSymbolDescriptionReset value
7:0DIVUSB clock divider values.
0: Disable USB clock.
1: Divide by 1.
to
255: Divide by 255.
This register selects the clock source for the watchdog timer. The WDTCLKUEN register
(see Section 3 .5.28
Remark: When switching clock sources, both clocks must be running before the clock
source is updated. Once the WWDT (LPC1311/01 and LPC1313/01 only) is enabled, the
watchdog clock source cannot be changed. If the watchdog timer is runnin g in Deep-sleep
mode, always select the watchdog oscillator as clock source (see Section 3.9.3.2
Table 34. WDT clock sou rce select register (WDTCLKSEL, address 0x4004 80D0) bit
BitSymbolValue DescriptionReset
1:0SELWDT clock source0x00
31:2--Reserved0x00
UM10375
Chapter 3: LPC13xx System configuration
) must be toggled from LOW to HIGH for the update to take effect.
This register updates the clock source of the watchdog timer with the new input clock af ter
the WDTCLKSEL register has been written to. In order for the update to take effect at the
input of the watchdog timer, first write a zero to the WDTCLKUEN register and then write
a one to WDTCLKUEN.
Remark: When switching clock sources, both clocks must be running before the clock
source is updated.
This register configures the clkout_clk signal to be output on the CLKOUT pin. All three
oscillators and the main clock can be selected for the clkout_clk clock.
UM10375
Chapter 3: LPC13xx System configuration
The CLKOUTCLKUEN register (see Section 3.5.31
) must be toggled from LOW to HIGH
for the update to take effect.
Remark: When switching clock sources, both clocks must be running before the clock
source is updated.
T able 37.CLKOUT clock source select register (CLKOUTCLKSEL, address 0x4004 80E0) bit
This register updates the clock source of the CLKOUT pin with the new clock after the
CLKOUTCLKSEL register has been written to. In order for the update to take effect at the
input of the CLKOUT pin, first write a zero to the CLKCLKUEN register and then write a
one to CLKCLKUEN.
value
Remark: When switching clock sources, both clocks must be running before the clock
The PIOPORCAP0 register captures the state (HIGH or LOW) of the PIO pins of ports 0,1,
and 2 (pins PIO2_0 to PIO2_7) at power-on-reset. Each bit represents the reset state of
one GPIO pin. This register is a read-only status register.
Table 40. POR captured PIO status registers 0 (PIOPORCAP0, address 0x4004 8100) bit
BitSymbolDescriptionReset value
11:0CAPPIO0_11 to
23:12 CAPPIO1_11 to
31:24 CAPPIO2_7 to
description
description
CAPPIO0_0
CAPPIO1_0
CAPPIO2_0
0: Disable CLKOUT.
1: Divide by 1.
to
255: Divide by 255.
Raw reset status input PIO0_1 1 to
PIO0_0
Raw reset status input PIO1_1 1 to
PIO1_0
Raw reset status input PIO2_7 to
PIO2_0
UM10375
Chapter 3: LPC13xx System configuration
0x00
User implementation dependent
User implementation dependent
User implementation dependent
3.5.34 POR captured PIO status register 1
The PIOPORCAP1 register captures the state (HIGH or LOW) of the PIO pins of port 2
(PIO2_8 to PIO2_11) and port 3 at power-on-reset. Each bit represents the reset state of
one PIO pin. This register is a read-only status register.
Table 41. POR captured PIO status registers 1 (PIOPORCAP1, address 0x4004 8104) bit
description
BitSymbolDescriptionReset value
0CAPPIO2_8Raw reset status input PIO2_8User implementation dependent
1CAPPIO2_9Raw reset status input PIO2_9User implementation dependent
2CAPPIO2_10Raw reset status input PIO2_10User implementation dependent
3CAPPIO2_11Raw reset status input PIO2_11User implementation dependent
4CAPPIO3_0Raw reset status input PIO3_0User implementation dependent
5CAPPIO3_1Raw reset status input PIO3_1User implementation dependent
6CAPPIO3_2Raw reset status input PIO3_2User implementation dependent
7CAPPIO3_3Raw reset status input PIO3_3User implementation dependent
8CAPPIO3_4Raw reset status input PIO3_4 User implementation dependent
9CAPPIO3_5Raw reset status input PIO3_5 User implementation dependent
31:10 -Reserved-
The STARTAPRP0 register controls the start logic inputs of ports 0 (PIO0_0 to PIO0_11)
and 1 (PIO1_0 to PIO1_11) and the lower 8 inputs of port 2 (PIO2_0 to PIO2_7). This
register selects a falling or rising edge on the corresponding PIO input to produce a falling
or rising clock edge, respectively, for the start logic (see Section 3.10.2
Every bit in the STARTAPRP0 register controls one port input and is connected to one
wake-up interrupt in the NVIC. Bit 0 in the ST AR TAPRP0 register corresponds to interrupt
0, bit 1 to interrupt 1, etc. (see Table 66
register, the top 8 interrupts are contained in the STARTAPRP1 register for total of 40
wake-up interrupts.
Remark: Each interrupt connected to a start log ic input must be enabled in the NVIC if the
corresponding PIO pin is used to wake up the chip from Deep-sleep mode.
Table 44. Start logic edge control register 0 (STARTAPRP0, address 0x4004 8200) bit
Writing a one to a bit in the STARTRSRP0CLR register resets the start logic state. T he bit
assignment is identical to Table 44
clock edge for registering a start signal. This clock edge (falling or rising) sets the interrupt
for waking up from Deep-sleep mode. Therefore, the st art-up logic st ates must be cleared
before being used.
11:0RSRPIO0_nStart signal reset for start logic input PIO0_n (bit 0 = PIO0_0, ...,
23:12RSRPIO1_nStart signal reset for st art logic input PIO1_n (bit 12 = PIO1_0, ...,
31:24RSRPIO2_nStart signal reset for st art logic input PIO2_n (bit 24 = PIO2_0, ...,
UM10375
Chapter 3: LPC13xx System configuration
. The start-up logic uses the input signals to generate a
description
value
0
bit 11 = PIO0_11).
0 = Do nothing.
1 = Write: reset start signal.
0
bit 23 = PIO1_11).
0 = Do nothing.
1 = Write: reset start signal.
0
bit 31 = PIO2_7).
0 = Do nothing.
1 = Write: reset start signal.
3.5.40 Start logic status register 0
This register reflects the status of the enabled start signal bits. The bit assignment is
identical to Table 44
. Each bit (if enabled) reflects the state of the start logic, i.e. whether
or not a wake-up signal has been received for a given pin.
Table 47. Start logic status register 0 (STARTSRP0, address 0x4004 820C) bit description
BitSymbolDescriptionReset
1 1:0SRPIO0_nStart signal status for start logic input PIO0_n (bit 0 = PIO0_0, ...,
bit 11 = PIO0_11).
0 = No start signal received.
1 = Start signal pending.
23:12 SRPIO1_nStart signal status for st art logic input PIO1_n (bit 12 = PIO1_0, ...,
bit 23 = PIO1_11).
0 = No start signal received.
1 = Start signal pending.
31:24 SRPIO2_nStart signal status for st art logic input PIO2_n (bit 24 = PIO2_0, ...,
bit 31 = PIO2_7).
0 = No start signal received.
1 = Start signal pending.
3.5.41 Start logic edge control register 1
The STARTAPRP1 register controls the start logic inputs of ports 2 (PIO2_8 to PIO2_11)
and 3 (PIO3_0 to PIO3_3). This register selects a falling or rising edge on the
corresponding PIO input to produce a falling or rising clock edge, respectively, for the
start-up logic.
Every bit in the STARTAPRP1 register controls one port input and is connected to one
wake-up interrupt in the NVIC. Bit 0 in the ST AR TAPRP1 register corresponds to interrupt
32, bit 1 to interrupt 33, up to bit 7 corresponding to interrupt 39 (see Table 66
Remark: Each interrupt connected to a start log ic input must be enabled in the NVIC if the
corresponding PIO pin is used to wake up the chip from Deep-sleep mode.
Table 48. Start logic edge control register 1 (STARTAPRP1, address 0x4004 8210) bit
Writing a one to a bit in the STARTRSRP1CLR register resets the start logic state. T he bit
assignment is identical to Table 48
clock edge for registering a start signal. This clock edge (falling or rising) sets the interrupt
for waking up from Deep-sleep mode. Therefore, the st art-up logic st ates must be cleared
before being used.
. The start-up logic uses the input signals to generate a
• BOD: Leaving the BOD circuit enabled will protect the part from a low voltage event
• WD oscillator: The watchdog oscillator can be left running in Deep-sleep mode to
Remark: Reserved bits in this register must always be written as indicated. This register
must be initialized correctly before entering Deep-sleep mode.
Table 53. Deep-sleep configuration register (PDSLEEPCFG, address 0x4004 8230) bit
BitSymbolValueDescriptionReset
2:0FIXEDVAL-Reserved. Always write these bits as 111.0
3BOD_PDBOD power-down control in Deep-sleep mode, see
5:4FIXEDVAL-Reserved. Always write these bits as 11.0
6WDTOSC_PDWatchdog oscillator power control in Deep-sleep
11:7FIXEDVAL-Reserved. Always write these bits as 11111.0
31:12 -0Reserved0
UM10375
Chapter 3: LPC13xx System configuration
occurring while the part is in Deep-sleep mode. However, the BOD circuit causes an
additional current drain in Deep-sleep mode.
provide a clock for the watchdog timer or a general purpose timer if they are needed
for timing a wake-up event (see Section 3.10.3
oscillator analog output frequency must be set to its lowest value (bits FREQSEL in
the WDTOSCCTRL = 0001, see Table 15
timer clock must be disabled in the SYSAHBCLKCTRL register (see Table 25
entering Deep-sleep mode.
The watchdog oscillator, if running, contributes an additional current drain in
Deep-sleep mode.
description
Table 52
0Powered
1Powered down
mode, see Table 52
0Powered
1Powered down
.
for details). In this case, the watchdog
) and all peripheral clocks other than the
) before
value
0
0
.
3.5.46 Wake-up configuration register
The bits in this register can be programmed to determine the state the chip must enter
when it is waking up from Deep-sleep mode.
Remark: Reserved bits in this register must always be written as indicated. This register
must be initialized correctly before entering Deep-sleep mode.
Table 54. Wake-up configuration register (PDAWAKECFG, address 0x4004 823 4) bi t
9FIXEDVAL-Reserved. Always write this bit as 0.0
10USBPAD_PDUSB pad wake-up configuration1
11FIXEDVAL-Reserved. Always write this bit as 1.1
31:12 --Reserved0
description
UM10375
Chapter 3: LPC13xx System configuration
…continued
value
0Powered
1Powered down
0Powered
1Powered down
0Powered
1Powered down
0Powered
1Powered down
0Powered
1Powered down
0Powered
1Powered down
0Powered
1Powered down
0Powered
1Powered down
0USB PHY powered
1USB PHY powered down
3.5.47 Power-down configuration register
The bits in the PDRUNCFG register control 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 power-down state
takes effect.
This device ID register is a read-only register and contains the device ID for each
LPC13xx part. This register is also read by the ISP/IAP commands (see Section 21.13.11
and Section 21.13.11
Table 56. Device ID register (DEVICE_ID, address 0x4004 83F4) bit description
Reset has four sources on the LPC13xx: the RESET pin, Watchdog Reset, Power-On
Reset (POR), and Brown Out Detect (BOD). In addition, there is a software reset.
The RESET
pin is a Schmitt trigger input pin. Assertion of chip Reset by any source, once
the operating voltage attains a usable level, starts the 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 (software reset, POR, BOD reset, External reset, and
Watchdog reset), 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 boot code in the ROM starts. The boot code performs the boot tasks and may
jump to the flash.
3. The flash is powered up. This takes approximately 100 s. Then the flash initialization
sequence is started, which takes about 250 cycles.
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.
3.7 Start-up behavior
See Figure 4 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 thre shold value
of 1.8 V.
The LPC13xx includes four levels for monitoring the voltage on the VDD pin. If this voltage
falls below one of the four selected levels, the BOD asserts an interrupt signal to the
NVIC. This signal can be enabled for interrupt in the Interr upt Enable Register in the NVIC
in order to cause a CPU interrupt; if not, software can monitor the signal by reading a
dedicated status register. Oneadditional threshold level can be se lected to cause a forc ed
reset of the chip on the LPC1311/13/42/43 parts. Four additional threshold levels for
forced reset can be selected on the LPC1311/01 and LPC1313/01 parts.
3.9 Power management
The LPC13xx support a variety of power control 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 three special modes of processor power reduction:
Sleep mode, Deep-sleep mode, and Deep power-down mode.
Remark: The Debug mode is not supported in Sleep, Deep-sleep, or Deep powe r-down
modes.
In Active mode, the ARM Cortex-M3 core and memories are clocked by the system clock,
and peripherals are clocked by the system clock or a dedicated peripheral 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.
3.9.1.1 Power 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
• The power to various analog blocks (USB, PLL, oscillators, the ADC, the BOD circuit,
• The clock source for the system clock can be selected from the IRC (default), the
• The system clock frequency can be selected by the SYSPLLCTRL (Table 10) and the
• Selected peripherals (UART, SSP0/1, WDT) use individual peripheral clocks with their
UM10375
Chapter 3: LPC13xx System configuration
running (Table 25
and the flash block) can be controlled at any time individually through the
PDRUNCFG register (Table 55
system oscillator, or the watchdog oscillator (see Figure 3
SYSAHBCLKDIV register (Table 24
own clock dividers. The peripheral clocks can be shut down through the
corresponding clock divider registers (Table 26
).
).
and related registers).
).
to Table 36).
3.9.2 Sleep mode
In Sleep mode, the system clock to the ARM Cortex-M3 core is stopped, and e xecution of
instructions is suspended until either a reset or an enabled 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 their related controllers, and internal buses. The processor state
and registers, peripheral registers, and int er na l SRAM va lue s ar e ma in tained, and th e
logic levels of the pins remain static.
3.9.2.1 Power 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
not clocked.
• Analog and digital peripherals are selected as in Active mode.
3.9.2.2 Programming Sleep mode
The following steps must be performed to enter Sleep mode:
1. The DPDEN bit in the PCON register must be set to zero (Table 61
2. The SLEEPDEEP bit in the ARM Cortex-M3 SCR register must be set to zero.
3. Use the ARM Cortex-M3 Wait-For-Interrupt (WFI) instruction.
3.9.2.3 Wake-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.
3.9.3 Deep-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 must be selected or deselected during Deep-sleep mode in the PDSLEEPCFG
register.
Deep-sleep mode eliminates all power used by the flash and analog peripherals, and all
dynamic power used by the processor itself, memory systems and their 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 rema in static.
UM10375
Chapter 3: LPC13xx System configuration
3.9.3.1 Power configuration in Deep-sleep mode
Power consumption in Deep-sleep mode is determined by the Deep-sleep power
configuration setting in the PDSLEEPCFG (Table 53
• The only clock source available in Deep-sleep mode is the watchdog oscillator. The
watchdog oscillator can be left running in Deep-sleep mode if required for
timer-controlled wake-up (see Section 3.10.3
system oscillator) and the system PLL are shut down. The watchdog oscillator analog
output frequency must be set to the lowest value of its analog clock output (bits
FREQSEL in the WDTOSCCTRL = 0001, see Table 15
• The BOD circuit can be left running in Deep-slee p mode if r equir ed by th e application .
• If the watchdog oscillator is running in Deep-sleep mode, only the watchdog timer or
one of the general-purpose timers should be enabled in SYSAHBCLKCTRL register
to minimize power consumption.
3.9.3.2 Programming Deep-sleep mode
The following steps must be performed to enter Deep-sleep mode:
1. The DPDEN bit in the PCON register must be set to zero (Table 61
2. Select the power configuration in Deep-sleep mode in the PDSLEEPCFG (Table 53
register.
a. If a timer-controlled wake-up is needed, ensure that the watchdog oscillator is
powered in the PDRUNCFG register and switch the clock source to WD oscillator
in the MAINCLKSEL register (Table 22
b. If timer-controlled wake-up is not needed and the watchdog oscillator is shut down,
ensure that the IRC is powered in the PDRUNCFG register and switch the clock
source to IRC in the MAINCLKSEL register (Table 22
system clock is shut down glitch-free.
3. Select the power configuration after wake-up in the PDAWAKECFG (Table 54)
4. If an external pin is used for wake-up, enable and clear the wake-up pin in the start
5. In the SYSAHBCLKCTRL register (Table 25
6. Write one to the SLEEPDEEP bit in the ARM Cortex-M3 SCR register.
7. Use the ARM WFI instruction.
3.9.3.3 Wake-up from Deep-sleep mode
The microcontroller can wake up from Deep-sleep mode in the following ways:
• Signal on an external pin. For this purpose, pins PIO0_0 to PIO0_11 and PIO1_0 can
• Input signal to the start logic created by a match event on one of the g enera l pur po se
• Reset from the BOD circuit. In this case, the BOD circuit must be enabled in the
• Reset from the watchdog timer. In this case, the watchdog oscillator must be running
• A reset signal from the external RESET pin.
UM10375
Chapter 3: LPC13xx System configuration
register.
logic registers (Table 44
counter/timer or WDT if needed.
be enabled as inputs to the start logic. The star t logic does not requ ire any clocks and
generates the interrupt if enabled in the NVIC to wake up from Deep-sleep mode.
timer external match outputs. The pin holding the timer match function mu st be
enabled as start logic input in the NVIC, the corresponding timer must be enabled in
the SYSAHBCLKCTRL register, and the watchdog oscillator must be running in
Deep-sleep mode (for details see Section 3.10.3
PDSLEEPCFG register, and the BOD reset must be enabled in the BODCTRL
register (Table 42
in Deep-sleep mode (see PDSLEEPCFG register), and the WDT must be enabled in
the SYSAHBCLKCTRL register.
to Table 51), and enable the start logic interrupt in the NVIC.
), disable all peripherals except
).
).
Remark: If the watchdog oscillator is running in Deep-sleep mode, its frequency
determines the wake-up time causing the wake-up time to be longer than waking up with
the IRC.
3.9.4 Deep power-down mode
In Deep power-down mode, power and clocks are shut off to the entire chip with the
exception of the WAKEUP pin. The Deep power-down mode is controlled by the PMU
(see Chapter 4
During Deep power-down mode, the con tents of the SRAM and registers are not re tained
except for a small amount of data which can be stored in the five 32-bit general purpose
registers of the PMU block.
All functional pins are tri-stated in Deep power-down mode except for the WAKEUP pin.
3.9.4.1 Power configuration in Deep power-down mode
Deep power-down mode has no configur at ion options. All clocks, the core, and all
peripherals are powered down. Only the WAKEUP pin is powered.
The following steps must be performed to enter Deep power-down mode:
UM10375
Chapter 3: LPC13xx System configuration
1. Write one to the DPDEN bit in the PCON register (see Table 61
2. Store data to be retained in the general purpose registers (Table 62
3. Write one to the SLEEPDEEP bit in the ARM Cortex-M3 SCR register.
4. For the LPC1311/13/42/43, ensure that the IRC is powered by setting bits
IRCOUT_PD and IRC_PD to zero in the PDRUNCFG register before en te rin g Deep
power-down mode. This step is not required for the LPC1311/01 and LPC1313/01.
5. Use the ARM WFI instruction.
Remark: The WAKEUP pin must be pulled HIGH externally before entering Deep
power-down mode.
3.9.4.3 Wake-up from Deep power-down mode
Pulling the WAKEUP pin LOW wakes up the LPC13xx from Deep power-down, and the
chip goes through the entire reset process (Section 3.6
HIGH-to-LOW transition on the WAKEUP pin is 50 ns.
1. A wake-up signal is generated when a HIGH-to-LOW transition occurs externally on
the WAKEUP pin with a pulse length of at least 50 ns while the part is in Deep
power-down mode.
– 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.
– All registers except the GPREG0 to GPREG4 will be in their reset state.
2. Once the chip has booted, read the deep power-down flag in the PCON register
(Table 61
power-down.
3. Clear the deep power-down flag in the PCON register (Table 61
4. (Optional) Read the stored data in the general purpose registers (Table 62
Table 63
5. Set up the PMU for the next Deep power-down cyc le.
) to verify that the reset was caused by a wake-up event from Deep
).
).
).
). The minimum pulse width for the
).
and
Remark: The RESET
pin has no functionality in Deep power-down mode.
3.10 Deep-sleep mode details
3.10.1 IRC oscillator
The IRC is the only oscillator on the LPC13xx that can always shut down glitch-free.
Therefore it is recommended that the user switches the clock source to IRC before the
chip enters Deep-sleep mode.
The Deep-sleep mode is exited when the start logic indicates an interrupt to the ARM
core. The various port pins (see Table 6
wake-up pins. The user must program the start logic registers for each input to set the
appropriate edge polarity for the corresponding wake-up event. Furthermore, the
interrupts corresponding to each input must be enabled in the NVIC. Interrupts 0 to 39 in
the NVIC correspond to 40 PIO pins (see Section 3.5.37
The start logic does not require a clock to run because it uses the input signals on the
enabled pins to generate a clock edge when enabled. Therefore, the start logic signals
should be reset (see Table 46
The start logic can also be used in Active mode to provide a vectored interrupt using the
LPC13xx’s input pins.
3.10.3 Using the general purpose counter/timers to create a self-wake-up
event
If enabled in Deep-sleep mode through the SYSAHBCLKCFG register, the counter/timers
can count clock cycles of the watchdog oscillator and create a match event when the
number of cycles equals a preset match value. The match event causes the
corresponding match output pin to go HIGH, LOW, or toggle. The state of the match
output pin is also monitored by the start logic and can trigger a wake- up interrupt if that pin
is enabled in the NVIC and the start logic trigger is configured accordingly in the start lo gic
edge control register (see Table 44
UM10375
Chapter 3: LPC13xx System configuration
) are connected to the start logic and serve as
and Section 3.5.41).
and Table 50) before use.
and Table 48).
The following steps must be performed to configure the counter/timer and create a timed
Deep-sleep self-wake-up event:
1. Configure the port pin as match output in the IOCONFIG block. All pins with a match
function are also inputs to the start logic.
2. In the corresponding counter/timer, set the match value, and configure the match
output for the selected pin.
3. Select the watchdog oscillator to run in Deep-sleep mode in the PDSLEEPCFG
register.
4. Switch the clock source to the watchdog oscillator in the MAINCLKSEL register
(Table 22
5. Enable the pin, configure its edge detect function, and reset the start logic in the start
logic registers (Table 46
6. Disable all other peripherals in the SYSAHBCLKCTRL register.
7. Ensure that the DPDEN bit in the PCON register is set to zero (Table 61
8. Write one to the SLEEPDEEP bit in the ARM Cortex-M3 SCR register.
9. Start the counter/timer.
10. Use the ARM WFI instruction to enter Deep-sleep mode.
) and ensure the watchdog oscillator is powered in the PDRUNCFG register.
to Table 50), and enable the interrupt in the NVIC.
3.11 PLL (System PLL and USB PLL) functional description
).
The LPC13xx uses the system PLL to create the clocks for the core and peripherals. On
the LPC134x parts, there is a second, identical PLL to create the USB clock.
The block diagram of this PLL is shown in Figure 5. 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 2P by the programmable post divider to
create the output clock(s), or are sent directly to the output(s). 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.
3.11.1 Lock 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 phas e 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.
To reduce the power consumption when the PLL clock is not needed, a Power-down
mode has been incorporated. This mode is enabled by setting the SYSPLL_PD (or
USBPLL_PD) bits to one in the Power-down configuration register (Table 55
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
Power-down mode, the lock output will be low to indicate that the PLL is not in lock. When
the Power-down mode is terminated by setting the SYSPLL_PD (or USBPLL_PD) bits 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.
3.11.3 Divider ratio programming
Post 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 10
guarantees an output clock with a 50% duty cycle.
Feedback divider
UM10375
Chapter 3: LPC13xx System configuration
). In this
and Table 12. This
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 10
Changing the divider values
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, adjust th e divider settin gs and then let
the PLL start up again.
3.1 1.4 Frequency selection
The PLL frequency equations use the following parameters (also see Figure 3 ):
Table 57. PLL frequen cy parameters
ParameterSystem PLLUSB PLL
FCLKINFrequency of sys_pllclkin (input clock
to the system PLL) from the
SYSPLLCLKSEL multiplexer (see
Section 3.5.11
FCCOFrequency of the Current Controlled
Oscillator (CCO); 156 to 320 MHz.
and Table 12.
).
Frequency of usb_pllclkin (input clock
to the USB PLL) from the
USBPLLCLKSEL multiplexer (see
Section 3.5.24).
Frequency of the Current Controlled
Oscillator (CCO); 156 to 320 MHz.
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
Power-down mode, the lock output will be low, to indicate that the PLL is not in lock. When
the Power-down mode is terminated by SYSPLL_PD (or USBPLL_PD) bits to zero in the
Power-down configuration register (Table 55
and will make the lock signal high once it has regained lock on the input clock.
3.12 Flash memory access
Depending on the system clock frequency, access to the flash memory can be configured
with various access times by writing to the FLASHCFG register at address 0x4003 C010.
This register is part of the flash controller block (see Figure 2
Remark: Improper setting of this register may result in incorrect operation of the LPC13xx
flash memory.
The power control register selects whether one of the ARM Cortex-M3 controlled
power-down modes (Sleep mode or Deep-sleep mode) or the De ep power-d own m ode is
entered and provides the flags for Sleep or Deep-sleep modes and Deep power-down
modes respectively. See Section 3.9
Table 61. Power control register (PCON, address 0x4003 8000) bit description
BitSymbolValue DescriptionReset
0--Reserved. Do not write 1 to this bit.0x0
1DPDENDeep power-down mode enable0
0ARM WFI will enter Sleep or Deep-sleep mode (clock to
1ARM WFI will enter Deep-power down mode (ARM
7:2--Reserved. Do not write ones to this bit.0x0
8SLEEPFLAGSl eep mode flag0
0Read: No power-down mode entered. LPC13xx is in Run
1Read: Sleep/Deep-sleep or Deep power-down mode
10:9--Reserved. Do not write ones to this bit.0x0
for details on how to enter the power-down modes.
value
ARM Cortex-M3 core turned off).
Cortex-M3 core powered-down).
mode.
Write: No effect.
entered.
Write: Writing a 1 clears the SLEEPFLAG bit to 0.
Table 61. Power control register (PCON, address 0x4003 8000) bit description
BitSymbolValue DescriptionReset
11DPDFLAGDeep power-down flag0x0
0Read: Deep power-down mode not entered.
Write: No effect.
1Read: Deep power-dow n mode entered.
Write: Clear the Deep power-down flag.
31:12 --R eserved. Do not write ones to this bit.0x0
4.2.2 General 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.
T able 62. General purpose registers 0 to 3 (GPREG0 - GPREG3, address 0x4003 8004 to
0x4003 8010) bit description
BitSymbolDescriptionReset
31:0GPDATAData retained during Deep power-down mode.0x0
pin but the chip has entered Deep power-down mode.
DD
…continued
value
0x0
0x0
value
4.2.3 General purpose register 4
The general purpose register 4 retains 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.
The hysteresis of the WAKEUP pin in Deep power-down mode can be controlled by bit 10
of this register.
Remark: If there is a possibility that the external voltage applied on pin V
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.
Table 63. General pur po se register 4 (GPREG4, address 0x4003 8014) bit description
BitSymbolValueDescriptionReset
9:0--Reserved. Do not write ones to this bit.0x0
10WAKEUPHYSWAKEUP pin hysteresis enable0x0
31:11 GPDATAData retained during Deep power-down mode.0x0
pin but the chip has entered Deep power-down mode.
DD
0Hysteresis for WAKUP pin disabled.
1Hysteresis for WAKEUP pin enabled.
drops below
DD
value
4.3 Functional description
See Section 3.9 for details on power management and the Deep power-down mode.
Fig 7.LPC1311/01 and LPC1313/01 clock configuration for power API use
UM10375
Chapter 5: LPC13xx Power profiles
5.4 Definitions
The following elements have to be defined in an application that uses the power profiles:
typedef struct _PWRD {
void (*set_pll)(unsigned int cmd[], unsigned int resp[]);
void (*set_power)(unsigned int cmd[], unsigned int resp[]);
} PWRD;
typedef struct _ROM {
const PWRD * pWRD;
} ROM;
ROM ** rom = (ROM **) 0x1FFF1FF8;
unsigned int command[4], result[2];
5.5 Clocking routine
5.5.1 set_pll
This routine sets up the system PLL according to the calling arguments. If the expected
clock can be obtained by simply dividing the system PLL input, set_pll bypasses the PLL
to lower system power consumption.
Remark: Before this routine is invoked, the PLL clock source (IRC/system oscillator) must
be selected (Table 18
PLL (Table 22
), the main clock source must be set to the input clock to the system
) and the system/AHB clock divider must be set to 1 (Table 24).
set_pll attempts to find a PLL setup that matches the calling parameters. Once a
combination of a feedback divider value (SYSPLLCTRL, M), a post divider ratio
(SYSPLLCTRL, P) and the system/AHB clock divider (SYSAHBCLKDIV) is found, set_pll
applies the selected values and switches the main clock source selection to the system
PLL clock out (if necessary).
NXP Semiconductors
The routine returns a result code that indicates if the system PLL was successfully set
(PLL_CMD_SUCCESS) or not (in which case the result code identifies what went wrong).
The current system frequency value is also returned. The application should use this
information to adjust other clocks in the device (the SSP, UART, and WDT clocks, and/or
clockout).
For a simplified clock configuration scheme see Figure 7. For more details see Figure 3.
5.5.1.1 Param0: system PLL input frequency and Param1: expected system clock
set_pll looks for a setup in which the system PLL clock does not exceed 72 MHz. It e asily
finds a solution when the ratio between the expected system clock and the system PLL
input frequency is an integer value, but it can also find solutions in other cases.
The system PLL input frequency (Param0) must be between 10000 to 25000 kHz (10
MHz to 25 MHz) inclusive. The expected system clock (Param1) must be between 1 and
72000 kHz inclusive. If either of these requirements is not met, set_pll returns
PLL_INV ALID_FREQ an d returns Param0 as Result1 since the PLL setting is unchanged.
5.5.1.2 Param2: mode
The first priority of set_pll is to find a setup that generates the system clock at exactly the
rate specified in Param1. If it is unlikely that an exact match can be found, input parameter
mode (Param2) should be used to specify if the actual system clock can be less than or
equal, greater than or equal or approximately the value specified as the expected system
clock (Param1).
A call specifying CPU_FREQ_EQU will only succeed if the PLL can output exactly the
frequency requested in Param1.
CPU_FREQ_LTE can be used if the requested frequency should not be exceeded (such
as overall current consumption and/or power budget reasons).
CPU_FREQ_GTE helps applications that need a minimum level of CPU processing
capabilities.
CPU_FREQ_APPROX results in a system clock that is as close as possible to the
requested value (it may be greater than or less than the requested value).
If an illegal mode is specified, set_pll returns PLL_INVALID_MODE. If the expected
system clock is out of the range supported by this routine, set_pll returns
PLL_FREQ_NOT_FOUND. In these cases the current PLL setting is not changed and
Param0 is returned as Result1.
5.5.1.3 Param3: system PLL lock time-out
It should take no more than 100 s for the system PLL to lock if a valid configuration is
selected. If Param3 is zero, set_pll will wait indefinitely for the PLL to lock. A non-zero
value indicates how many times the code will check for a successful PLL lock event
before it returns PLL_NOT_LOCKED. In this case the PLL settings are unchanged and
Param0 is returned as Result1.
UM10375
Chapter 5: LPC13xx Power profiles
Remark: The time it takes the PLL to lock depends on the selected PLL input clock
source (IRC/system oscillator) and its characteristics. The selected source can
experience more or less jitter depending on the operating conditions such as power
supply and/or ambient temperature. This is why it is suggested that when a good known
clock source is used and a PLL_NOT_LOCKED response is received, the set_pll routine
should be invoked several times before declaring the selected PLL clock source invalid.
Hint: setting Param3 equal to the system PLL frequency [Hz] divided by 10000 will
provide more than enough PLL lock-polling cycles.
5.5.1.4 Code examples
The following examples illustrate some of the features of set_pll discussed above.
5.5.1.4.1 Invalid frequency (device maximum clock rate exceeded)
The above code specifies a 12 MHz PLL input clock and a system clock of exactly
84 MHz. The application was ready to infinitely wait for the PLL to lock. But the expected
system clock of 84 MHz exceeds the maximum of 72 MHz. Therefore set_pll returns
PLL_INVALID_FREQ in result[0] and 12000 in result[1] without changing the PLL
settings.
5.5.1.4.2 Invalid frequency selection (system clock divider restrictions)
The above code specifies a 12 MHz PLL input clock, a system clock of no more than
40 kHz and no time-out while waiting for the PLL to lock. Since the maximum divider value
for the system clock is 255 and running at 40 kHz would need a divide by value of 300,
set_pll returns PLL_INVALID_FREQ in result[0] and 12 00 0 in result[1] without changing
the PLL settings.
The above code specifies a 12 MHz PLL input clock and a system clock of exactly
25 MHz. The application was ready to infinitely wait for the PLL to lock. Since there is no
valid PLL setup within earlier mentioned restrictions, set_pll returns
PLL_FREQ_NOT_FOUND in result[0] and 12000 in result[1] without changing the PLL
settings.
UM10375
Chapter 5: LPC13xx Power profiles
5.5.1.4.4 System clock less than or equal to the expected value
The above code specifies a 12 MHz PLL input clock, a system clock of no more than
25 MHz and no locking time-out. set_pll returns PLL_CMD_SUCCESS in result[0] and
24000 in result[1]. The new system clock is 24 MHz.
5.5.1.4.5 System clock greater than or equal to the expected value
The above code specifies a 12 MHz PLL input clock, a system clock of at least 25 MHz
and no locking time-out. set_pll returns PLL_CMD_SUCCESS in result[0] and 36000 in
result[1]. The new system clock is 36 MHz.
5.5.1.4.6 System clock approximately equal to the expected value
The above code specifies a 12 MHz PLL input clock, a system clock of approximately
16.5 MHz and no locking time-out. set_pll returns PLL_CMD_SUCCESS in result[0] and
16000 in result[1]. The new system clock is 16 MHz.
5.6 Power routine
5.6.1 set_power
This routine configures the device’s internal power control settings according to the calling
arguments. The goal is to reduce acti ve power consumption while maint aining the feature
of interest to the application close to its optimum.
Remark: The set_power routine was de signed for systems employing the configuration of
SYSAHBCLKDIV = 1 (System clock divider register, see Table 24
this routine in an application with the system clock divider not equal to 1 might not improve
microcontroller’s performance as much as in setups when the main clock and the system
clock are running at the same rate.
set_power returns a result code that reports whether the power setting was successfully
changed or not.
EFFICIENCY, PWR_LOW_CURRENT)
Param2: system clock (in MHz)
PWR_INVALID_MODE
For a simplified clock configuration scheme see Figure 7. For more details see Figure 3.
5.6.1.1 Param0: main clock
The main clock is the clock rate the microcontroller uses to source the system’s and the
peripherals’ clock. It is configured by either a successful execution of the clocking routine
call or a similar code provided by the user. This operand must be an integer between 1 to
72 MHz inclusive. If a value out of this range is supplied, set_power returns
PWR_INVALID_FREQ and does not change the power control system.
5.6.1.2 Param1: mode
The input parameter mode (Param1) specifies one of four available power settings. If an
illegal selection is provided, set_power returns PWR_INVALID_MODE and does not
change the power control system.
PWR_DEFAULT keeps the device in a baseline power setting similar to its reset state.
PWR_CPU_PERFORMANCE configures the microcontroller so that it can provide more
processing capability to the application. CPU performance is 30% better than the default
option.
PWR_EFFICIENCY setting was designed to find a balance between active current and
the CPU’s ability to execute code and process data. In this mode the device outperforms
the default mode both in terms of providing higher CPU performance and lowering active
current.
PWR_LOW_CURRENT is intended for those solutions that focus on lowering power
consumption rather than CPU performance.
5.6.1.3 Param2: system clock
The system clock is the clock rate at which the microcontroller core is running when
set_power is called. This parameter is an integer between from 1 and 72 MHz inclusive.
The above setup would be used in a system running at the main and system clock of
75 MHz, with a need for maximum CPU processing power. Since the specified 75 MHz
clock is above the 72 MHz maximum, set_power returns PWR_INVALID_FREQ in
result[0] without changing anything in the existing power setup.
The above code specifies that an application is running at the main and syste m clock of
24 MHz with em p ha sis on efficiency. set_power returns PWR_CMD_SUCCESS in
result[0] after configuring the microcontroller’s internal power control features.
Interrupts 47 and 48 in Table 66 are available on parts LPC1342/43 with USB only. These
interrupts are reserved on parts LPC1311/13.
Interrupt 57 is available for part LPC1313FBD48/01 only (48-pin package, LPC1300L
series). This interrupt is reserved on p arts LPC1311/13/42/43 and LPC1311FHN33/01 and
LPC1313FHN33/01.
The implementation of start logi c wake -u p in terr upts depends on how many PIO port pins
are available (see Section 3.1
interrupt 38 are available.
6.2 Introduction
). For HVQFN packages only wake-up interrupt s 0 to 24 and
The Nested Vectored Interrupt Controller (NVIC) is an integral part of the Cortex-M3. The
tight coupling to the CPU allows for low interrupt latency and efficient processing of late
arriving interrupts.
Refer to the Cortex-M3 Technical Reference Manual for details of NVIC operation.
6.3 Features
• Nested Vectored Interrupt Controller that is an integral part of the ARM Cortex-M3.
Table 66 lists the interrupt sources for each peripheral functio n. Each peripheral device
may have one or more interrupt lines to the Vectored Interrupt Controller. Each line may
represent more than one interrupt source. There is no significance or priority about what
line is connected where except for certain standards from ARM.
Table 66. Connection of interru pt sources to the Vectored Interrupt Controller
Exception
Number
39 to 0st a rt logic wake-up
400xA0I2C0SI (state change)
410xA4CT16B0 Match 0 - 2
420xA8CT16B1 Match 0 - 1
430xACCT32B0 Match 0 - 3
440xB0CT32B1 Match 0 - 3
450xB4SSP0Tx FIFO half empty
460xB8UARTRx Line Status (RLS)
470xBCUSB IRQ interrupt USB low-priority interrupt
480xC 0USB FIQ interruptUSB high-priority interrupt
490xC 4ADCA/D Converter end of conversion
500xC 8WDTWatchdog interrupt (WDINT)
510xCCBODBrown-out detect
52--Reserved
530xD4PIO_3GPIO interrupt status of port 3
540xD8PIO_2GPIO interrupt status of port 2
550xDCPIO_1GPIO interrupt status of port 1
560xE0PIO_0GPIO interrupt status of port 0
570xE4SSP1Tx FIFO half empty
Vector
Offset
FunctionFlag(s)
Each interrupt is connected to a PIO input pin serving
interrupts
as wake-up pin from Deep-sleep mode (see
Section 3.5.37
Interrupts 0 to 11 are connected to PIO0_0 to
PIO0_11; interrupts 12 to 23 are connected to
PIO1_0 to PIO1_11; interrupts 24 to 35 are
connected to PIO2_0 to PIO2_11; interrupts 36 to 39
are connected to PIO3_0 to PIO3_3.
Capture 0
Capture 0
Capture 0
Capture 0
Rx FIFO half full
Rx Timeout
Rx Overrun
Transmit Holding Register Empty (THRE)
Rx Data Available (RDA)
Character Time-out Indicator (CTI)
Modem Control Change
End of Auto-Baud (ABEO)
Auto-Baud Time-Out (ABTO)
Rx FIFO half full
Rx Timeout
Rx Overrun
UM10375
Chapter 6: LPC13xx Interrupt controller
and Section 3.5.41).
[1]
[1] See Section 3.1 for wake-up pins not used in the HVQFN package.
The Cortex-M3 incorporates a mechanism that allows remapping the interrupt vector table
to alternate locations in the memory map. This is controlled via the Vector Table Offset
Register (VTOR) contained in the Cortex-M3.
The vector table may be located anywhere within the bottom 1 GB of Cortex-M3 address
space. The vector table should be located on a 256 word (1024 byte) boundary to insure
alignment on LPC13xx family devices. Refer to the ARM Cortex-M3 User Guide for det ails
of the Vector Table Offset feature.
ARM describes bit 29 of the VTOR (TBLOFF) as selecting a memory region, either code
or SRAM. For simplicity, this bit can be thought as simply part of the address offset since
the split between the “code” space and the “SRAM” space occurs at the location
corresponding to bit 29 in a memory address.
Example:
To place the vector table at the beginning of the static RAM, starting at address 0x1000
0000, place the value 0x1000 0000 in the VTOR register. This indicates add ress 0x1000
0000 in the code space, since bit 29 of the VTOR equals 0.
The following table summarizes the registers in the NVIC as implemented in the LPC13xx.
The Cortex-M3 User Guide provides a functional description of the NVIC.
IPR9RW0x424Interrupt Priority Registers 9 This register allows assigning a priority to each
IPR10RW0x428Interrupt Priority Registers 10 This register allows assigning a priority to each
IPR11RW0x42CInterrupt Priority Registers 11 This register allows assigning a priority to each
IPR12RW0x430Interrupt Priority Registers 12 This register allows assigning a priority to each
IPR13RW0x434Interrupt Priority Registers 13 This register allows assigning a priority to each
IPR14RW0x438Interrupt Priority Registers 14 This register allows assigning a priority to each
STIRWO0xF00Software Trigger Interrupt R egister. This register allows software to generate an
DescriptionReset
interrupt. Each register contains the 5-bit priority fields for 4 interrupts.
interrupt. Each register contains the 5-bit priority fields for 4 interrupts.
interrupt. Each register contains the 5-bit priority fields for 4 interrupts.
interrupt. Each register contains the 5-bit priority fields for 4 interrupts.
interrupt. Each register contains the 5-bit priority fields for 4 interrupts.
interrupt. Each register contains the 5-bit priority fields for 4 interrupts.
interrupt.
…continued
6.6.1 Interrupt Set-Enable Register 0 register
The ISER0 register allows enabling the first 32 peripheral interrupts, or for reading the
enabled state of those interrupts. The rema ining interrupts are enabled via the ISER1
register (Section 6.6.2
registers (Section 6.6.3
). Disabling interrupts is done through the ICER0 and ICER1
and Section 6.6.4).
value
0
0
0
0
0
0
0
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 68. Interrupt Set-En able Register 0 register (ISER0 - address 0xE000 E100) bit
The ISER1 register allows enabling the second group of peripheral interrupts, or for
reading the enabled state of those interrupts. Disabling int er ru pts is done throu g h the
ICER0 and ICER1 registers (Section 6.6.3
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 69. Interrupt Set-En able Register 1 register (ISER1 - address 0xE000 E104) bit
Table 69. Interrupt Set-En able Register 1 register (ISER1 - address 0xE000 E104) bit
BitSymbolDescription
1 1ISE_CT32B0Timer CT32B0 interrupt enable.
12ISE_CT32B1Timer CT32B1 interrupt enable.
13ISE_SSP0SSP0 interrupt enable.
14ISE_UARTUART interrupt enable.
15ISE_USBIRQUSB IRQ interrupt enable.
16ISE_USBFRQUSB FRQ interrupt enable.
17ISE_ADCADC interrupt enable.
18ISE_WDTWDT interru pt enable.
19ISE_BODBOD interrupt enable.
20-Reserved, user software should not write ones to reserved bits. The
21ISE_PIO_3GPIO port 3 interrupt enable.
22ISE_PIO_2GPIO port 2 interrupt enable.
23ISE_PIO_1GPIO port 1 interrupt enable.
24ISE_PIO_0GPIO port 0 interrupt enable.
25ISE_SSP1SSP1 interrupt enable.
31:26 -Reserved, user software should not write ones to reserved bits. The
description
UM10375
Chapter 6: LPC13xx Interrupt controller
…continued
value read from a reserved bit is not defined.
value read from a reserved bit is not defined.
6.6.3 Interrupt Clear-Enable Register 0
The ICER0 register allows disabling the first 32 peripheral interrupts, or for reading the
enabled state of those interrupts. The remaining interrupts are disabled via the ICER1
register (Section 6.6.4
registers (Section 6.6.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 ICER1 register allows disabling the second group of peripheral interrupts, or for
reading the enabled state of those interrupts. Enabling inter ru p ts is done throug h th e
ISER0 and ISER1 registers (Section 6.6.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.
8ICE_I2C0I2C0 interrupt disable.
9ICE_CT16B0Timer CT16B0 interrupt disable.
10ICE_CT16B1Timer CT16B1 interrupt disable.
11ICE_CT32B0Timer CT32B0 interrupt disable.
12ICE_CT32B1Timer CT32B1 interrupt disable.
13ICE_SSP0SSP0 interrupt disable.
14ICE_UARTUART interrupt disable.
15ICE_USBIRQUSB IRQ interrupt disable.
16ICE_USBFRQUSB FRQ interrupt disab le.
17ICE_ADCADC interrupt disable.
18ICE_WDTWDT interrupt disable.
19ICE_BODBOD interrupt disable.
20-Reserved, user software should not write ones to reserved bits. The
21ICE_PIO_3GPIO port 3 interrupt disable.
22ICE_PIO_2GPIO port 2 interrupt disable.
23ICE_PIO_1GPIO port 1 interrupt disable.
24ICE_PIO_0GPIO port 0 interrupt disable.
25ICE_SSP1SSP1 interrupt disable.
31:26-Re served, us er software should not write one s to reserved bits. The
description
UM10375
Chapter 6: LPC13xx Interrupt controller
…continued
value read from a reserved bit is not defined.
value read from a reserved bit is not defined.
6.6.5 Interrupt Set-Pending Register 0 register
The ISPR0 register allows setting the pending state of th e first 32 pe ripher al inter rupts, or
for reading the pending state of those interrupts. The remaining interrupts can have their
pending state set via the ISPR1 register (Section 6.6.6
interrupts is done through the ICPR0 and ICPR1 registers (Section 6.6.7
Section 6.6.8
).
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
The ISPR1 register allows setting the pending state of the second group of peripheral
interrupts, or for reading the pending state of those interrupts. Clearing the pending st ate
of interrupts is done through the ICPR0 and ICPR1 registers (Section 6.6.7
Section 6.6.8
).
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
21ISP_PIO_3GPIO port 3 interrupt pending set.
22ISP_PIO_2GPIO port 2 interrupt pending set.
23ISP_PIO_1GPIO port 1 interrupt pending set.
24ISP_PIO_0GPIO port 0 interrupt pending set.
25ISP_SSP1SSP1 interrupt pending set.
31:26 -Reserved, user software should not write ones to reserved bits. The
description
Chapter 6: LPC13xx Interrupt controller
2
C0 interrupt pending set.
value read from a reserved bit is not defined.
value read from a reserved bit is not defined.
UM10375
6.6.7 Interrupt Clear-Pending Register 0 register
The ICPR0 register allows clearing the pending state of the first 32 peripheral interrupts,
or for reading the pending state of those interrupts. The remaining interrupts can have
their pending state cleared via the ICPR1 register (Section 6.6.8
state of interrupts is done through the ISPR0 and ISPR1 registers (Section 6.6.5
Section 6.6.6
).
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 ICPR1 register allows clearing the pending state of the second group of peripheral
interrupts, or for reading the p ending st ate of those interrupt s. Setting the pe nding st ate of
interrupts is done through the ISPR0 and ISPR1 registers (Section 6.6.5
Section 6.6.6
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
21ICP_PIO_3GPIO port 3 interrupt pending clear.
22ICP_PIO_2GPIO port 2 interrupt pending clear.
23ICP_PIO_1GPIO port 1 interrupt pending clear.
24ICP_PIO_0GPIO port 0 interrupt pending clear.
25ICP_SSP1SSP1 interrupt pending clear.
31:26-Re served, us er software should not write one s to reserved bits. The
The IABR0 register is a read-only register that allows reading the active state of the first
32 peripheral interrupts. This allows determining which peripherals are asserting an
interrupt to the NVIC, and may also be pending if there are enabled. The remainin g
interrupts can have their active state read via the IABR1 register (Section 6.6.10
The bit description is as follows for all bits in this register:
Write — n/a.
Read — 0 indicates that the interrupt is not active, 1 indicates that the interrupt is active.
Table 76. Interrupt Active Bit Register 0 (IABR0 - address 0xE000 E300) bit description
The IABR1 register is a read-only register that allows reading the active state of the
second group of peripheral interrupts. This allows determining which pe ripherals are
asserting an interrupt to the NVIC, and may also be pend ing if ther e ar e en a ble d.
The bit description is as follows for all bits in this register:
Write — n/a.
Read — 0 indicates that the interrupt is not active, 1 indicates that the interrupt is active.
Table 77. Interrupt Active Bit Register 1 (IABR1 - address 0xE000 E304) bit description
BitSymbolDescription
0IAB_PIO2_8PIO0_0 start logic input interrupt active.
1IAB_PIO2_9PIO2_9 start logic input interrupt active.
2IAB_PIO2_10PIO2_10 start logic input interrupt active.
3IAB_PIO2_11PIO2_11 start l ogi c in pu t i nt err up t active.
4IAB_PIO3_0PIO3_0 start logic input interrupt active.
5IAB_PIO3_1PIO3_0 start logic input interrupt active.
6IAB_PIO3_2PIO3_0 start logic input interrupt active.
7IAB_PIO3_3PIO3_0 start logic input interrupt active.
8IAB_I2C0I
9IAB_CT16B0Timer CT16B0 interrupt active.
10IAB_CT16B1Timer CT16B1 interrupt active.
11IAB_CT32B0Timer CT32B0 interrupt active.
12IAB_CT32B1Timer CT32B1 interrupt active.
13IAB_SSP0SSP0 interrupt active.
14IAB_UARTUART interrupt active.
15IAB_USBIRQUSB IRQ interrupt active.
16IAB_USBFRQUSB FRQ interrupt active.
17IAB_ADCADC interrupt active.
18IAB_WDTWDT interrupt active.
19IAB_BODBOD interrupt active.
20-Reserved, user software should not write ones to reserved bits. The
21IAB_PIO_3GPIO port 3 interrupt active.
22IAB_PIO_2GPIO port 2 interrupt active.
23IAB_PIO_1GPIO port 1 interrupt active.
24IAB_PIO_0GPIO port 0 interrupt active.
25IAB_SSP1SSP1 interrupt active.
31:26 -Reserved, user software should not write ones to reserved bits. The
The IPR14 register controls the priority of four peripheral interrupts. Each interrupt can
have one of 32 priorities, where 0 is the highest priority.
Table 92. Interrup t Priority Register 14 (IPR14 - address 0xE000 E438) bit description
BitSymbolDescription
4:0UnimplementedThese bits ignore writes, and read as 0.
7:5IP_PIO0PIO0 Interrupt Priority. 0 = highest priority . 31 (0x1F) = lowest priority.
12:8UnimplementedThese bits ignore writes, and read as 0.
15:13 IP_SSP1SSP1 Interrupt Priority. 0 = highest priority. 31 (0x1F) = lowest priority.
31:16 -Reserved, user software should not write ones to reserved bits. The
6.6.26 Software Trigger Interrupt Register
The STIR register provides an alternate way for software to generate an interrupt, in
addition to using the ISPR registers. This mechanism can only be used to generate
peripheral interrupts, not system exceptions.
UM10375
Chapter 6: LPC13xx Interrupt controller
value read from a reserved bit is not defined.
By default, only privileged software can write to the STIR register. Unprivileged software
can be given this ability if privileged software sets the USERSETMPEND bit in the ARM
Cortex-M3 CCR register.
The implementation of the I/O configuration registers varies for different LPC13xx parts
and packages. See Table 94
not used in all parts or packages.
For the LPC1311/01 and LPC1313/01, a pseudo open-drain mode can be selected in the
IOCON registers for each digital pins except the I2C pins. The open-drain mode is not
available in the LPC1311/13/42/43 parts.
Table 94. Availability of IOCON registers
PartIOCON_PIO2_1
to
IOCON_PIO2_11
IOCON_PIO3_0,
IOCON_PIO3_1,
IOCON_PIO3_3
and Table 96 for IOCON registers and register bits which are
The IOCON registers control the function (GPIO or peripheral function), the input mode,
and the hysteresis of all PIO pins. In addition, the I
different I
2
C-bus modes. If a pin is used as input pin for the ADC, an analog input mode
2
C-bus pins can be configured for
can be selected.
Fig 9.Standard I/O pin configuration
7.3.1 Pin function
The FUNC bits in the IOCON registers can be set to GPIO (FUNC = 000) or to a
peripheral function. If the pins are GPIO pins, the GPIODIR registers determine whether
the pin is configured as an input or output (see Table 150
). For any peripheral function, the
pin direction is controlled automatically depending on the pin’s functionality . The GPIODIR
registers have no effect on peripheral functions.
7.3.2 Pin mode
The MODE bits in the IOCON register allow the selection of on-chip pull-up or pull-down
resistors for each pin or select the repeater mode.
The possible on-chip resistor configurations are pull-up ena bled, pull-down enabled, or no
pull-up/pull-down. The default value is pull-up enabled. The pins are pulled up to 2.6 V for
LPC1311/13/42/43 parts and pulled up to 3.3 V for LPC1311/01 and LPC1313/01 parts
(V
The repeater mode enables the pull-up resistor if the pin is at a logic HIGH and enables
the pull-down resistor if the pin is at a logic LOW. This causes the pin to retain its last
known state if it is configured as an input and is not driven externa lly. The state retention is
not applicable to the Deep power-down mode. 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.
7.3.3 Hysteresis
The input buffer for digital functions can be configured with hysteres is or as pla in bu ffer
through the IOCON registers (see the LPC1311/13/43/44 data sheet for details).
UM10375
Chapter 7: LPC13xx I/O configuration
If the external pad supply voltage V
can be enabled or disabled. If V
to use the pin in input mode.
7.3.4 A/D-mode
In A/D-mode, the digital receiver is disconnected to obtain an accurate input voltage for
analog-to-digital conversions. This mode is available in those IOCON registers that
control pins which can function as ADC inputs. If A/D mode is selected, Hysteresis and
Pin mode settings have no effect.
7.3.5 Open-drain Mode
When output is selected, either by selecting a special function in the FUNC field, or by
selecting GPIO function for a pin having a 1 in its GPIODIR register, a 1 in the OD bit
selects open-drain operation, that is, a 1 disables the high-drive transistor. This option has
no effect on the primary I
Remark: The open-drain mode is only available on parts LPC1311/01 and LPC1313/01.
7.3.6 I2C mode
If the I2C function is selected by the FUNC bits of registers IOCON_PIO0_4 (Table 107)
and IOCON_PIO0_5 (Table 108
2
I
C-modes:
2
C pins.
is between 2.5 V and 3.6 V, the hysteresis buffer
DD
is below 2.5 V, the hysteresis buffer must be disabled
DD
), then the I2C-bus pins can be configured for different
• Standard mode/Fast-mode I
output according to the I
2
C with input glitch filter (this includes an open-drain
2
C-bus specification).
• Fast-mode Plus with input glitch filter (this includes an open-drain output accord ing to
2
the I
C-bus specification). In this mode, the pins function as high-current sinks.
• Standard, open-drain I/O functionality without input filter.
2
Remark: Either Standard mode/Fast-mode I
selected if the pin is used as GPIO pin.
C or Standard I/O functionality should be
7.4 Register description
The I/O configuration registers control the following pins: PIO ports, the I2C-bus pins, and
the ADC input pins.
The pin functions selectable in each IOCON register are listed in order (function 0/function
1/function 2/...) in the description column in Table 95
UM10375
Chapter 7: LPC13xx I/O configuration
.
Remark: The IOCON registers are listed in order of their memory locations in Table 95
which correspond to the order of their physical pin numbers in the LQFP48 package
starting at the upper left corner with pin 1 (PIO2_6). See Table 96
IOCON_PIO2_6R/W0x000I/O configuration for pin PIO2_60xD0
-R/W0x004ReservedIOCON_PIO2_0R/W0x008I/O configuration for pin PIO2_0/DTR
IOCON_RESET_PIO0_0R/W0x00CI/O configuration for pin RESET
IOCON_PIO0_1R/W0x010I/O configuration for pin PIO0_1/CLKOUT/
IOCON_PIO1_8R/W0x014I/O configuration for pin PIO1_8/CT16B1_CAP00xD0
-R/W0x018ReservedIOCON_PIO0_2R/W0x01CI/O configuration for pin PIO0_2/SSEL0/
IOCON_PIO2_7R/W0x020I/O configuration for pin PIO2_70xD0
IOCON_PIO2_8R/W0x024I/O configuration for pin PIO2_80xD0
IOCON_PIO2_1R/W0x028I/O configuration for pin PIO2_1/DSR
IOCON_PIO0_3R/W0x02CI/O configuration for pin PIO0_3/USB_VBUS0xD0
IOCON_PIO0_4R/W0x030I/O configuration for pin PIO0_4/SCL0x00
IOCON_PIO0_5R/W0x034I/O configuration for pin PIO0_5/SDA0x00
IOCON_PIO1_9R/W0x038I/O configuration for pin PIO1_9/CT16B1_MAT00xD0
IOCON_PIO3_4R/W0x03CI/O configuration for pin PIO3_4 0xD0
IOCON_PIO2_4R/W0x040I/O configuration for pin PIO2_40xD0
IOCON_PIO2_5R/W0x044I/O configuration for pin PIO2_50xD0
IOCON_PIO3_5R/W0x048I/O configuration for pin PIO3_5 0xD0
IOCON_PIO0_6R/W0x04CI/O configuration for pin PIO0_6/USB_CONNECT
IOCON_PIO0_7R/W0x050I/O configuration for pin PIO0_7/CTS
IOCON_PIO2_9R/W0x054I/O configuration for pin PIO2_90xD0
IOCON_PIO2_10R/W0x058I/O configuration for pin PIO2_100xD0
IOCON_PIO2_2R/W0x05CI/O configuration for pin PIO2_2/DCD
IOCON_PIO0_8R/W0x060I/O configuration for pin PIO0_8/MISO0/CT16B0_MAT00xD0
IOCON_PIO0_9R/W0x064I/O configuration for pin PIO0_9/MOSI0/
IOCON_SWCLK_PIO0_10R/W0x068I/O configuration for pin SWCLK/PIO0_10/
IOCON_PIO1_10R/W0x06CI/O configuration for pin PIO1_10/AD6/
IOCON_PIO2_11R/W0x070I/O configuration for pin PIO2_11/SCK0xD0
IOCON_R_PIO0_11R/W0x074I/O configuration for pin R/PIO0_11/AD0/CT32B0_MAT30xD0
IOCON_R_PIO1_0R/W0x078I/O configuration for pin R/PIO1_0/AD1/
IOCON_R_PIO1_1R/W0x07CI/O configuration for pin R/PIO1_1/AD2/CT32B1_MAT00xD0
IOCON_R_PIO1_2R/W0x080I/O configuration for pin R/PIO1_2/AD3/
IOCON_PIO3_0R/W0x084I/O configuration for pin PIO3_0/DTR
IOCON_PIO3_1R/W0x088I/O configuration for pin PIO3_1/DSR
IOCON_PIO2_3R/W0x08CI/O configuration for pin PIO2_3/RI
IOCON_SWDIO_PIO1_3R/W0x090I/O configuration for pin SWDIO/PIO1_3/AD4/
IOCON_PIO1_4R/W0x094I/O configuration for pin PIO1_4/AD5/CT32B1_MAT30xD0
IOCON_PIO1_11R/W0x098I/O configuration for pin PIO1_11/AD70xD0
IOCON_PIO3_2R/W0x09CI/O configuration for pin PIO3_2/DCD
IOCON_PIO1_5R/W0x0A0I/O configuration for pin PIO1_5/RTS
IOCON_PIO1_6R/W0x0A4I/O configuration for pin PIO1_6/RXD/CT32B0_MAT00xD0
IOCON_PIO1_7R/W0x0A8I/O configuration for pin PIO1_7/TXD/CT32B0_MAT10xD0
IOCON_PIO3_3R/W0x0ACI/O configuration for pin PIO3_3/RI
IOCON_SCK0_LOCR/W0x0B0SCK0 pin lo cation register0
IOCON_DSR_LOCR/W0x0B4DSR
IOCON_DCD_LOCR/W0x0B8DCD
IOCON_RI_LOCR/W0x0BCRI