AnsweredAssumed Answered

LPC-Link2 with CMSIS-DAP & OpenOCD as Device Flasher

Question asked by Robert Rau on May 27, 2020
Latest reply on Jun 4, 2020 by Felipe García

We have completed development of a product based on the MKL27Z256VFM4 and setup a small programming station with a LPC-Link2 with CMSIS-DAP & OpenOCD. Setting up the LPC-Link2 with CMSIS-DAP went flawlessly. We are using the command line:

openocd -d2 -f interface/cmsis-dap.cfg -f target/klx.cfg -c "init" -c"reset halt" -c "flash write_image erase BabyFrogVFM4cmpA.bin 0"

but only having partial success:

Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
debug_level: 2
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
Info : add flash_bank kinetis klx.flash
adapter speed: 1000 kHz
none separate
cortex_m reset_config sysresetreq
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: JTAG Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 1.10
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x0bc11477
Error: MDM: failed to read ID register
Info : SWD DPIDR 0x0bc11477
Info : klx.cpu: hardware has 2 breakpoints, 2 watchpoints
Info : MDM: Chip is unsecured. Continuing.
target halted due to debug-request, current mode: Thread
xPSR: 0x61000000 pc: 0x1c0000c0 msp: 0x20000688
auto erase enabled
Info : Probing flash info for bank 0
Warn : This device supports Program Longword execution only.
Warn : This device supports Program Longword execution only.
Warn : Flash Configuration Field written.
Warn : Reset or power off the device to make settings effective.
Warn : This device supports Program Longword execution only.
Error: corrupted fifo read pointer 0xffffffff
Error: timed out while waiting for target halted
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x21000003 pc: 0x0000adbc msp: 0x20005fd8
Error: error waiting for target flash write algorithm
Error: Error executing kinetis Flash programming algorithm
Error: error writing to flash at address 0x00000000 at offset 0x00000000

I am new to OpenOCD and CMSIS-DAP. We developed with a Segger J-Link. Is my command line correct?

Digging around in a computer where OpenOCD was used a few years and noticed the target config file was kl2x.cfg where the OpenOCD mainline only has klx.cfg. Does NXP have more correct target files for OpenOCD?


Any help would be greatly appreciated.


Thank you for your time.