Repository navigation
Programming & Debugging
A factory new SAMD21 IC ships without any firmware. For programming, it requires a compatible SWD programmer. The adafruit bootloader is used. A binary of a custom breezedude version is included in this repo (only changed the USB PIDs & descriptor and names of the bootloader flash drive)
Connect SDWIO, SWDCLK, GND and apply battery voltage for flashing. The blue LED should start fading after flashing.
After flashing the bootloader once, the firmware and bootloader can be updated by drag&drop UF2 updates.
Bootloader flashing using a 3$ DAPLink as programmer

1.27mm Pinheader as kind of pressfit the SWD socket

For just flashing the bootloader binary an open-ocd compatible CMSIS-DAP is the easiest choice. Install open-ocd according to its documentation (+add to PATH) and run
openocd -f interface/cmsis-dap.cfg -f target/at91samdXX.cfg -c "program bootloader-breezedude-v3.16.0-19-atmel.bin verify reset exit 0x00000000"
within the bootloader directory.
output should look like this:
openocd -f interface/cmsis-dap.cfg -f target/at91samdXX.cfg -c "program bootloader-breezedude-v3.16.0-19-atmel.bin verify reset exit 0x00000000"
Open On-Chip Debugger 0.12.0 (2025-07-10) [https://github.com/sysprogs/openocd]
Licensed under GNU GPL v2
libusb1 d52e355daa09f17ce64819122cb067b8a2ee0d4b
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Warn : DEPRECATED: auto-selecting transport "swd". Use 'transport select swd' to suppress this message.
Info : Using CMSIS-DAPv2 interface with VID:PID=0x0d28:0x0204, serial=00000080003400454e00000e4e574c50a5a5a5a597969908
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: SWO-UART supported
Info : CMSIS-DAP: Atomic commands supported
Info : CMSIS-DAP: Test domain timer supported
Info : CMSIS-DAP: FW Version = 2.1.0
Info : CMSIS-DAP: Serial# = 00000080003400454e00000e4e574c50a5a5a5a597969908
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 400 kHz
Info : SWD DPIDR 0x0bc11477
Info : [at91samd.cpu] Cortex-M0+ r0p1 processor detected
Info : [at91samd.cpu] target has 4 breakpoints, 2 watchpoints
Info : [at91samd.cpu] Examination succeed
Info : [at91samd.cpu] starting gdb server on 3333
Info : Listening on port 3333 for gdb connections
[at91samd.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x21000000 pc: 0x00000268 msp: 0x20002de0
** Programming Started **
Info : SAMD MCU: SAMD21G18A (256KB Flash, 32KB RAM)
** Programming Finished **
** Verify Started **
** Verified OK **
** Resetting Target **
shutdown command invoked
For Debugging CMSIS-DAP is currently not supported out of the box for SAMD21. ToDo: Custom script for using open-ocd
The following should work (see PIO docs)