[RESOLVED] Arduino Zero - Error: unable to open CMSIS-DAP device

I just received the new genuine Arduino Zero bought from Arduino Store today, I am able to upload sketch using USB native port but failed at the USB programming port with Arduino IDE 2.0 beta 5 live debugging feature under Microsoft Windows [Version 10.0.19042.928].

When I pressed the debug button it shown error below:

Alternatively, based on this LINK, under command prompt also received the error below:

I edited C:\Users\RICKY GAI\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.10.0-arduino7\share\openocd\scripts\interface\cmsis-dap.cfg and noticed the cmsis_dap_serial xxx is remarked as shown below:

I have specified the serial number cmsis_dap_serial under "C:\Users\RICKY GAI\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.10.0-arduino7\share\openocd\scripts\interface\cmsis-dap.cfg" where the serial number is obtained from Microchip Studio -> Device Programming ->Tool Information and I only used the built-in Arduino Zero USB programming port, no USB native connection and no external power supply, is there anything missing here ?

I updated the "EDBG Virtual COM Port (COM3)" to "Atmel Corp. xxx" as shown below by uninstalling the device, and do a "scan for hardware changes", the result still the same, "Error: unable to open CMSIS-DAP device 0x3eb:0x2157".

The launch.json is like below:

{

  "version": "0.2.0",

  "configurations": [

    {

      "cwd": "${workspaceRoot}",

      "name": "Arduino",

      "request": "launch",

      "type": "cortex-debug",

      "executable": "C:\\Users\\RICKYG~1\\AppData\\Local\\Temp\\arduino-sketch-198A0C7A20112487DD9690866E9F0962/sketch_apr27a.ino.elf",

      "servertype": "openocd",

      "serverpath": "C:\\Users\\RICKY GAI\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\openocd\\0.10.0-arduino7/bin/openocd",

      "armToolchainPath": "C:\\Users\\RICKY GAI\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/",

      "configFiles": [

        "C:\\Users\\RICKY GAI\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.11/variants/arduino_zero/openocd_scripts/arduino_zero.cfg"

      ]

    }

  ]
}

The Arduino Zero board I received currently is like below:

...and I also updated to latest EDBG firmware using Microchip Studio 7:

Please advise.

I found the solution to resolve the error, it is due to old version of OPENOCD, after new OPENOCD is used, I can live debug the Arduino Zero using EDBG USB programming port under the Arduino IDE 2.0 beta 5 and Visual Studio Code successfully.

You may download the latest OPENOCD for Microsoft Windows 10 at HERE.

I am using command prompt to test OPENOCD manually.

Firstly, if you are using the existing OPENOCD that came with the installation of Arduino SAMD boards under its Arduino Zero directory, when running the OPENOCD you will encounter the error below:

C:\Users\RICKY GAI\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.10.0-arduino7\bin>openocd -c "gdb_port 50000" -s "F:\DEVELOP\NEXUZ\EE\Arduino\ZERO\SKETCH\blinkdemo\build" -f "c:\users\rickyg~1\appdata\local\arduin~1\packages\arduino\hardware\samd\184c54~1.11\variants\arduin~2\openoc~1\arduino_zero.cfg"
Open On-Chip Debugger 0.10.0+dev-gf0767a31 (2018-06-11-13:36)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
none separate
adapter speed: 400 kHz
cortex_m reset_config sysresetreq
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
**Error: unable to open CMSIS-DAP device 0x3eb:0x2157**

However, if you are using the latest version of OPENOCD which I have installed it under C:\OpenOCD-20210407-0.10.0 and added "C:\OpenOCD-20210407-0.10.0\bin" to the Windows environment path. You will notice the new OPENOCD with existing configure file and settings is establishing correctly as shown below:

C:\>openocd -c "gdb_port 50000" -s "F:\DEVELOP\NEXUZ\EE\Arduino\ZERO\SKETCH\blinkdemo\build" -f "c:\users\rickyg~1\appdata\local\arduin~1\packages\arduino\hardware\samd\184c54~1.11\variants\arduin~2\openoc~1\arduino_zero.cfg"
Open On-Chip Debugger 0.10.0 (2021-04-07) [https://github.com/sysprogs/openocd]
Licensed under GNU GPL v2
libusb1 09e75e98b4d9ea7909e8837b7a3f00dda4589dc3
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: FW Version = 03.25.01B6
Info : CMSIS-DAP: Serial# = R2NXS55DLUK68SOC6VRC
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 400 kHz
Info : SWD DPIDR 0x0bc11477
Info : at91samd21g18.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : starting gdb server for at91samd21g18.cpu on 50000
Info : Listening on port 50000 for gdb connections
_

Next, update the file PLATFORM.TXT under C:\Users\RICKY GAI\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.11 and remark the red highlighted rectangle and add in the green highlighted text as picture shown below, the green highlighted text is the latest OPENOCD path:

The update above will cause Arduino IDE 2.0 beta 5 and Visual Studio Code to use the latest OPENOCD for EDBG debugging later.

Now, you are ready to live debug the Arduino Zero.

Hopes, this help.

1 Like

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