LPC2136FBD64: 32K Of RAM Against 256K Of Flash

Thirty-two kilobytes of SRAM against 256 kilobytes of flash is a ratio worth checking before any recovery plan is written. The LPC2136FBD64 sits in the middle of the LPC213x line: a 60 MHz ARM7TDMI-S core in LQFP64, two 8-channel 10-bit ADCs, a 10-bit DAC, 256 KB of program flash and 32 KB of static RAM. Opening a protective LPC2136FBD64 MCU is mostly a question of what that RAM can and cannot hold.

1. The Ratio Constrains In-Application Programming

IAP routines live in the boot ROM at 0x7FFFFFF0 and are called by the running application. They require the source data to be in SRAM, the destination to be 256-byte aligned, and a single write to move 256, 512, 1024 or 4096 bytes. With 32 KB of RAM, a field updater can stage a whole sector or even several sectors, but it cannot hold a full 256 KB image alongside a running application and its stack.

That shows up in recovered code as a loop that fills a buffer, issues a copy command, then refills. Recognising it distinguishes a firmware-update path from a data-logging routine, and it also tells you whether calibration values were written into a spare sector by the application itself.

2. Interrupts Must Be Quiet During An Erase

While the flash array is being erased or programmed it cannot be read, and the interrupt vectors normally live in flash at address zero. An interrupt arriving during that window reads a vector from a bus that is not delivering data. The usual firmware solutions are either to disable interrupts around the IAP call or to relocate the vector table into SRAM through the memory mapping control and place the handlers in RAM too.

When we disassemble an image from this part, finding a small RAM-resident handler block and a MEMMAP write is a strong indicator that the product supported field updates. It is also a reminder that a recovered binary alone may not be enough to reproduce that behaviour: the RAM copy is built at runtime.

3. Sector Geometry

Two hundred and fifty-six kilobytes is eight 4 KB sectors at the bottom, then seven 32 KB sectors, then the small sectors near the top. A single-sector erase takes roughly 400 ms on this family, the same as a full-chip erase, so there is no time advantage in trying to be surgical. Sector 0 holds the exception vectors, the checksum at 0x14 and the CRP word at 0x1FC, which makes it the worst possible place to experiment.

4. The Protection Word Is Not A Cipher

In search terms this is an open protective LPC2136FBD64 mcu job, and the RAM-to-flash ratio is the detail that matters.

A 32-bit value at 0x1FC selects CRP1 (0x12345678), CRP2 (0x87654321) or CRP3 (0x43218765). CRP1 disables JTAG and ISP read/compare and blocks writes to sector 0. CRP2 leaves only full-chip erase. CRP3 disables ISP entry through P0.14 when valid user code exists. Any other value means no protection. Early bootloaders had only the middle level; later /00 and /01 silicon added all three, so a version query over the serial port is the first command we send.

The phrase “encrypted” in a service request usually describes the customer’s situation, not the silicon. The array holds plain ARM and Thumb instruction words. What obstructs a read is boot ROM policy, and that is a very different problem from recovering a key.

5. Where Calibration Lands

Two 8-channel ADCs and a DAC usually mean the application keeps trim values somewhere non-volatile. There is no separate data EEPROM on this part, so those constants occupy a flash sector that the application treats as storage. A sector map will show it as programmed but non-executable, and the IAP calls that rewrite it will be visible in the disassembly. Separating that block from code is part of delivering something the customer can actually use, because a bare binary gives no indication of which words are constants and which are instructions.

6. Verification

The eight exception vectors must sum to zero, so 0x14 is recomputed in any rebuilt image. We mark blank sectors rather than padding them with invented content, keep the ECC check bytes alongside physically read data, and repeat the capture to catch marginal cells. A single corrected bit is invisible in the raw stream but changes an instruction.

Scope

The contact route handles intake of board photographs and markings. The memory-type comparison explains why this array is reprogrammable flash rather than OTP or mask ROM, and this 32-bit ARM case shows a similar workflow. Within the family, the LPC2134FBD64 halves the flash and the LPC2194HBD64 replaces the analog density with four CAN channels.