Five hundred, not five hundred and twelve. The LPC2138FBD64 is sold as a 512 KB flash device, and 12 KB of that array is reserved for the boot block, leaving 500 KB for user code and data. It is the largest member of the LPC213x line: 32 KB of SRAM, two 8-channel 10-bit ADCs, a 10-bit DAC, 60 MHz ARM7TDMI-S, all in an LQFP64. Anyone setting out to extract encrypted LPC2138FBD64 memory needs to know where that ceiling falls before choosing a read length.
Where The Twelve Kilobytes Go
| Region | Sectors | Size | Notes |
|---|---|---|---|
| Low vectors | 0 to 7 | 4 KB each | vectors, 0x14 checksum, 0x1FC CRP word |
| Main array | 8 to 21 | 32 KB each | bulk of application code |
| High small sectors | 22 to 26 | 4 KB each | data, calibration, boot parameters |
| Boot block | not a sector | 12 KB | ISP, IAP, RealMonitor at 0x7D000 |
ISP and IAP commands are forbidden from writing, erasing or branching into the boot block. It is ROM-like from the application’s point of view, and it is not part of any user image. A tool that reads a flat 512 KB from address zero will cross into it; a tool that stops at 0x7D000 has captured the correct 500 KB.
Twenty-seven numbered sectors make up the user array. That count matters when an ISP command names a start and end sector: sending a number beyond the device’s real last sector fails the operation, and on a protected part the only erase available may be the full-chip one.
That 12 KB figure is a useful family fingerprint. The later LPC23xx and LPC24xx parts reserve only 8 KB at 0x7E000, which is why their 512 KB devices offer 504 KB of user code rather than 500 KB. An image rebuilt with the wrong ceiling will place the last few sectors in a region that belongs to the boot ROM, and a checksum that was computed over the wrong length will not match the original build.
ECC Is Part Of The Data
This line uses flash with Hamming single-bit error correction. In normal execution the correction is transparent. In a physical readout the check bytes sit beside the user words, and a capture that drops them can produce a file that passes a visual inspection and fails a checksum later. We retain them, read the array twice from different angles, and record explicitly how a disagreement was resolved.
The 128-bit-wide flash interface and accelerator let the core run at 60 MHz directly from the array, so there is no shadow copy in SRAM to fall back on. Thumb code reduces program size by more than thirty percent, which is why 500 KB of user space can hold a surprisingly large application.
Protection, And The Checksum That Gates It
One 32-bit word at 0x1FC controls access. 0x12345678 selects CRP1: JTAG off, ISP read and compare off, sector 0 writes blocked, sector erase still allowed. 0x87654321 selects CRP2: only full-chip erase remains. 0x43218765 selects CRP3: ISP entry via P0.14 disabled when valid user code is present. Early bootloader revisions implemented only the middle level; a version query over the serial interface comes first.
Valid user code is decided by the vector checksum. The reserved word at 0x14 must be the two’s complement of the sum of the other seven vectors so that all eight add to zero. Failing that test sends the part into ISP. Since CRP3’s strongest rule is conditional on valid code, a corrupted sector 0 changes the protection state as well as the program. Reading the first 32 bytes, when possible, is more informative than any assumption about the CRP value.
What Comes Back
A binary and Intel HEX covering 0x00000000 to the end of the used area, a sector map distinguishing programmed sectors from erased ones, the CRP word and bootloader revision actually found, and a note on how ECC bytes were handled. The checksum at 0x14 is recomputed so the image is bootable on a reference board. We state when a region had to be reconstructed rather than presenting a clean file with no caveats.
Related Reading
Our service scope describes intake and accepted device states. The NVRAM article covers retention as a separate concern, and this AT32F435 case is a useful contrast with a much larger, banked array. Within this family, the LPC2132FBD64 shows the small end of the sector map; the LPC2368FBD100 is the 72 MHz successor whose 512 KB part yields 504 KB instead of 500.