--- **[tickets:#426] Wrong flash size for NXP LPC11E68** **Status:** new **Milestone:** 0.10.0 **Created:** Wed Mar 06, 2024 03:54 PM UTC by Andreas Müller **Last Updated:** Wed Mar 06, 2024 03:54 PM UTC **Owner:** nobody Flash size for NXP LPC11E68 seems to be configured to 128 kB, correct size is 256 kB (see [datasheet](https://www.nxp.com/docs/en/data-sheet/LPC11E6X.pdf#G1012525706) chapter 4.1). Using [this Windows build](https://github.com/openocd-org/openocd/releases/tag/v0.12.0) I get the following output when trying to flash a firmware file of ~156 kB: ~~~ c:\tools\openocd-0.12.0\bin\openocd.exe -d2 -f interface/stlink.cfg -c "transport select hla_swd; set CPUTAPID 0x0bc11477" -f target/lpc11xx.cfg -c "adapter speed 1000; program firmware.bin verify reset; exit" Open On-Chip Debugger 0.12.0 (2023-01-14-23:37) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html debug_level: 2 0x0bc11477 Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD Info : clock speed 1000 kHz Info : STLINK V2J40S7 (API v2) VID:PID 0483:3748 Info : Target voltage: 3.295101 Info : [lpc11xx.cpu] Cortex-M0+ r0p1 processor detected Info : [lpc11xx.cpu] target has 4 breakpoints, 2 watchpoints Info : starting gdb server for lpc11xx.cpu on 3333 Info : Listening on port 3333 for gdb connections [lpc11xx.cpu] halted due to breakpoint, current mode: Thread xPSR: 0x81000000 pc: 0x10000004 msp: 0x100000b4 [lpc11xx.cpu] halted due to debug-request, current mode: Thread xPSR: 0xf1000000 pc: 0x1fff00a0 msp: 0x10000ffc ** Programming Started ** Warn : no flash bank found for address 0x00020000 ** Programming Finished ** ** Verify Started ** Error: checksum mismatch - attempting binary compare embedded:startup.tcl:1516: Error: ** Verify Failed ** in procedure 'program' in procedure 'program_error' called at file "embedded:startup.tcl", line 1577 at file "embedded:startup.tcl", line 1516 ~~~ I've investigated this issue and found that [this line](https://sourceforge.net/p/openocd/code/ci/v0.12.0/tree/src/flash/nor/lpc2000.c#l1408) seems to be the problem, maybe a copy&paste error. I applied the following change: ~~~ --- a/src/flash/nor/lpc2000.c +++ b/src/flash/nor/lpc2000.c @@ -1405,7 +1405,6 @@ static int lpc2000_auto_probe_flash(struct flash_bank *bank) case LPC11U37H_401: case LPC11U37_501: case LPC11E67: - case LPC11E68: case LPC11U67_1: case LPC11U67_2: lpc2000_info->variant = LPC1100; @@ -1420,6 +1419,7 @@ static int lpc2000_auto_probe_flash(struct flash_bank *bank) bank->size = 128 * 1024; break; + case LPC11E68: case LPC11U68_1: case LPC11U68_2: lpc2000_info->variant = LPC1100; ~~~ After building I could successfully program the chip: ~~~ c:\tools\openocd-0.12.0-patch\bin\openocd.exe -d2 -f interface/stlink.cfg -c "transport select hla_swd; set CPUTAPID 0x0bc11477" -f target/lpc11xx .cfg -c "adapter speed 1000; program firmware.bin verify reset; exit" Open On-Chip Debugger 0.12.0-01004-g9ea7f3d64 (2024-03-05-16:41) Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html debug_level: 2 0x0bc11477 Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD Info : clock speed 1000 kHz Info : STLINK V2J40S7 (API v2) VID:PID 0483:3748 Info : Target voltage: 3.301372 Info : [lpc11xx.cpu] Cortex-M0+ r0p1 processor detected Info : [lpc11xx.cpu] target has 4 breakpoints, 2 watchpoints Info : starting gdb server for lpc11xx.cpu on 3333 Info : Listening on port 3333 for gdb connections [lpc11xx.cpu] halted due to debug-request, current mode: Thread xPSR: 0xf1000000 pc: 0x1fff00a0 msp: 0x10000ffc ** Programming Started ** ** Programming Finished ** ** Verify Started ** ** Verified OK ** ** Resetting Target ** ~~~ Hopefully this is the right way to fix it - I don't fully understand how the internals of openOCD. However it *seems* right to me as the LPC11E68 is basically just an LPC11U68 without USB. --- Sent from sourceforge.net because openocd-devel@lists.sourceforge.net is subscribed to https://sourceforge.net/p/openocd/tickets/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/openocd/admin/tickets/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.