The LPC84x are an ARM Cortex-M0+ based, low-cost 32-bit MCU family operating at
CPU frequencies of up to 30 MHz. The LPC84x support up to 64 KB of flash memory and
16 KB of SRAM.
1.2 Features
.
2
C-bus
The peripheral complement of the LPC84x includes a CRC engine, four I
interfaces, up to five USARTs, up to two SPI interfaces, one multi-rate timer, self-wake-up
timer, SCTimer/PWM, one general purpose 32-bit counter/timer, a DMA, one 12-bit ADC,
two 10-bit DACs, one analog comparator, function-configurable I/O ports through a switch
matrix, an input pattern match engine, and up to 54 general-purpose I/O pins.
Remark: For additional documentation, see Section 32.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 64 KB on-chip flash programming memory with 64 Byte page write and
erase.
– Fast Initialization Memory (FAIM) allowing the user to configure chip behavior on
power-up.
– Code Read Protection (CRP).
– Up to 16 KB SRAM consisting of two 8 KB contiguous SRAM banks. One 8 KB of
SRAM can be used for MTB.
– Bit-band addressing supported to permit atomic operations to modify a single bit.
• ROM API support:
– Bootloader.
– Supports Flash In-Application Programming (IAP).
– Supports In-System Programming (ISP) through USART, SPI, and I
– FAIM API.
– FRO API.
– Flash In-Application Programming (IAP) and In-System Programming (ISP).
– High-speed GPIO interface connected to the ARM Cortex-M0+ IO bus with up to
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 25 channels and 13 trigger inputs.
– One SCTimer/PWM with five input and seven output functions (including capture
and match) for timing and PWM applications. Inputs and outputs can be routed to
or from external pins and internally to or from selected peripherals. Internally, the
SCTimer/PWM supports 8 match/captures, 8 events, and 8 states.
– One 32-bit general purpose counter/timer, with four match outputs and three
capture inputs. Supports PWM mode, external count, and DMA.
– 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 Free Running Oscillator (FRO), a
low-power, low-frequency internal oscillator, or an external clock input in the
always-on power domain.
– Windowed Watchdog timer (WWDT).
– 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 five input pins and external or internal reference voltage.
– Two 10-bit DACs.
– Five USART interfaces with pin functions assigned through the switch matrix and
two fractional baud rate generators.
– Two SPI controllers with pin functions assigned through the switch matrix.
– Four I
2
C-bus interfaces. One I2C supports Fast-mode Plus with 1 Mbit/s data rates
on two true open-drain pins and listen mode. Three I
400 kbit/s on standard digital pins.
• Available in LQFP64, LQFP48, HVQFN48, and HVQFN33 packages
UM11029
Chapter 1: LPC84x Introductory information
– Free Running Oscillator (FRO). This oscillator provides a selectable 18 MHz,
24 MHz, and 30 MHz outputs that can be used as a system clock. Also, these
outputs can be divided down to 1.125 MHz, 1.5 MHz, 1.875 MHz, 9 MHz, 12 MHz,
and15 MHz for system clock. The FRO is trimmed to ±1 % accuracy over the entire
voltage and temperature range 0 C to 70 C.
– Low power boot at 1.5 MHz using FAIM memory.
– External clock input for clock frequencies of up to 25 MHz.
– Crystal oscillator with an operating range of 1 MHz to 25 MHz.
– Low power oscillator can be used as a clock source to the watchdog timer.
– 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 FRO.
– Clock output function with divider that can reflect all internal clock sources.
– 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).
– Brownout detect (BOD).
LPC844M201JHI48HVQFN48 HVQFN: plastic thermal enhanced very thin quad flat package; no leads; 33
LPC844M201JHI33HVQFN33 HVQFN: plastic thermal enhanced very thin quad flat package; no leads; 33
Table 2.Ordering options
Type numberFlash/KB SRAM/KB USART I2CSPIDACGPIOPackage
LPC845M301JBD646416542254LQFP64
LPC845M301JBD486416542242LQFP48
LPC845M301JHI486416542242HVQFN48
LPC845M301JHI336416542129HVQFN33
LPC844M201JBD64648222-54LQFP64
LPC844M201JBD48648222-42LQFP48
LPC844M201JHI48648222-42HVQFN48
LPC844M201JHI33648222-29HVQFN33
NameDescriptionVersion
SOT619-1
terminals; body 7 7 0.85 mm
SOT617-11
terminals; body 5 5 0.85 mm
SOT619-1
terminals; body 5 5 0.85 mm
SOT617-11
terminals; body 5 5 0.85 mm
1.4 General description
1.4.1ARM Cortex-M0+ core configuration
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 LPC84x parts. Different LPC84x parts support
different flash and SRAM memory sizes.
2.2 General description
The LPC84x 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 peripherals.
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 peripheral bus.
The GPIO port and pin interrupt/pattern match registers are accessed by the ARM
Cortex-M0+ single-cycle I/O enabled port (IOP).
Depending on the FAIM configuration, the boot ROM sets the FRO control register to
select the operating frequency accordingly. If FAIM is not programmed or contains an
invalid value, the ROM begins at 12 MHz.
3.4 Pin description
When the ISP entry pin (PIO0_12) is pulled LOW on reset, the part enters ISP mode and
the ISP command handler starts up.
The bootloader executes every time the device is powered on or reset. Based on the chip
configuration information, the bootloader controls initial operation after reset, including
setting internal voltage regulator, system clock, flash controller, miscellaneous factory
trimming value, and then allows programming and reprogramming of internal flash via a
set of commands on USART, I2C slave, or SPI slave bus. The LPC84x device must be
connected to a host system that provides the UART, I
UM11029
Chapter 3: LPC84x Boot Process
2
C or SPI master connections.
During the boot process, a LOW level after reset on the ISP pin is considered as an
external hardware request to start the ISP command handler via USART, I
interface. Otherwise, the bootloader checks if there is valid user code in flash. If the valid
user code is not found, the bootloader checks the FAIM configuration and enters one of
the ISP modes. Auto detect is selected if FAIM is invalid.
Remark: The sampling of pin the ISP entry pin can be disabled through programming
The boot ROM block is 16 KB in size. The boot block is located in the memory region
starting from address 0x0F00 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 4.3.7 “ISP interrupt and SRAM use”
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.
The Fast Initialization Memory (FAIM) is a 256-bit memory configured as eight words (or
rows) of 32-bits per word.
4.2 General description
The FAIM is a multiple time programmable (MTP), ultra low power memory, the full
contents of which are read and latched immediately after reset, with no clocks required.
The FAIM contents provide a user-programmable initial configuration for aspects of the
microcontroller, which take effect immediately after reset, before code begins to run. For
instance, the standard I/O pads normally come out of reset with the internal pull-ups
enabled. In some systems this may cause excess current to flow, until software can
reconfigure the pads. However, by programming the FAIM appropriately, every pad's reset
configuration can be customized. Other aspects which can be controlled by the FAIM are
initial FRO divider value (low power start), serial wire debug disable, default ISP interface
and pins, etc. One 32-bit FAIM row can be programmed, or read, using the ROM IAP calls
FAIMWrite and FAIMRead (see Chapter 5 “
LPC84x ISP and IAP” for details).
After a FAIMMWrite, a FAIMRead is required to update the output of the FAIM. Once a
read has been performed, the FAIM contents are visible in the AHB Peripheral address
space starting at 0x5001_0000.
For the pull-up, pull-down, and HI-Z IOCON pin configuration settings, a reset is needed
to transfer the newly programmed FAIM values into the IOCON pin configuration registers.
Executing a FAIMWrite followed by a FAIMRead does not update the current configuration
in the IOCON pin configuration registers. Only a reset can do so. Software can at any time
rewrite the IOCON pin configuration. Similarly, for SWD Disable, Low Power Start
configuration, ISP interface and pin select, a reset is needed to update the actual startup
configuration.
The FAIM is limited to 200 program cycles, so care must be taken to write this memory
only when necessary during an end-product's development. Also, the FAIM programming
voltage range is 3.0 V Vdd 3.6 V.
Remark: If internal pull-down is enabled via FAIM on the ISP pin (PIO0_12) or the reset
pin (PIO0_5), ensure to have a strong external pull-up to avoid going into ISP mode or into
reset after boot-up.
4.2.1FAIM bit definitions
The functions of FAIM bits are described in the following tables.
All LPC84x devices include ROM-based services for programming and reading the flash
memory in addition to other functions. In-System Programming works on an
unprogrammed or previously programmed device using one from a selection of hardware
interfaces. In-Application Programming allows application software to do the same kinds
of operations.
See specific device data sheets for different flash configurations.
Remark: In addition to the ISP and IAP commands, the flash configuration register
(FLASHCFG) can be accessed in the flash controller block to configure flash memory
access times, see Section 6.4.1
5.2 Features
.
• In-System Programming: In-System programming (ISP) is programming or
reprogramming the on-chip flash memory, using the boot loader software and USART,
2
I
C, or SPI serial port. This can be done when the part resides in the end-user board.
• In Application Programming: In-Application (IAP) programming is performing erase
and write operation on the on-chip flash memory, as directed by the end-user
application code.
• Flexible ISP mode and port pin selection through FAIM memory configuration.
• Small size (64 byte) page erase programming.
5.3 General description
5.3.1Boot loader
For the boot loader operation and boot pin, see Chapter 3 “LPC84x Boot Process”.
The boot loader version can be read by ISP/IAP calls (see Section 5.5.13
Section 5.6.6
5.3.2Memory map after any reset
The boot ROM is located in the memory region starting from the address 0x0F00 0000.
The boot loader 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 later in
The LPC84x is equipped with the Error Correction Code (ECC) capable Flash memory.
The purpose of an error correction module is twofold. Firstly, it decodes data words read
from the memory into output data words. Secondly, it encodes data words to be written to
the memory. The error correction capability consists of single bit error correction with
Hamming code.
The operation of the ECC is transparent to the running application. The ECC content itself
is stored in a flash memory not accessible by the user’s code to either read from it or write
into it on its own. Six bits of ECC corresponds to every consecutive 32 bit of the user
accessible Flash. Consequently, Flash bytes from 0x0000 0000 to 0x0000 0003 are
protected by the first 6-bit ECC, Flash bytes from 0x0000 0004 to 0x0000 0007 are
protected by the second 6-bit ECC byte, etc.
Whenever the CPU requests a read from user’s Flash, both 32 bits of raw data containing
the specified memory location and the matching ECC byte are evaluated. If the ECC
mechanism detects a single error in the fetched data, a correction will be applied before
data are provided to the CPU. When a write request into the user’s Flash is made, write of
user specified content is accompanied by a matching ECC value calculated and stored in
the ECC memory.
UM11029
Chapter 5: LPC84x ISP and IAP
When a sector of Flash memory is erased, the corresponding ECC bytes are also erased.
Once an ECC byte is written, it can not be updated unless it is erased first. Therefore, for
the implemented ECC mechanism to perform properly, data must be written into the flash
memory in groups of 4 bytes (or multiples of 4), aligned as described above.
5.3.4Criteria for Valid User Code
The reserved CPU 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 boot loader code checksums
the first 8 locations in sector 0 of the flash.
If the checksum is not zero indicating valid user code is not found, the bootloader will
check the FAIM configuration and enter UART/I2C/SPI ISP mode automatically.
5.3.5Flash partitions
Some IAP and ISP commands operate on sectors and specify sector numbers. In
addition, a page erase command is available. The size of a sector is 1 KB and the size of
a page is 64 Byte. One sector contains 16 pages.
Code Read Protection is a mechanism that allows the user to enable different levels of
security in the system so that access to the on-chip flash and use of the ISP can be
restricted. When needed, CRP is invoked by programming a specific pattern in the flash
image at offset 0x0000 02FC. IAP commands are not affected by the code read
protection.
Table 1 shows the limitations of the USART ISP commands when CRP (CRP1, CRP2, or
CRP3) is enabled.
Note: Any CRP change becomes effective only after the device has gone through a
power cycle.
Table 14.USART ISP command limitations in CRP modes
NamePattern programmed
in 0x0000 02FC
NO_ISP 0x4E69 7370Prevents sampling of the pins for entering ISP mode. ISP sampling pin is available for
CRP10x1234 5678Access to chip via the SWD pins is disabled. This mode allows partial flash update using
Description
other applications.
the following USART ISP commands and restrictions:
• Write to RAM command cannot access RAM below 0x1000 0600. Access to
addresses below 0x1000 0600 is disabled.
• Copy RAM to flash command cannot write to Sector 0.
• Erase command can erase Sector 0 only when all sectors are selected for erase.
• Compare command is disabled.
• Read Memory command is disabled.
This mode is useful when CRP is required and flash field updates are needed but all
sectors can not be erased. Since compare command is disabled in case of partial
updates the secondary loader should implement checksum mechanism to verify the
integrity of the flash.
CRP20x8765 4321Access to chip via the SWD pins is disabled. The following ISP commands are disabled:
• Read Memory
• Write to RAM
• Go
• Copy RAM to flash
• Compare
When CRP2 is enabled the ISP erase command only allows erasure of all user sectors.
CRP30x4321 8765Access to chip via the SWD pins is disabled. ISP entry selected via the ISP entry pin is
disabled if a valid user code is present in flash sector 0.
This mode effectively disables ISP override using the entry pin. It is up to the application
of the user to provide a flash update mechanism using IAP calls or call reinvoke ISP
command to enable flash update via USART.
Caution: If CRP3 is selected, no future factory testing can be performed on the
device.
In case a CRP mode is enabled and access to the chip is allowed via the ISP, an
unsupported or restricted ISP command will be terminated with return code
CODE_READ_PROTECTION_ENABLED.
5.3.6.1ISP entry protection
In addition to the three CRP modes, the user can prevent the sampling of the pin for
entering ISP mode and thereby release the pin for other applications. This is called the
NO_ISP mode. The NO_ISP mode can be entered by programming the pattern
0x4E69 7370 at location 0x0000 02FC.
The NO_ISP mode is identical to the CRP3 mode except for SWD access, which is
allowed in NO_ISP mode but disabled in CRP3 mode. The NO_ISP mode does not offer
any code protection.
5.3.6.2ISP entry configuration and detection
The LPC84x UART/I2C/SPI ISP mode allows programming and reprogramming of the
internal FLASH via a set of commands on the UART, I2C slave, or SPI slave buses. Two
bits of the FAIM flash are used for ISP mode selection.
If FAIM content is invalid, the default ISP selection is USART/I2C/SPI or auto detection
mode. In auto detection mode, the LPC84x enables all three interfaces on the fixed GPIO
port and pins, and selects the first one that has either a successful auto baud detection on
USART or a valid probe message response on I2C or SPI.
If FAIM content is valid, USART, I2C, or SPI ISP mode is configured in the FAIM.
Additional SWM configuration for the interface and pins through FAIM is required. For
example, if FAIM ISP selection is 0x02, the GPIO port and pin information for SPI0, such
as SSEL, SCK, MOSI, and MISO is provided by the FAIM. The boot ROM reads the GPIO
port and pin information from the FAIM and writes to the SWM and IOCON registers
accordingly as part of the SPI initialization.
5.3.7ISP interrupt and SRAM use
5.3.7.1Interrupts during IAP
The on-chip flash memory is not accessible during erase/write operations. When the user
application code starts executing, the interrupt vectors from the user flash area are active.
Before making any IAP call, either disable the interrupts or ensure that the user interrupt
vectors are active in RAM and that the interrupt handlers reside in RAM. The IAP code
does not use or disable interrupts.
UM11029
Chapter 5: LPC84x ISP and IAP
5.3.7.2RAM used by ISP command handlers
The stack of UART ISP commands is located at address 0x1000 0600. The maximum
stack usage is 1280 bytes (0x500) and grows downwards.
The DMA is used by the SPI ISP mode. The DMA descriptor table location is located at
address 0x1000 0600. The DMA table size is 512 bytes (0x200) and grows upwards.
Therefore, depending on the ISP mode entered, the maximum RAM used by ISP mode is
2 K starting from the address 0x1000 0000.
Memory for the USART and I2C/SPI ISP commands is allocated dynamically.
All USART ISP commands should be sent as single ASCII strings. Strings should be
terminated with Carriage Return (CR) and/or Line Feed (LF) control characters. Extra
<CR> and <LF> characters are ignored. All ISP responses are sent as <CR><LF>
terminated ASCII strings. Data is sent and received in plain binary format.
5.4.1USART ISP initialization
Once the USART ISP mode is entered, the auto-baud routine needs to synchronize with
the host via the serial port (USART).
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 synchronization character in
terms of its own 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 to this, the
host should send back the same string ("Synchronized<CR><LF>").
The 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 crystal frequency (in kHz) at which the part is running. The
response is required for backward compatibility of the boot loader code and is ignored.
"OK<CR><LF>" string is sent to the host after receiving the crystal frequency. If
synchronization is not verified then the auto-baud routine waits again for a
synchronization character. In USART ISP mode, the part is clocked by the FAIM
configuration and the crystal frequency is ignored.
UM11029
Chapter 5: LPC84x ISP and IAP
Once the crystal frequency is received the part is initialized and the ISP command handler
is invoked. For safety reasons an "Unlock" command is required before 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
Section 5.5 “
USART ISP commands”.
5.4.2USART ISP command format
"Command Parameter_0 Parameter_1 ... Parameter_n<CR><LF>" "Data" (Data only for
Write commands).
5.4.3USART ISP response format
"Return_Code<CR><LF>Response_0<CR><LF>Response_1<CR><LF> ...
Response_n<CR><LF>" "Data" (Data only for Read commands).
The following commands are accepted by the ISP command handler. Detailed status
codes are supported for each command. The command handler sends the return code
INVALID_COMMAND when an undefined command is received. Commands and return
codes are in ASCII format.
CMD_SUCCESS is sent by ISP command handler only when received ISP command has
been completely executed and the new ISP command can be given by the host.
Exceptions from this rule are "Set Baud Rate", "Write to RAM", "Read Memory", and "Go"
commands.
Table 15.USART ISP command summary
ISP CommandUsageSection
UnlockU <Unlock Code>5.5.1
Set Baud RateB <Baud Rate> <stop bit>5.5.2
EchoA <setting>5.5.3
Write to RAMW <start address> <number of bytes>5.5.4
DescriptionThe default setting for echo command is ON. When ON the ISP command handler sends the received serial
data back to the host.
Example"A 0<CR><LF>" turns echo off.
5.5.4Write to RAM
The host should send the plain binary code after receiving the CMD_SUCCESS return
code. This ISP command handler responds with “OK<CR><LF>” when the transfer has
finished.
Table 20.USART ISP Write to RAM command
CommandW
InputStart Address: RAM address where data bytes are to be written. This address should be a word boundary.
Number of Bytes: Number of bytes to be written. Count should be a multiple of 4
Return CodeCMD_SUCCESS |
ADDR_ERROR (Address not on word boundary) |
ADDR_NOT_MAPPED |
COUNT_ERROR (Byte count is not multiple of 4) |
PARAM_ERROR |
CODE_READ_PROTECTION_ENABLED
DescriptionThis command is used to download data to RAM. This command is blocked when code read protection
levels 2 or 3 are enabled. Writing to addresses below 0x1000 0600 is disabled for CRP1.
Example"W 268437504 4<CR><LF>" writes 4 bytes of data to address 0x1000 0800.
5.5.5Read Memory
Reads the plain binary code of the data stream, followed by the CMD_SUCCESS return
code.
Table 21.USART ISP Read Memory command
CommandR
InputStart Address: Address from where data bytes are to be read. This address should be a word boundary.
Number of Bytes: Number of bytes to be read. Count should be a multiple of 4.
Return CodeCMD_SUCCESS followed by <actual data (plain binary)> |
ADDR_ERROR (Address not on word boundary) |
ADDR_NOT_MAPPED |
COUNT_ERROR (Byte count is not a multiple of 4) |
PARAM_ERROR |
CODE_READ_PROTECTION_ENABLED
DescriptionThis command is used to read data from RAM or flash memory. This command is blocked when code read
protection is enabled.
Example"R 268437504 4<CR><LF>" reads 4 bytes of data from address 0x1000 0800.
This command makes flash write/erase operation a two-step process.
Table 22.USART ISP Prepare sectors for write operation command
CommandP
InputStar t Sec t o r Num b er
End Sector Number: Should be greater than or equal to start sector number.
Return CodeCMD_SUCCESS |
BUSY |
INVALID_SECTOR |
PARAM_ERROR
DescriptionThis command must be executed before executing "Copy RAM to flash" or "Erase Sector(s)", or “Erase
Pages” command. Successful execution of the "Copy RAM to flash" or "Erase Sector(s)" or “Erase Pages”
command causes relevant sectors to be protected again. To prepare a single sector use the same "Start"
and "End" sector numbers.
Example"P 0 0<CR><LF>" prepares the flash sector 0.
5.5.7Copy RAM to flash
When writing to the flash, the following limitations apply:
1. The smallest amount of data that can be written to flash by the copy RAM to flash
command is 64 byte (equal to one page).
2. One page consists of 16 flash words (lines), and the smallest amount that can be
modified per flash write is one flash word (one line). This limitation exists because
ECC is applied during the flash write operation, see Section 5.3.3
.
3. To avoid write disturbance (a mechanism intrinsic to flash memories), an erase
should be performed after 16 consecutive writes inside the same page. Note that the
erase operation then erases the entire sector.
Remark: Once a page has been written to 16 times, it is still possible to write to other
pages within the same sector without performing a sector erase (assuming that those
pages have been erased previously).
InputFlash Address(DST): Destination flash address where data bytes are to be written. The destination address
should be a 64 byte boundary.
RAM Address(SRC): Source RAM address from where data bytes are to be read.
Number of Bytes: Number of bytes to be written. Should be 64 | 128 | 256 | 512 | 1024
Return Code CMD_SUCCESS |
SRC_ADDR_ERROR (Address not on word boundary) |
DST_ADDR_ERROR (Address not on correct boundary) |
SRC_ADDR_NOT_MAPPED |
DST_ADDR_NOT_MAPPED |
COUNT_ERROR (Byte count is not 64 | 128 | 256 | 512 | 1024) |
SECTOR_NOT_PREPARED_FOR WRITE_OPERATION |
BUSY |
CMD_LOCKED |
PARAM_ERROR |
CODE_READ_PROTECTION_ENABLED
DescriptionThis command is used to program the flash memory. The "Prepare Sector(s) for Write Operation" command
should precede this command. The affected sectors are automatically protected again once the copy
command is successfully executed. This command is blocked when code read protection is enabled. Also see
Section 5.3.3
for the number of bytes that can be written.
Example"C 0 268437504 512<CR><LF>" copies 512 bytes from the RAM address 0x1000 0800 to the flash address
0.
5.5.8Go
Table 24.USART ISP Go command
CommandG
InputAddress: Flash or RAM address from which the code execution is to be started. This address should be on
Table 28.USART ISP Read Part Identification command
CommandJ
InputNone.
Return CodeCMD_SUCCESS followed by part identification number (see Ta bl e 2 9
DescriptionThis command is used to read the part identification number.
Table 29.LPC84x device ID register values
Part numberPart ID
LPC844M201JBD480x00008442
LPC844M201JBD640x00008441
LPC844M201JHI330x00008444
LPC844M201JHI480x00008442
LPC845M301JBD48 0x00008452
LPC845M301JBD64 0x00008451
LPC845M301JHI33 0x00008454
LPC845M301JHI480x00008453
UM11029
Chapter 5: LPC84x ISP and IAP
).
5.5.13Read Boot code version number
Table 30.USART ISP Read Boot Code version number command
CommandK
InputNone
Return CodeCMD_SUCCESS followed by 2 bytes of boot code version number in ASCII format. It is to be interpreted as
<byte1(Major)>.<byte0(Minor)>.
DescriptionThis command is used to read the boot code version number.
5.5.14Compare
Table 31.USART ISP Compare command
CommandM
InputAddress1 (DST): Starting flash or RAM address of data bytes to be compared. This address should be a
word boundary.
Address2 (SRC): Starting flash or RAM address of data bytes to be compared. This address should be a
word boundary.
Number of Bytes: Number of bytes to be compared; should be a multiple of 4.
Return CodeCMD_SUCCESS | (Source and destination data are equal) |
COMPARE_ERROR | (Followed by the offset of first mismatch) |
COUNT_ERROR (Byte count is not a multiple of 4) |
ADDR_ERROR |
ADDR_NOT_MAPPED |
PARAM_ERROR |
CODE_READ_PROTECTION_ENABLED
DescriptionThis command is used to compare the memory contents at two locations.
Example"M 8192 268437504 4<CR><LF>" compares 4 bytes from the RAM address 0x1000 0800 to the 4 bytes
FAIM page number: 0 - 7
FAIM configuration value: user defined (if FAIM access is page write)
Return CodeCMD_SUCCESS |
PARAM_ERROR |
INVALID_COMMAND |
INVA LID_PA GE
DescriptionThis command is used to read/write FAIM page
Example"O 0 5<CR><LF>" reads the FAIM page 5.
“O 1 7<CR><LF>” initiates a write to FAIM page 7. When the system is ready to receive the data it responds
with 0<CR><LF> [CMD_SUCCESS]. The host should send a raw binary data of 4 bytes. FAIM programming
starts when the fourth byte is received and the ISP command responds with 0<CR><LF> [CMD_SUCCESS]
error code after the programming is completed successfully.
UM11029
Chapter 5: LPC84x ISP and IAP
5.5.19ISP/IAP Error codes
These error codes are located in the error.h file.
Table 36. ISP/IAP Error codes
Return
Code
0x0CMD_SUCCESSCommand is executed successfully. Sent by ISP handler only when
0x1INVALID_COMMANDInvalid command.
0x2SRC_ADDR_ERROR Source address is not on word boundary.
0x3DST_ADDR_ERRORDestination address is not on a correct boundary.
0x4SRC_ADDR_NOT_MAPPEDSource address is not mapped in the memory map. Count value is
0x5DST_ADDR_NOT_MAPPEDDestination address is not mapped in the memory map. Count value is
0x6COUNT_ERRORByte count is not multiple of 4 or is not a permitted value.
0x7INVALID_SECTOR/INVALID_PAGESector/page number is invalid or end sector number is greater than
0x8SECTOR_NOT_BLANKSector is not blank.
0x9SECTOR_NOT_PREPARED_
0xACOMPARE_ERRORSource and destination data not equal.
0xBBUSYFlash programming hardware interface is busy.
0xCPARAM_ERRORInsufficient number of parameters or invalid parameter.
0xDADDR_ERRORAddress is not on word boundary.
Error codeDescription
FOR_WRITE_OPERATION
command given by the host has been completely and successfully
executed.
taken into consideration where applicable.
taken into consideration where applicable.
start sector number.
Command to prepare sector for write operation was not executed.
For in application programming the IAP routine should be called with a word pointer in
register r0 pointing to memory (RAM) containing command code and parameters. The
result of the IAP command is returned in the result table pointed to by register r1. The user
can reuse the command table for result by passing the same pointer in registers r0 and r1.
The parameter table should be big enough to hold all the results in case the number of
results are more than number of parameters. Parameter passing is illustrated in the
Figure 5
The number of parameters and results vary according to the IAP command. The
maximum number of parameters is 5, passed to the "Copy RAM to FLASH" command.
The maximum number of results is 5, returned by the "ReadUID" command. The
command handler sends the status code INVALID_COMMAND when an undefined
command is received. The IAP routine resides at location 0x0F001FF0 and it is thumb
code, therefore called as 0x0F001FF1 by the Cortex-M4 to insure Thumb operation.
The IAP function could be called in the following way using C:
Define the IAP location entry point. Since the least significant bit of the IAP location is set
there will be a change to Thumb instruction set if called by the Cortex-M4.
UM11029
Chapter 5: LPC84x ISP and IAP
.
Define data structure or pointers to pass IAP command table and result table to the IAP
function:
unsigned int command_param[5];
unsigned int status_result[5];
or
unsigned int * command_param;
unsigned int * status_result;
command_param = (unsigned int *) 0x...
status_result =(unsigned int *) 0x...
Define pointer to function type, which takes two parameters and returns void. Note the IAP
returns the result with the base address of the table residing in R1.
typedef void (*IAP)(unsigned int [],unsigned int[]);
IAP iap_entry;
Setting the function pointer:
#define IAP_LOCATION *(volatile unsigned int *)(0x0F001FF1)
iap_entry=(IAP) IAP_LOCATION;
To call the IAP use the following statement.
iap_entry (command_param,status_result);
Up to 4 parameters can be passed in the r0, r1, r2 and r3 registers respectively (see the
ARM Thumb Procedure Call Standard SWS ESPC 0002 A-05). Additional parameters are
passed on the stack. Up to 4 parameters can be returned in the r0, r1, r2 and r3 registers
respectively. Additional parameters are returned indirectly via memory.
The flash memory is not accessible during a write or erase operation. IAP commands,
which results in a flash write/erase operation, use 32 bytes of space in the top portion of
the on-chip RAM for execution. The user program should not be use this space if IAP flash
programming is permitted in the application.
T able 37.IAP Command Summary
IAP CommandCommand codeSection
Prepare sector(s) for write operation50 (decimal)5.6.1
This command makes flash write/erase operation a two step process.
Table 38.IAP Prepare sector(s) for write operation command
CommandPr epare sector(s) for write operation
InputCommand code: 50 (decimal)
Param0: Start Sector Number
Param1: End Sector Number (should be greater than or equal to start sector number).
Status codeCMD_SUCCESS |
BUSY |
INVALID_SECTOR
ResultNone
DescriptionThis command must be executed before executing "Copy RAM to flash" or "Erase Sector(s)" or “Erase
page(s)” command. Successful execution of the "Copy RAM to flash" or "Erase Sector(s)" or “Erase page(s)”
command causes relevant sectors to be protected again. To prepare a single sector use the same "Start" and
"End" sector numbers.
5.6.2Copy RAM to flash
See Section 5.5.7 for limitations on the write-to-flash process.
Table 39.IAP Copy RAM to flash command
CommandCopy RAM to flash
InputCommand code: 51 (decimal)
Param0(DST): Destination flash address where data bytes are to be written. This address should be a 64
byte boundary.
Param1(SRC): Source RAM address from which data bytes are to be read. This address should be a word
boundary.
Param2: Number of bytes to be written. Should be 64 | 128 | 256 | 512 | 1024.
Param3: System Clock Frequency (CCLK) in kHz.
Status codeCMD_SUCCESS |
SRC_ADDR_ERROR (Address not a word boundary) |
DST_ADDR_ERROR (Address not on correct boundary) |
SRC_ADDR_NOT_MAPPED |
DST_ADDR_NOT_MAPPED |
COUNT_ERROR (Byte count is not 64 | 128 | 256 | 512 | 1024) |
SECTOR_NOT_PREPARED_FOR_WRITE_OPERATION |
BUSY
ResultNone
DescriptionThis command is used to program the flash memory. The affected sectors should be prepared first by calling
"Prepare Sector for Write Operation" command. The affected sectors are automatically protected again once
the copy command is successfully executed. Also see Section 5.3.3
written.
Remark: All user code must be written in such a way that no master accesses the flash while this command
Param0: Start Sector Number
Param1: End Sector Number (should be greater than or equal to start sector number).
Param2: System Clock Frequency (CCLK) in kHz.
Table 43.IAP Read Boot Code version number command
CommandRead boot code version number
InputCommand code: 55 (decimal)
Parameters: None
Status codeCMD_SUCCESS
ResultResult0: 2 bytes of boot code version number. Read as <byte1(Major)>.<byte0(Minor)>
DescriptionThis command is used to read the boot code version number.
5.6.7Compare <address1> <address2> <no of bytes>
Table 44.IAP Compare command
CommandCompare
InputCommand code: 56 (decimal)
Param0(DST): Starting flash or RAM address of data bytes to be compared; should be a word boundary.
Param1(SRC): Starting flash or RAM address of data bytes to be compared; should be a word boundary.
Param2: Number of bytes to be compared; should be a multiple of 4.
Status codeCMD_SUCCESS |
COMPARE_ERROR |
COUNT_ERROR (Byte count is not a multiple of 4) |
ADDR_ERROR |
ADDR_NOT_MAPPED
ResultResult0: Offset of the first mismatch if the status code is COMPARE_ERROR.
DescriptionThis command is used to compare the memory contents at two locations.
UM11029
5.6.8Reinvoke ISP
Table 45.Reinvoke ISP
CommandCompare
InputCommand code: 57 (decimal)
Param0(mode): ISP interface selection
0 - Auto or UIS ISP (only applicable when FAIM configuration is invalid.)
1 - USART ISP (Match FAIM ISP configuration if it is valid.)
2 - I2C ISP (Match FAIM ISP configuration if it is valid.)
3 - SPI ISP (Match FAIM ISP configuration if it is valid.)
Status codeERR_ISP_REINVOKE_ISP_CONFIG
ResultNone.
DescriptionThis command is used to invoke the ISP. If the ISP is invoked, then the CPU clock is switched to FRO.
This command is used to invoke the boot loader in ISP mode. It maps boot vectors and configures the
peripherals for ISP.
This command may be used when a valid user program is present in the internal flash memory and the ISP
entry pin are not accessible to force the ISP mode.
If using USART ISP mode, enable the clocks to the default before calling this command.
The I2C/SPI ISP allows programming and reprogramming of the internal flash via a set of
commands on the I2C slave or SPI slave buses of the LPC84x. These need to be
connected to a host system that provides the I2C or SPI master connections to the
LPC84x.
5.7.1Dual purpose of the ISP/ISP_IRQ pin
The ISP pin is a special function pin that is switches function state once I2C/SPI ISP mode
is entered and the host interface has been selected. Once the host interface has been
selected, the ISP pin becomes an output pin used for indicating to the host system that a
command can be serviced. During this phase, the pin is called ISP_IRQ. A low state on
this pin indicates to the host that the LPC84x needs servicing.
Notes on ISP input to ISP_IRQ output switching
After reset, ISP is set to an input. When the FAIM configuration is invalid and host
interface is not selected, on entry to the USART/I2C/SPI ISP mode from device reset, the
interface is in auto-detection mode and the pin remains an input. Once the host interface
sends the first probe command via I2C or SPI interface, and it is accepted by the LPC84x,
then the interface is detected, the ISP pin switches to an output high as ISP_IRQ.
UM11029
Chapter 5: LPC84x ISP and IAP
When the FAIM configuration is valid and interface selection is either I2C or SPI ISP
mode, this pin switches to an output high immediately without a probe message.
When using the ‘Reinvoke ISP’ command, the host interface is selected as part of the IAP
command, the pin switches to an output high immediately without a probe message.
Care must be used that any external signal applied to the ISP pin to drive the ISP pin low
should be done with a pull-down resistor and not tied to ground, so the ISP_IRQ output
does not short directly to a low state when driving high. Host systems that drive this pin to
selectively enable I2C/SPI ISP mode should drive this pin via a resistor.
5.7.2I2C/SPI ISP mode transaction protocol
This section explains the high-level protocol used with the I2C and SPI interfaces. A
typical transaction starts with the host sending a command packet, the LPC84x
processing the command packet, the LPC84x optionally asserting the ISP_IRQ line low
when processing is complete, and then the host system getting the response packet. The
LPC84x will hold the ISP_IRQ pin asserted (low) until the host system requests the
response packet. The process is shown in Figure 6
protocol – some commands may have no response or may not assert the ISP_IRQ pin.
The LPC84x will respond to a host system on I2C addresses 0x18, 0x1C, 0x30, and 0x38.
The host system’s I2C master clock rate can be as high as 1MHz. The LPC84x may
extend the I2C clock to delay the I2C master if it needs more time to perform an operation.
When using I2C, the command is given to the LPC84x by an I2C write transaction. The
entire command packet is accepted by the LPC84x and then processing starts. Once the
LPC84x has completed processing, it may drive the ISP1_IRQ line low until the host
system issues an I2C read transaction to get the response.
5.7.4SPI ISP mode transaction protocol
The LPC84x will respond to a host system on the configured SPI interface. A transfer is
started once SSEL goes low on the LPC84x. The SPI clock to the LPC84x should not
exceed 2MHz. SPI SSEL to first clock timing should not be less than 100uS. SPI transfer
configuration should be SPI Mode 0 with 8 data bits.
SPI transactions are bi-directional. During the command packet phase, the host system
should ignore the read data (send data from LPC84x). During the response phase, the
LPC84x will ignore the read data (send data from host).
Although SPI is bi-directional, the command and response packet phases only send data
one way for each phase. During the command packet phase, a single SPI transfer occurs
where the command and data is sent from the host system. In this phase, SSEL is
asserted low, the command packet is sent, and then SSEL is deasserted. The host
system then waits for ISP1_IRQ to go low from the LPC84x. Once ISP1_IRQ goes low,
the host system then asserts SSEL low, the response packet is read, and then SSEL is
deasserted. The LPC84x will deassert ISP1_IRQ at the start of the response packet prior
to the response packet completing transfer.
If CRP is enabled (CRP1, CRP2, or CRP3) then the I2C/SPI commands may be limited in
functionality. See Table 51
If NO_ISP mode is used in the application, the I2C/SPI ISP mode cannot be started when
the ISP0 pin is asserted. The only way to recover a system when this happens is to erase
flash using the SWD interface or via the IAP commands. The application can also use the
‘Re-invoke ISP’ command to get back into the I2C/SPI ISP mode.
Table 51.ISP commands allowed for different CRP levels
ISP commandCRP
SH_CMD_GET_VERSIONyesyesyesn/a
SH_CMD_RESETyesyesyesn/a
SH_CMD_BOOTyesyesyesn/a
SH_CMD_CHECK_IMAGEyesyesyesn/a
SH_CMD_PROBEyesyesyesn/a
SH_CMD_WRITE_BLOCKyesyes; not sector 0non/a
SH_CMD_READ_BLOCKyesnonon/a
SH_CMD_SECTOR_ERASEyesyes; not sector 0non/a
SH_CMD_PAGE_ERASEyesyes; not sector 0non/a
SH_CMD_PAGE_WRITEyesyes; not sector 0non/a
SH_CMD_PAGE_READyesnonon/a
SH_CMD_WRITE_SUBBLOCK yesyes; not sector 0non/a
SH_CMD_READ_SUBBLOCKyesnonon/a
SH_CMD_BULK_ERASEyesyes; sector 0 can be erased only
SH_CMD_WRITE_RAMyesyes; partially
SH_CMD_GOTOyesnonon/a
SH_CMD_FAIM_READyesyesyesn/a
SH_CMD_FAIM_WRITEyesyesyesn/a
disabled
for limitations of I2C/SPI ISP commands when CRP is enabled.
This command can be used to reset the LPC84x. This command has no response.
Table 55.Command packet
FieldOffset Size (bytes) ValueDescription
command0x00x10xA2'Reset' command identifier
5.8.3SH_CMD_BOOT (0xA3) command
This command can be used to boot the application currently programmed into flash, boot
address starting at 0x0. This command has a response only if the boot image does not
have a valid checksum.
Table 56.Command packet
FieldOffset Size (bytes) ValueDescription
command0x00x10xA3'Boot' command identifier
UM11029
Chapter 5: LPC84x ISP and IAP
Table 57.Response packet
FieldOffset Size (bytes) ValueDescription
sop0x00x10x55Start of packet identifier
command0x10x10xA3Processed command identifier
length0x20x20x4Length of the response packet on an error
errorCode0x40x4Error codeBoot prevention due to invalid checksum.
5.8.4SH_CMD_CHECK_IMAGE (0xA4) command
This command can be used to check the checksum value of the application currently
programmed into FLASH. The command verifies the checksum of the image. If the
checksum is valid, a response value of 0 is returned, otherwise, the checksum value is
returned.
Table 58.Command packet
FieldOffset Size (bytes) ValueDescription
command0x00x10xA4'Check image' command identifier
Table 59.Response packet
FieldOffset Size (bytes) ValueDescription
sop0x00x10x55Start of packet identifier
command0x10x10xA4Processed command identifier
length0x20x20x04Length of the response packet
checksum0x40x4CRC32 value0x0 if match, otherwise the checksum value.
5.8.5SH_CMD_PROBE (0xA5) command
The probe command is used to select either the I2C or SPI interface when in
auto-detection mode. This command is required when booting into the I2C/SPI ISP mode
from a reset condition. The probe command data is accepted on the supported I2C or SPI
ISP pins. Once the data is checked, the ISP1_IRQ line is driven LOW. The interface that
was used for the probe command becomes the active interface and the other interface is
disabled.
The probe command is optional when the I2C or SPI ISP mode is re-invoked from an
application using the ‘Re-invoke ISP’ IAP command. Only the interface selected with the
‘Re-invoke ISP’ IAP command will be active for the optional probe command.
The host system should repeatedly send the probe command to the LCP84x via one of
the supported interfaces until the LPC84x asserts the ISP1_IRQ pin LOW.
UM11029
Chapter 5: LPC84x ISP and IAP
Table 60.Command packet
FieldOffset Size (bytes) Value Description
command0x00x10xA5‘Probe’ command identifier
ifSel0x10x1Host interface type and port. Must match selected interface used to the
Reserved00x20x1Set to 0x00
Reserved10x30x1Set to 0x00
Reserved20x40x1Set to 0x00
Reserved30x50x1Set to 0x00
Reserved40x60x1Set to 0x00
checksum0x70x1XOR of all the 7 bytes above.
Table 61.Response packet success
FieldOffset Size (bytes) Value Description
sop0x00x10x55Start of packet identifier
command0x10x10xA5 Processed command identifier
length0x20x20x00On Success, the XOR of the 7 bytes is zero and the interface number
LPC84x.
1 – I2C0 port
4 – SPI0 port
matches. Set to 0x00.
Table 62.Response packet error
FieldOffset Size (bytes) ValueDescription
sop0x00x10x55Start of packet identifier
command0x10x10xA5Processed command identifier
length0x20x20x04On error this field is set to 4
errorCode0x40x4Error code Error code specified in error.h
5.8.6SH_CMD_WRITE_BLOCK (0xA6) command
The write block command is used to write a block of data to flash. A block of data is 128
bytes.
length0x20x2Page_size+4On success this field is set to Page_size+4
data0x4Page_sizeFlash page content.
checkSumPage_size+4 0x4CRC32CRC32 of the packet excluding this field
Table 80.Response packet (error)
FieldOffset Size (bytes) ValueDescription
sop0x00x10x55Start of packet identifier
command0x10x10xABProcessed command identifier
length0x20x20x04On error this field is set to 4
errorCode0x40x4Error codeError code specified in error.h parameters
5.8.12SH_CMD_WRITE_SUBBLOCK (0xAC) command
The write sub-block command is used for queuing data for a full flash block write. It is
used when the host system cannot send the entire data block to the LPC84x in a single
I2C transfer using the ‘Write block’ command. When using this command, multiple
sub-blocks are sent to the LPC84x in sequential order for the block. The LPC84x collects
all the packets and performs the flash write once the last packet is received. If any other
commands are sent between ‘Write sub-block’ commands, the collected buffers are
discarded and the operations needs to restart. If a sub-block number crosses a block
boundary, the LPC84x automatically erases the sector prior to the write operation.
errorCode0x40x4Error codeError code specified in error.h parameters
5.8.13SH_CMD_ READ_SUBBLOCK (0xAD) command
The read sub-block command is used for reading partial data from a full flash block write.
It is used when the host system cannot receive the entire data block to the LPC84x in a
single I2C transfer using the ‘Read block’ command.
length0x20x20x4Length of the response packet. 0x4 = failure
errorCode0x40x4Error codeError code specified in error.h
5.8.18SH_CMD_FAIM_WRITE (0xBF) command
This command is used to write one page to the FAIM memory. One page of FAIM is 4
bytes.
Table 98.Command packet
FieldOffset Size (bytes) ValueDescription
command0x00x10xBF‘FAIM write’ command identifier
crcCheck0x10x100 – Do CRC check for this packet
PageNum0x20x2Page number to program data
data0x40x4Data to be programmed in FAIM
checksum0x80x4CRC32CRC32 of the packet excluding this field. Set this field to 0 if crcCheck
01 – Ignore CRC field for this packet
is set to 1.
Table 99.Response packet (success)
FieldOffset Size (bytes) ValueDescription
sop0x00x10x55Start of packet identifier
command0x10x10xBFProcessed command identifier
length0x20x20x00On success this field is set to 0
Table 100. Response packet (error)
FieldOffset Size (bytes) ValueDescription
sop0x00x10x55Start of packet identifier
command0x10x10xBFProcessed command identifier
length0x20x20x4Length of the response packet. 0x4 = failure
errorCode0x40x4Error codeError code specified in error.h
5.8.19I2C/SPI ISP Error codes
See Tab le 3 6 “ ISP/IAP Error codes”.
5.8.20I2C/SPI ISP mode protocol software support
This section includes predefined command definitions and software structures used for
communication for the I2C/SPI ISP protocol. These may be used with a host application
that talks to the I2C/SPI ISP interface via the supported I2C or SPI slave interfaces.
uint8_t sop;/*!< Start of packet = 0x55 for bootloader */
uint8_t cmd;/*!< Response to the Command ID. */
uint16_t length; /*!< Response data length not including this header. */
uint8_t cmd;/*!< Command ID */
uint8_t crc_check; /*!< specifies if we need to do CRC check before processing */
uint16_t block_nr; /*!< Block number.*/
uint32_t data[SL_FLASH_BLOCK_SZ/4];/*!< Data */
uint32_t crc32;/*!< CRC32 of command header and data */
16:0STOPAStop address for signature generation (the word
30:17-Reserved, user software should not write ones to
31STRTBISTWhen this bit is written to 1, signature generation starts.
UM11029
Chapter 6: LPC84x Flash signature generator
value
0
address bits[18:2]).
NA
The value read from a reserved bit is not defined.
value
0
specified by STOPA is included in the address range).
The address is in units of memory words, not bytes.
0
reserved bits. The value read from a reserved bit is not
defined.
0
At the end of signature generation, this bit is
automatically cleared.
6.4.4Flash signature generation result register
The signature generation result register returns the flash signature produced by the
embedded signature generator.
The generated flash signature can be used to verify the flash memory contents. The
generated signature can be compared with an expected signature and thus makes saves
time and code space. The method for generating the signature is described in
Section 6.5.1
Table 105. FMSW0 register bit description (FMSW0, address: 0x4004 002C)
BitSymbolDescriptionReset value
31:0SIG32-bit signature.-
.
6.4.5Flash module signature status register
The read-only FMSTAT register provides a means of determining when signature
generation has completed. Completion of signature generation can be checked by polling
the SIG_DONE bit in FMSTAT. SIG_DONE should be cleared via the FMSTATCLR
register before starting a signature generation operation, otherwise the status might
indicate completion of a previous operation.
The flash module contains a built-in signature generator. This generator can produce a
32-bit signature from a range of flash memory. A typical usage is to verify the flashed
contents against a calculated signature (e.g. during programming).
The address range for generating a signature must be aligned on flash-word boundaries,
that is, 32-bit boundaries. Once started, signature generation completes independently.
While signature generation is in progress, the flash memory cannot be accessed for other
purposes, and an attempted read will cause a wait state to be asserted until signature
generation is complete. Code outside of the flash (e.g. internal RAM) can be executed
during signature generation. This can include interrupt services, if the interrupt vector
table is re-mapped to memory other than the flash memory. The code that initiates
signature generation should also be placed outside of the flash memory.
6.5.1.1Signature generation address and control registers
These registers control automatic signature generation. A signature can be generated for
any part of the flash memory contents. The address range to be used for generation is
defined by writing the start address to the signature start address register (FMSSTART)
and the stop address to the signature stop address register (FMSSTOP. The start and
stop addresses must be aligned to 32-bit boundaries.
UM11029
Chapter 6: LPC84x Flash signature generator
Signature generation is started by setting the STRTBIST bit in the FMSSTOP register.
Setting the STRTBIST bit is typically combined with the signature stop address in a single
write.
Table 103
registers respectively.
and Table 104 show the bit assignments in the FMSSTART and FMSSTOP
6.5.1.2Signature generation
A signature can be generated for any part of the flash contents. The address range to be
used for signature generation is defined by writing the start address to the FMSSTART
register, and the stop address to the FMSSTOP register.
The signature generation is started by writing a 1 to the SIG_START bit in the FMSSTOP
register. Starting the signature generation is typically combined with defining the stop
address, which is done in the STOP bits of the same register.
The time that the signature generation takes is proportional to the address range for which
the signature is generated. Reading of the flash memory for signature generation uses a
self-timed read mechanism and does not depend on any configurable timing settings for
the flash. A safe estimation for the duration of the signature generation is:
When signature generation is triggered via software, the duration is in AHB clock cycles,
and tcy is the time in ns for one AHB clock. The SIG_DONE bit in FMSTAT can be polled
by software to determine when signature generation is complete.
After signature generation, a 32-bit signature can be read from the FMSW0 register. The
32-bit signature reflects the corrected data read from the flash and the flash parity bits and
check bit values.
6.5.1.3Content verification
The signature as it is read from the FMSW0 register must be equal to the reference
signature. The following pseudo-code shows the algorithm to derive the reference
signature:
sign = 0
FOR address = FMSSTART.START to FMSSTOP.STOPA
{
• 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.
7.3 General description
The Nested Vectored Interrupt Controller (NVIC) is an integral part of the Cortex-M0+. The
tight coupling to the CPU allows for low interrupt latency and efficient processing of late
arriving interrupts.
7.3.1Interrupt sources
Table 108 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 108. Connection of interrupt sources to the NVIC
Interrupt
number
0SPI0_IRQSPI0 interruptSee Table 340 “
1SPI1_IRQSPI1 interruptSame as SPI0_IRQ
2DAC0_IRQDAC0 interrupt-
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”.
Table 108. Connection of interrupt sources to the NVIC
Interrupt
number
24PININT0_IRQPin interrupt 0 or pattern
25PININT1_IRQPin interrupt 1 or pattern
26PININT2_IRQPin interrupt 2 or pattern
27PININT3_IRQPin interrupt 3 or pattern
28PININT4_IRQPin interrupt 4 or pattern
29PININT5_IRQ or
30PININT6_IRQ r
31PININT7_IRQ or
NameDescriptionFlags
match engine slice 0
interrupt
match engine slice 1
interrupt
match engine slice 2
interrupt
match engine slice 3
interrupt
match engine slice 4
interrupt
Pin interrupt 5 or pattern
DAC1_IRQ
USART3_IRQ
USART4_IRQ
match engine slice 5
interrupt or DAC1 interrupt
Pin interrupt 6 or pattern
match engine slice 6
interrupt or USART3
interrupt
Pin interrupt 7 or pattern
match engine slice 7
interrupt or USART4
interrupt
UM11029
PSTAT - pin interrupt status
PSTAT - pin interrupt status
PSTAT - pin interrupt status
PSTAT - pin interrupt status
PSTAT - pin interrupt status
PSTAT - pin interrupt status
PSTAT - pin interrupt status
PSTAT - pin interrupt status
7.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 108
register in the SYSCON block (Table 166
). To avoid using the same peripheral interrupt as
as NMI using the NMISRC
NMI exception and normal interrupt, disable the interrupt in the NVIC when you configure
it as NMI.
7.3.3Vector table offset
The vector table contains the reset value of the stack 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
The ISER0 register allows to enable peripheral interrupts or to read the enabled state of
those interrupts. Disable interrupts through the ICER0 (Section 7.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 110. Interrupt Set Enable Register 0 register (ISER0, address 0xE000 E100) bit description
BitSymbolDescriptionReset value
0ISE_SPI0Interrupt enable.0
1ISE_SPI1Interrupt enable.0
2ISE_DAC0Interrupt enable.0
3ISE_UART0Interrupt enable.0
4ISE_UART1Interrupt enable.0
5ISE_UART2Interrupt enable.0
6-Reserved0
7ISE_I2C1Interrupt enable.0
8ISE_I2C0Interrupt enable.0
9ISE_SCTInterrupt enable.0
10ISE_MRTInterrupt enable.0
11ISE_CMPInterrupt enable for comparator.0
12ISE_WDTInterrupt enable.0
13ISE_BODInterrupt enable.0
14ISE_FLASHInterrupt enable.0
15ISE_WKTInterrupt enable.0
16ISE_ADC_SEQAInterrupt enable.0
17ISE_ADC_SEQBInterrupt enable.0
18ISE_ADC_THCMPInterrupt enable.0
19ISE_ADC_OVRInterrupt enable.0
20ISE_SDMAInterrupt enable.0
21ISE_I2C2Interrupt enable.0
22ISE_I2C3Interrupt enable.0
23ISE_CT32b0Interrupt enable.0
24ISE_PININT0Interrupt enable.0
25ISE_PININT1Interrupt enable.0
26ISE_PININT2Interrupt enable.0
27ISE_PININT3Interrupt enable.0
28ISE_PININT4Interrupt enable.0
29ISE_PININT5 or ISE_DAC1Interrupt enable for both pinint5 and DAC1.0
30ISE_PININT6 or ISE_USART3 Interrupt enable for both pinint6 and USART3.0
31ISE_PININT7or ISE_USART4 Interrupt enable for both pinint7 and USART4.0
The ICER0 register allows disabling the peripheral interrupts, or for reading the enabled
state of those interrupts. Enable interrupts through the ISER0 registers (Section 7.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 peripheral interrupts, or for
reading the pending state of those interrupts. Clear the pending state of interrupts through
the ICPR0 registers (Section 7.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 112. Interrupt set pending register 0 register (ISPR0, address 0xE000 E200) bit description
Table 112. Interrupt set pending register 0 register (ISPR0, address 0xE000 E200) bit description
BitSymbolDescriptionReset value
24ISP_PININT0Interrupt pending set.0
25ISP_PININT1Interrupt pending set.0
26ISP_PININT2Interrupt pending set.0
27ISP_PININT3Interrupt pending set.0
28ISP_PININT4Interrupt pending set.0
29ISP_PININT5 or ISP_DAC1Interrupt pending set for both pinint5
and DAC1.
30ISP_PININT6 or ISP_UART3Interrupt pending set for both pinint6
and USART3.
31ISP_PININT7 or ISP_USART4 Interrupt pending set for both pinint7
and USART4.
0
0
0
…continued
7.4.4Interrupt Clear Pending Register 0 register
The ICPR0 register allows clearing the pending state of the peripheral interrupts, or for
reading the pending state of those interrupts. Set the pending state of interrupts through
the ISPR0 register (Section 7.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
Interrupt pending clear for both pinint5 and
DAC1.
Interrupt pending clear for both pinint6 and
USART3.
Interrupt pending clear for both pinint7 and
USART4.
0
0
0
7.4.5Interrupt Active Bit Register 0
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 are enabled.
…continued
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 114. Interrupt Active Bit Register 0 (IABR0, address 0xE000 E300) bit description
The system configuration block is identical for all LPC84x parts.
8.2 Features
• Clock control
– Configure the system PLL.
– Configure system oscillator, watchdog oscillator, and FRO oscillator.
– Enable clocks to individual peripherals and memories.
– Configure clock output.
– Configure clock dividers, digital filter clock, and USART baud rate clock.
– Configure ADC, SCT 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.
8.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 8.4
• No clock configuration is needed. The clock to the SYSCON block is always enabled.
By default, the SYSCON block is clocked by the FRO.
8.3.1Set up the FRO
The FRO provides a selectable fro_oscout of 18 MHz, 24 MHz, and 30 MHz outputs that
can be used as a system clock. Also, the fro_oscout can be divided down to provide
frequencies of 1.125 MHz, 1.5 MHz, 1.875 MHz, 9 MHz, 12 MHz, or 15 MHz for system
clock.
By default, the fro_oscout is 24 MHz and is divided by 2 to provide a default system (CPU)
clock frequency of 12 MHz.
1. By default, the FRO is enabled. If required, the FRO can be enabled in the
2. Select the fro_oscout (30 MHz/24 MHz/18 MHz) using the set_fro_frequency API call:
3. The FROOSCCTRL register can be used to select direct fro_oscout or divided
4. Use the FRODIRECTCLKUEN register to update the fro clock:
5. Based on the Low Power boot bit in the FAIM, default divide by 2 is replaced with
8.3.2Set 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 input clock, use the PLL to boost the
input frequency.
PDRUNCFG register:
Section 8.6.47 “
Chapter 9 “
(continued)”.
fro_oscout for fro clock.
Section 8.6.7 “
divide by 16.
Power configuration register”
LPC84x FRO API ROM routine” and Figure 9 “UM11029 clock generation
FRO direct clock source update register”
UM11029
Chapter 8: LPC84x System configuration (SYSCON)
1. Power up the system PLL in the PDRUNCFG register.
Section 8.6.47 “
2. Select the PLL input in the SYSPLLCLKSEL register. You have the following input
options:
– FRO: 12 MHz internal oscillator (default).
– External clock input: It can be external crystal oscillator using the
XTALIN/XTALOUT pins or CLKIN from external pin.
Remark: The min frequency for PLL is 10 MHz.
Section 8.6.9 “
3. Update the PLL clock source in the SYSPLLCLKUEN register.
Section 8.6.10 “
4. Configure the PLL M and N dividers.
Section 8.6.2 “
5. Wait for the PLL to lock by monitoring the PLL lock status.
Section 8.6.3 “
Power configuration register”
System PLL clock source select register”
System PLL clock source update register”
System PLL control register”
System PLL status register”
8.3.3Configure 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 main clock pre PLL 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).
1. Select the main clock pre PLL. You have the following options:
– Main clock pre PLL.
– PLL output: You must configure the PLL to use the PLL output.
Section 8.6.9 “
Section 8.6.14 “
clock.
Section 8.6.15 “
therefore must have an active clock. The core is always clocked.
Section 8.6.21 “
Section 8.6.22 “System clock control 1 register”
Main clock PLL source update enable register”
Main clock source update enable register”
System PLL clock source select register”
Main clock source update enable register”
System clock divider register”
System clock control 0 register”
8.3.4Set up the system oscillator using XTALIN and XTALOUT
To use the system oscillator with the LPC84x, assign the XTALIN and XTALOUT 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.
4. Set SYSOSC_PD bit to 0 in PDRUNCFG register to turn on the system oscillator.
5. Wait 500 s for the system oscillator to stabilize.
Related registers:
Table 212 “
Tab le 2 11 “PIO0_9 register (PIO0_9, address 0x4004 4034) bit description”
PINENABLE0Table 195
PLL. Disable the ACMP_I1 function
in the PINENABLE register.
8.5 General description
8.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, SPI clock,
2
I
C clock, SCTimer/PWM clock, ADC 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 7
.
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 8.6.45 “
Section 8.6.2 “System PLL control register”
Section 8.6.5 “Watchdog oscillator control register”
Deep-sleep mode configuration register”
NXP Semiconductors
Section 8.6.4 “System oscillator control register”
8.5.3Configuration of reduced power-modes
The system control block configures analog blocks that can remain running in the reduced
power modes (the BOD and the watchdog oscillator for safe operation) and enables
various interrupts to wake up the chip when the internal clocks are shut down in
Deep-sleep and Power-down modes. For details, see the following registers:
The system memory remap register selects whether the exception vectors are read from
boot ROM, flash, or SRAM. By default, the flash memory is mapped to address
0x0000 0000. When the MAP bits in the SYSMEMREMAP register are set to 0x0 or 0x1,
the boot ROM or RAM respectively are mapped to the bottom 512 bytes of the memory
map (addresses 0x0000 0000 to 0x0000 0200).
Table 126. System memory remap register (SYSMEMREMAP, address 0x4004 8000) bit
description
BitSymbolValueDescriptionReset
value
1:0MAPSystem memory remap. Value 0x3 is reserved.0x2
0x0Bootloader Mode. Interrupt vectors are re-mapped to Boot
ROM.
0x1User RAM Mode. Interrupt vectors are re-mapped to Static
RAM.
0x2User Flash Mode. Interrupt vectors are not re-mapped and
reside in Flash.
31:2--Reserved-
8.6.2System PLL control register
This register connects and enables the system 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 to a higher frequency and then divided
down to provide the actual clock used by the CPU, peripherals, and memories. The PLL
can produce a clock up to the maximum allowed for the CPU.
Remark: The divider values for P and M must be selected so that the PLL output clock
Table 127. System PLL control register (SYSPLLCTRL, address 0x4004 8008) bit description
BitSymbolValueDescriptionReset
4:0MSELFeedback divider value. The division value M is the
6:5PSELPost divider ratio P. The division ratio is 2 P.0
31:7--Reserved. Do not write ones to reserved bits.-
8.6.3System PLL status register
This register is a Read-only register and supplies the PLL lock status (see
Section 8.7.3.1
Table 128. System PLL status register (SYSPLLSTAT, address 0x4004 800C) bit des cription
BitSymbolValueDescriptionReset
0LOCKPLL lock status0
31:1--Reserved-
UM11029
Chapter 8: LPC84x System configuration (SYSCON)
value
0
programmed MSEL value + 1.
00000: Division ratio M = 1
to
11111: Div i s i o n r a t i o M = 32
0x0P = 1
0x1P = 2
0x2P = 4
0x3P = 8
).
value
0PLL not locked
1PLL locked
8.6.4System oscillator control register
This register configures the frequency range for the system oscillator. The system
oscillator itself is powered on or off in the PDRUNCFG register. See Tab le 1 72
Table 129. System oscillator control register (SYSOSCCTRL, address 0x4004 8020) bit
description
BitSymbolValueDescriptionReset
0BYPASSBypass system oscillator0x0
0Disabled. Oscillator is not bypassed.
1Enabled. PLL input (sys_osc_clk) is fed directly
from the XTALIN pin bypassing the oscillator. Use
this mode when using an external clock source
instead of the crystal oscillator.
1FREQRANGEDetermines oscillator frequency range.0x0
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 can be divided to the required
output clock frequency wdt_osc_clk. The analog output frequency (Fclkana) can be
adjusted with the FREQSEL bits between 600 kHz and 4.6 MHz. With the digital part
Fclkana will be divided (divider ratios = 2, 4,...,64) to wdt_osc_clk using the DIVSEL bits.
The output clock frequency of the watchdog oscillator can be calculated as
wdt_osc_clk = Fclkana/(2 (1 + DIVSEL)) = 9.3 kHz to 2.3 MHz (nominal values).
Remark: Any setting of the FREQSEL bits will yield a Fclkana value within 40% of the
listed frequency value. The watchdog oscillator is the clock source with the lowest power
consumption. If accurate timing is required, use the FRO or system oscillator.
Remark: The frequency of the watchdog oscillator is undefined after reset. The watchdog
oscillator frequency must be programmed by writing to the WDTOSCCTRL register before
using the watchdog oscillator.
Table 130. Watchdog oscillator control register (WDTOSCCTRL, address 0x4004 8024) bit
BitSymbolValueDescriptionReset
4:0DIVSELSelect divider for Fclkana.
8:5FREQSELSelect watchdog oscillator analog output frequency
The FROOSCCTRL register can be used to select direct fro_oscout (30 MHz, 24 MHz,
18 MHz) or select divided fro_oscout (1.125 MHz, 1.5 MHz, 1.875 MHz, 9 MHz, 12 MHz,
or 15 MHz) based on FAIM low power boot value.
UM11029
Chapter 8: LPC84x System configuration (SYSCON)
The set_fro_frequency API call (Chapter 9 “
used to select desired output frequency from FRO. See Figure 9 “
LPC84x FRO API ROM routine”) must be
UM11029 clock
generation (continued)”.
Table 131. FRO oscillator control register (FROOSCCTRL, address 0x4004 8028) bit description
BitSymbolValueDescriptionReset
16:0-Reserved0
17FRO_DIRECTFRO direct clock select0
31:18--Reserved-
0
1FRO clock is direct from FRO oscillator
fro_oscout is divided by 2 (normal boot) or 16 (low power
boot), depending on FAIM low power boot value. See
Section 4.2.1 “
FAIM bit definitions”.
value
8.6.7FRO direct clock source update register
The FRODIRECTCLKUEN register updates the clock source of the FRO clock with the
new input clock after the FROOSCCTRL register bit 17 has been written to. In order for
the update to take effect, first write a zero to the FRODIRECTCLKUEN register and then
write a one to FRODIRECTCLKUEN.
Table 132. FRO direct clock source update enable register (FRODIRECTCLKUEN, address 0x4004 8030) 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. If another reset signal - for example the external RESET
after the POR signal is negated, then its bit is set to detected. Write a one to clear the
reset.
UM11029
Chapter 8: LPC84x System configuration (SYSCON)
pin - remains asserted
The reset value given in Table 133
Table 133. System reset status register (SYSRSTSTAT, address 0x4004 8038) bit description
BitSymbolValueDescriptionReset
0PORPOR reset status0
0No POR detected
1POR detected. Writing a one clears this reset.
1EXTRSTStatus of the external RESET
0No reset event detected.
1Reset detected. Writing a one clears this reset.
2WDTStatus of the Watchdog reset.0
0No WDT reset detected.
1WDT reset detected. Writing a one clears this reset.
3BODStatus of the Brown-out detect reset0
0No BOD reset detected
1BOD reset detected. Writing a one clears this reset.
4SYSRSTStatus of the software system reset0
0No System reset detected
1System reset detected. Writing a one clears this reset.
31:5--Reserved-
applies to the POR reset.
value
pin. External reset status.0
8.6.9System PLL clock source select register
This register selects the clock source for the system PLL. The SYSPLLCLKUEN register
(see Section 8.6.10
T able 134. System PLL clock source select register (SYSPLLCLKSEL, address 0x4004 8040)
) must be toggled from LOW to HIGH for the update to take effect.
value
0x0FRO
0x1External clock
0x2Watchdog oscillator
0x3FRO DIV
NXP Semiconductors
8.6.10System PLL clock source update 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.
The MAINCLKPLLSEL register selects the main system clock, which can be the system
PLL (sys_pllclkout), or the main clock pre pll. The main system clock clocks the core, the
peripherals, and the memories.
UM11029
Chapter 8: LPC84x System configuration (SYSCON)
0x4004 8044) bit description
0No change
1Update clock source
Bit 0 of the MAINCLKUEN register (see Section 8.6.14
) must be toggled from 0 to 1 for
the update to take effect.
Table 136. Main clock source select register (MAINCLKPLLSEL, address 0x4004 8048) bit
.The MAINCLKPLLUEN register updates the clock source of the main clock with the new
input clock after the MAINCLKPLLSEL register has been written to. In order for the update
to take effect, first write a zero to bit 0 of this register, then write a one.
The MAINCLKSEL register selects the main_clock_pre_pll, which can be the FRO,
external clock, watchdog oscillator, or FRO_DIV.
UM11029
Chapter 8: LPC84x System configuration (SYSCON)
Bit 0 of the MAINCLKUEN register (Section 8.6.14
) must be toggled from 0 to 1 for the
update to take effect.
Table 138. Main clock source select register (MAINCLKSEL, address 0x4004 8050) bit
description
BitSymbolValueDescriptionReset value
1:0SELClock source for main clock pre pll0
0x0FRO
0x1External clock
0x2Watchdog oscillator
0x3FRO_DIV = FRO / 2
31:2--Reserved-
8.6.14Main clock source update enable register
The MAINCLKUEN register updates the clock source of the main clock with the new input
clock after the MAINCLKSEL register has been written to. In order for the update to take
effect, first write a zero to bit 0 of this register, then write a one.
This register controls how the main clock is divided to provide the system clock to the
core, memories, and the perispherals. The system clock can be shut down completely by
setting the DIV field to zero.
Table 140. System clock divider register (SYSAHBCLKDIV, address 0x4004 80578) bit
description
BitSymbolDescriptionReset
value
7:0DIVSystem AHB clock divider values
0: System clock disabled.
1: Divide by 1.
…
255: Divide by 255.
The ADCCLKDIV register controls how the ADC clock is divided to provide the ADC clock
to the ADC controller. The ADC clock can be shut down completely by setting the DIV field
to zero.
The SCTCLKDIV register controls how the SCT clock is divided to provide the SCT clock
to the SCT module. The SCT clock can be shut down completely by setting the DIV field
to zero.
The SYSAHBCLKCTRL0 register enables the clocks to individual system and peripheral
blocks. The system clock (bit 0) provides the clock for the AHB, the APB bridge, the ARM
Cortex-M0+, the SYSCON block, and the PMU. This clock cannot be disabled.
Table 146. System clock control 0 register (SYSAHBCLKCTRL0, address 0x4004 8080) bit
description
BitSymbolValueDescriptionReset
value
0SYSEnables the clock for the AHB, the APB bridge, the
Cortex-M0+ core clocks, SYSCON, and the PMU.
This bit is read only and always reads as 1.
Table 146. System clock control 0 register (SYSAHBCLKCTRL0, address 0x4004 8080) bit
BitSymbolValueDescriptionReset
31UART4Enable clock for UART40
8.6.22System clock control 1 register
The SYSAHBCLKCTRL1 register enables the clocks to peripheral blocks.
Table 147. System clock control 1 register (SYSAHBCLKCTRL1, address 0x4004 8084) bit
BitSymbolValueDescriptionReset
0-Reserved0
1DAC1Enables clock for DAC1.0
31:2-Reserved-
description
description
UM11029
Chapter 8: LPC84x System configuration (SYSCON)
…continued
value
0Disable
1Enable
value
0Disable
1Enable
8.6.23Peripheral reset control 0 register
The PRESET0CTRL register allows software to reset specific peripherals. A zero in any
assigned bit in this register resets the specified peripheral. A 1 clears the reset and allows
the peripheral to operate.
Table 148. Peripheral reset control 0 register (PRESETCTRL0, address 0x4004 8088) bit description