Skip to content

OpenOCD Fails to Connect to RP2040 via CMSIS-DAP Debug Probe #137

@bartola-valves

Description

@bartola-valves

🔧 Setup Summary

  • Target: Raspberry Pi Pico (brand-new unit, tested multiple)
  • Probe: Raspberry Pi Debug Probe (CMSIS-DAP firmware v2.0.0)
  • Host OS: Windows 10/11 (tried on multiple machines)
  • OpenOCD Version: 0.12.0+dev-gebec950-dirty (bundled via Pico SDK in Visual Studio Code)
  • Invocation Command:

openocd -s C:\Users\amogl.pico-sdk\openocd\0.12.0+dev\scripts -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 1000; init; shutdown"

The output error of executing the "Flash Project (SWD)" command of the Rasberry Pi Pico extension in Visual Studio Code is:

Image
 *  Executing task: C:\Users\amogl/.pico-sdk/openocd/0.12.0+dev/openocd.exe -s C:\Users\amogl/.pico-sdk/openocd/0.12.0+dev/scripts -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c adapter speed 5000; program "c:/Users/amogl/OneDrive/Stash Win/Pico/code/Eurorack/NyX/NyX/build/NyX.elf" verify reset exit 

Open On-Chip Debugger 0.12.0+dev-gebec950-dirty (2024-09-27-16:29)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : Hardware thread awareness created
Info : Hardware thread awareness created
Info : Using CMSIS-DAPv2 interface with VID:PID=0x2e8a:0x000c, serial=E6647C740388492F
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 5000 kHz
Warn : Too long SWD WAIT, issuing DAPABORT
Warn : Too long SWD WAIT, issuing DAPABORT
Warn : Too long SWD WAIT, issuing DAPABORT
Error: Failed to connect multidrop rp2040.dap0
in procedure 'program'
** OpenOCD init failed **
shutdown command invoked


 *  The terminal process "C:\Users\amogl\.pico-sdk\openocd\0.12.0+dev\openocd.exe '-s', 'C:\Users\amogl/.pico-sdk/openocd/0.12.0+dev/scripts', '-f', 'interface/cmsis-dap.cfg', '-f', 'target/rp2040.cfg', '-c', 'adapter speed 5000; program "c:/Users/amogl/OneDrive/Stash Win/Pico/code/Eurorack/NyX/NyX/build/NyX.elf" verify reset exit'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

I’ve changed every single hardware variable:

  • New Pico boards (factory fresh)
  • Fresh Debug Probe (new out of box)
  • New JST-SH cables - what comes on the Debug Probe.
  • Different Windows machines Yet the error remains identical across all setups.

✅ Debugging and Sanity Checks

  • Bootsel mode confirmed on target (to avoid firmware interference)
  • Target successfully runs blink.uf2 (GPIO confirmed functional)
  • Debug Probe firmware is up-to-date (v2.0.0)
  • OpenOCD launched manually from CLI with correct script path
  • Lowered adapter speed to 100 kHz
  • Confirmed matching ground plane and USB power sourcing
  • Pico’s RUN pin toggled for reset-to-SWD access

🤔 Hypotheses

  • SWD multidrop support introduced in OpenOCD 0.12.0 may interfere with single-target RP2040
  • CMSIS-DAP handshake timing mismatch or USB HID driver conflict
  • Debug Probe firmware may be incompatible with latest OpenOCD version
  • Potential change in VSC Cortex-Debug extension or Pico SDK integration

🙏 Request

Would love insight from maintainers and community on:

  • Known issues with rp2040.dap0 connection failures
  • Ways to disable SWD multidrop and force single-target handshake
  • Recommended OpenOCD version or commit for Debug Probe compatibility
  • Any debugging flags that can provide deeper trace of DAP protocol traffic

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions