CMSIS-DAP command CMD_DAP_SWJ_CLOCK failed

Using Arduino IDE v 2.0.3 on an MS-Windows 11 machine. Successful build of a sketch onto a Raspberry Pi Pico W. I have another Raspberry Pi Pico H flashed as a 'Picoprobe CMSIS-DAPv2'. When I activate 'Start Debugging' from the icon on the top of the IDE , I receive the following error inside the gdb-server window:

[2022-12-29T17:13:51.491Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
e[92m"c:/openocd-0.11/bin/openocd" -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "i:\\pico\\adafruit\\Adafruit_SPIFlash-master\\examples\\flash_info" -f "C:/Users/<User>/AppData/Local/Programs/Arduino IDE/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl" -f "C:\\Users\\<User>\\AppData\\Local\\Arduino15\\packages\\rp2040\\hardware\\rp2040\\2.6.5/lib/picoprobe.tcl"
e[0mOpen On-Chip Debugger 0.11.0 (2021-11-18) [https://github.com/sysprogs/openocd]
Licensed under GNU GPL v2
libusb1 09e75e98b4d9ea7909e8837b7a3f00dda4589dc3
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
CDRTOSConfigure
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
Info : Hardware thread awareness created
Info : Hardware thread awareness created
Info : Listening on port 50001 for tcl connections
Info : Listening on port 50002 for telnet connections
Info : Using CMSIS-DAPv2 interface with VID:PID=0x2e8a:0x000c, serial=E6614C311B33A327
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
Error: CMSIS-DAP command CMD_DAP_SWJ_CLOCK failed.

[2022-12-29T17:13:51.615Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed

For info:

  1. The Arduino IDE DEBUG configuration file has the following contents:
{
  "version": "0.2.0",
  "configurations": [
    {
      "cwd": "${workspaceRoot}",
      "name": "Arduino",
      "request": "launch",
      "type": "cortex-debug",
      "executable": "C:\\Users\\<User>\\AppData\\Local\\Temp\\arduino-sketch-48A5CFEF72E11ED432901CE2648051FB/flash_info.ino.elf",
      "servertype": "openocd",
      "serverpath": "c:/openocd-0.11/bin/openocd",
      "armToolchainPath": "C:\\Users\\<User>\\AppData\\Local\\Arduino15\\packages\\rp2040\\tools\\pqt-gcc\\1.4.0-c-0196c06/bin/",
      "configFiles": [
        "C:\\Users\\<User>\\AppData\\Local\\Arduino15\\packages\\rp2040\\hardware\\rp2040\\2.6.5/lib/picoprobe.tcl"
      ]
    }
  ]
}

In the listing above, the Windows Username in 'C:\\Users\\User\\'
I changed (for this post) into '<User>'.

  1. when I run openocd & gdb from within an Ubuntu Linux session, then openocd reported: 'CMSIS-DAP: Interface ready' (see image below).
    openocd_and_gdb_in_Ubuntu

  2. During the Ubuntu Linux session the SWD signals were present.

Error solved:

After changing the command

source [find interface/cmsis-dap.cfg]

in file

C:\Users\<User>\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\2.6.5\lib\picoprobe.tcl

into the full-path filename:

source [find C:\Users\<User>\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\tools\pqt-openocd\1.4.0-c-0196c06\share\openocd\scripts\interface\cmsis-dap.cfg]

I discovered that the (intended) file: cmsis-dap.cfg had been opened and read, because I had provoked an error in cmsis-dap.cfg. After repairing that error, openocd reported:

[2022-12-29T23:42:33.971Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
"c:/openocd-0.11/bin/openocd" -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "i:\\pico\\adafruit\\Adafruit_SPIFlash-master\\examples\\flash_info" -f "C:/Users/<User>/AppData/Local/Programs/Arduino IDE/resources/app/plugins/cortex-debug/extension/support/openocd-helpers.tcl" -f "C:\\Users\\<User>\\AppData\\Local\\Arduino15\\packages\\rp2040\\hardware\\rp2040\\2.6.5/lib/picoprobe.tcl"
Open On-Chip Debugger 0.11.0 (2021-11-18) [https://github.com/sysprogs/openocd]
Licensed under GNU GPL v2
libusb1 09e75e98b4d9ea7909e8837b7a3f00dda4589dc3
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
CDRTOSConfigure
Info : Hardware thread awareness created
Info : Hardware thread awareness created
Info : Listening on port 50001 for tcl connections
Info : Listening on port 50002 for telnet connections
Error: could not open device 0x2e8a:0x000c: Operation not supported or unimplemented on this platform
Info : Using CMSIS-DAPv2 interface with VID:PID=0x2e8a:0x000c, serial=E6614C311B33A327
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
Error: Error connecting DP: cannot read IDR

So far, so good. Left me with another error (for which I opened a new forum topic: CMSIS-DAP cannot read IDR), however the reason for this post is solved.

Conclusion:
The command:
source [find interface/cmsis-dap.cfg]
in the file

C:\Users\<User>\AppData\Local\Arduino15\packages\rp2040\hardware\rp2040\2.6.5/lib/picoprobe.tcl

obviously did not lead the IDE to find the intended file:

C:\Users<User>\AppData\Local\Arduino15\packages\rp2040\tools\pqt-openocd\1.4.0-c-0196c06\share\openocd\scripts\interface\cmsis-dap.cfg
and in the same moment not issued an error:

file not found

So, it appeared to me that the IDE used another cmsis-dap.cfg file (default?).

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.