Programming via SWD

Hey all!

I've just received my first board with a Nordic chip. More specifically it features the Ezurio BL54L15µ module.

I am currently "limited" to programming via SWD using a Rasperry Pico as debugprobe. Connecting via SWD works:

$ openocd -s ~/pico/openocd/tcl -f interface/cmsis-dap.cfg -f target/nordic/nrf54l.cfg

I can connect to telnet and run arbitrary commands, however when I try flashing a program it just fails:

$ openocd -s ~/pico/openocd/tcl -f interface/cmsis-dap.cfg -f target/nordic/nrf54l.cfg -c "program build/merged.hex verify reset exit"
Open On-Chip Debugger 0.12.0+dev (2025-07-17-20:39)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
cortex_m reset_config sysresetreq
Info : Using CMSIS-DAPv2 interface with VID:PID=0x2e8a:0x000c, serial=E660C0D1C79D7534
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: Atomic commands supported
Info : CMSIS-DAP: Test domain timer supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 0 SWDIO/TMS = 0 TDI = 0 TDO = 0 nTRST = 0 nRESET = 0
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
Info : SWD DPIDR 0x6ba02477
Info : [nrf54l.cpu] Cortex-M33 r1p0 processor detected
Info : [nrf54l.cpu] target has 8 breakpoints, 4 watchpoints
Info : [nrf54l.cpu] Examination succeed
Info : [nrf54l.aux] Examination succeed
Info : [nrf54l.cpu] starting gdb server on 3333
Info : Listening on port 3333 for gdb connections
Info : [nrf54l.aux] gdb port disabled
[nrf54l.cpu] halted due to debug-request, current mode: Thread
xPSR: 0xf9000000 pc: 0x00003fec msp: 0x20001f18
** Programming Started **
flash
  flash bank bank_id driver_name base_address size_bytes chip_width_bytes
            bus_width_bytes target [driver_options ...]
  flash banks
  flash init
  flash list
  gdb flash_program ('enable'|'disable')
nand
program <filename> [address] [preverify] [verify] [reset] [exit]
** Programming Failed **
shutdown command invoked
Traceback (most recent call last):
, in program
    flash write_image erase build/merged.hex

Does anyone have an idea what this error may suggest?

  • When running interactively the error gives a little more detail:

    Traceback (most recent call last):
      File "embedded:startup.tcl", line 1934, in program
        program_error {** Programming Failed **} 0
      File "embedded:startup.tcl", line 1869, in program_error
        error {** Programming Failed **}

  • Hi

    Unfortunately we don't work with OpenOCD, so this is somewhat out-of-scope for what we can assist with, we focus on using J-Link to do SWD programming. This should be possible though, could it be that the APP protection is enabled and that is what's causing these programming errors. I can't say I'm very experienced looking at OpenOCD error logs, so this is mostly guesswork from my side.

    Best regards,

    Simon

  • Seems like it's a problem with the OpenOCD executable itself. I figured that using pyOCD on the other hand works like a charm Slight smile

  • Hi there,

    So I'm using a Xiao nRF54L15 and OpenOcd here is a log after I build and flash, Maybe it helps ?

    [10/10] Generating ../merged.hex
    PS D:\Nordic\myapps\workspace\watchface> west flash -d build_xiao -r openocd
    -- west flash: rebuilding
    [0/5] Performing build step for 'watchface'
    ninja: no work to do.
    [4/5] cmd.exe /C "cd /D D:\Nordic\myapps\workspace\watchface\build_xiao\_sysbuild && C:\ncs\toolchains\c1a76fddb2\opt\bin\cmake.exe -E true"
    -- west flash: using runner openocd
    -- runners.openocd: Flashing file: D:/Nordic/myapps/workspace/watchface/build_xiao/merged.hex
    Open On-Chip Debugger 0.12.0 (2023-01-14-23:37)
    Licensed under GNU GPL v2
    For bug reports, read
    openocd.org/.../bugs.html
    nrf54l-load
    Info : Using CMSIS-DAPv2 interface with VID:PID=0x2886:0x0066, serial=E4E44CBA
    Info : CMSIS-DAP: SWD supported
    Info : CMSIS-DAP: FW Version = 2.0.0
    Info : CMSIS-DAP: Serial# = E4E44CBA
    Info : CMSIS-DAP: Interface Initialised (SWD)
    Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 0
    Info : CMSIS-DAP: Interface ready
    Info : clock speed 1000 kHz
    Info : SWD DPIDR 0x6ba02477
    Info : [nrf54l.cpu] Cortex-M33 r1p0 processor detected
    Info : [nrf54l.cpu] target has 8 breakpoints, 4 watchpoints
    Info : starting gdb server for nrf54l.cpu on 3333
    Info : Listening on port 3333 for gdb connections
    Info : gdb port disabled
    TargetName Type Endian TapName State
    -- ------------------ ---------- ------ ------------------ ------------
    0* nrf54l.cpu cortex_m little nrf54l.cpu running
    1 nrf54l.aux mem_ap little nrf54l.cpu running

    [nrf54l.cpu] halted due to debug-request, current mode: Thread
    xPSR: 0xf9000000 pc: 0x00003230 msp: 0x2000d318
    537732 bytes written at address 0x00000000
    downloaded 537732 bytes in 10.581510s (49.627 KiB/s)

    shutdown command invoked

    HTH

    GL :-) PJ :v:

Related