UM11029
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2017. All rights reserved.
User manual
Rev. 1.0 — 16 June 2017
22 of 515
NXP Semiconductors
UM11029
Chapter 5: LPC84x ISP and IAP
5.3.3 Flash content protection mechanism
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.
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.4 Criteria 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.5 Flash 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.
Table 13.
LPC82x flash configuration
<tbd>
Sector
number
Sector
size [KB]
Page number Address range
16 KB
flash
32 KB
flash
0
1
0 -15
0x0000 0000 - 0x0000 03FF
yes
yes
1
1
16 - 31
0x0000 0400 - 0x0000 07FF
yes
yes
2
1
32 - 47
0x0000 0800 - 0x0000 0BFF
yes
yes
3
1
48 - 63
0x0000 0C00 - 0x0000 0FFF
yes
yes
4
1
64 - 79
0x0000 1000 - 0x0000 13FF
yes
yes
5
1
80 - 95
0x0000 1400 - 0x0000 17FF
yes
yes