Sparkfun Redboard Turbo debugging with atmel-ice on windows 10

Hello,
How can I set up Sparkfun Redboard Turbo with platform IO for debugging with atmel ice on Windows 10?

I got it to upload using PlatformIO on the usb port.

Now I canged the Platformio.ini to:

[env:sparkfun_redboard_turbo]
platform = atmelsam
board = sparkfun_redboard_turbo
framework = arduino
debug_tool = atmel-ice
upload_protocol = atmel-ice
upload_port = usb

I get this error message when I try to upload.

Checking size .pio\build\sparkfun_redboard_turbo\firmware.elf
Advanced Memory Usage is available via “PlatformIO Home > Project Inspect”
RAM: [= ] 6.2% (used 2024 bytes from 32768 bytes)
Flash: [ ] 3.9% (used 10204 bytes from 262144 bytes)
Configuring upload protocol…
AVAILABLE: atmel-ice, blackmagic, jlink, sam-ba
CURRENT: upload_protocol = atmel-ice
Uploading .pio\build\sparkfun_redboard_turbo\firmware.bin
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev-00378-ge5be992df (2020-06-26-09:29)
Licensed under GNU GPL v2
For bug reports, read

debug_level: 1

at91samd21g18
Error: unable to open CMSIS-DAP device 0x3eb:0x2141
Error: No Valid JTAG Interface Configured.
*** [upload] Error -1

I get these messages when I try to debug.

done.
PlatformIO Unified Debugger ->
PlatformIO: debug_tool = atmel-ice
PlatformIO: Initializing remote target…
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev-00378-ge5be992df (2020-06-26-09:29)
Licensed under GNU GPL v2
For bug reports, read

at91samd21g18
Info : auto-selecting first available session transport “swd”. To override use 'transport select '.
Info : tcl server disabled
Info : telnet server disabled
Error: unable to open CMSIS-DAP device 0x3eb:0x2141

.pioinit:13: Error in sourced command file:
Remote communication error. Target disconnected.: Success.

Please help.

Thanks,

Mark

OpenOCD needs that the Atmel-ICE is loaded with libusb drivers in order to be able to access it. Similiar as per Setting up Atmel-ICE with PlatformIO using ATmega328p – Cyan Sensors and How to setup Atmel-ICE to program an ATmega328 on PlatformIO with VSCode on Windows 10 - #13 by jcsb1994.

I updated the drivers so both ports are now using libusb as drivers.

Same error message as before though;

Configuring upload protocol…
AVAILABLE: atmel-ice, blackmagic, jlink, sam-ba
CURRENT: upload_protocol = atmel-ice
Uploading .pio\build\sparkfun_redboard_turbo\firmware.bin
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev-00378-ge5be992df (2020-06-26-09:29)
Licensed under GNU GPL v2
For bug reports, read
OpenOCD: Bug Reporting
debug_level: 1

at91samd21g18
Error: unable to find CMSIS-DAP device
Error: No Valid JTAG Interface Configured.
*** [upload] Error -1

I noticed the other posts were about ATmega328P boards and this is a SAMD21g18 if that makes a difference.

Thanks for the help

BTW when I install Avrdude it finds the device like on the other posts…

Weird. Adafruit Grand Central debugging with atmel-ice - #15 by spin is using the same chip and those instructions work. He explicitly says

I got the openocd running with Zadig WinUSB driver with arm-none-eabi-gdb and an Atmel sam ice with the Grand Central Express M4.

There also seem to be other USB devices which you may need to reconfigure (or only one of them is correct)

EDBG Data Gateway (Interface 3) driver: winUSB v43.0.0.0
EDBG CMSIS-DAP (interface 0) HidUSB (v10.0.18362.175)
EDBG VIrtual COM Port (interface 1) usbser (v1.1.1.0)

This seems like a pure driver issue here, so all I can recommend is double checking every device driver, replugging the device and trying a standalone openocd command as posted in the linked topic (You should have openocd in C:\Users\<user>\.platformio\packages\tool-openocd which you can use from the commandline)

It appears that in that thread the person switched to J-Link part way thru. I have one of those on the way.

I have not found a thread where anyone successfully has an Atmel ICE working. I dont mind trying to get this working for the Atmel ICE with your help.

Thanks

This is the text when I run openocd.exe from comman prompt;

C:\Users\Owner.platformio\packages\tool-openocd\bin>openocd
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev-00378-ge5be992df (2020-06-26-09:29)
Licensed under GNU GPL v2
For bug reports, read
OpenOCD: Bug Reporting
embedded:startup.tcl:26: Error: Can’t find openocd.cfg
in procedure ‘script’
at file “embedded:startup.tcl”, line 26
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: Debug Adapter has to be specified, see “adapter driver” command
embedded:startup.tcl:26: Error:
in procedure ‘script’
at file “embedded:startup.tcl”, line 26

Yes but the Atmel-ICE definitely worked, since he got to the OpenOCD output

Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: JTAG Supported
Info : CMSIS-DAP: FW Version = 03.25.01B6
Info : CMSIS-DAP: Serial# = FFFFFFFFFFFFFFFFFFFF
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

which is where want to get to. With some other drivers, possibly.

Partly right, please go one folder above that with cd .. and then execute

bin\openocd.exe -s scripts -f interface\cmsis-dap.cfg -c "transport select swd" -c "set CHIPNAME at91samd21g18" -f target\at91samdXX.cfg

as in the previous topic.

If nothing changed, it should still throw the same “couldn’t find device” error.

Yes, same result;

C:\Users\Owner.platformio\packages\tool-openocd>bin\openocd.exe -s scripts -f interface\cmsis-dap.cfg -c “transport select swd” -c “set CHIPNAME at91samd21g18” -f target\at91samdXX.cfg
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev-00378-ge5be992df (2020-06-26-09:29)
Licensed under GNU GPL v2
For bug reports, read
OpenOCD: Bug Reporting
swd
at91samd21g18
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: unable to find CMSIS-DAP device

I also tried setting the devices;
Atmel-ICE CMSIS-DAP (Interface 0) to libusb0 1.2.6.0
Atmel-ICE Data Gateway (Interface 1) to libusb0 1.2.6.0

Checked same result as above

Atmel-ICE CMSIS-DAP (Interface 0) to WinUSB v6.1.7600.16385
Atmel-ICE Data Gateway (Interface 1) to libusb0 1.2.6.0

Checked same result as above

This may be an issue that Atmel Studio 7.0 is installed on this machine.

Edit:
I tried it on another computer and it worked the first time. It must be a driver issue, on this machine. I replaced the drivers with the zadig tool and it did not help. I have a J-Link coming, I will try that to see if it works on this machine.

1 Like

Solved the problem.

I had to change the driver that windows 10 had used for the CMSIS-DAP device.

I followed these instructions and now it works!;

The CMSIS-DAP node should be bound to input.info (i.e Human Interface Device), not to libusb0… To rebind, update the driver, select from list and select USB Input Device (might be under Microsoft). CMSIS DAP, being HID based uses the OS driver on most operating systems.

1 Like