
How to Program SAMD Bootloaders
Created by Brent Rubell
Last updated on 2020-10-22 05:04:48 PM EDT

Overview
Do you have a bricked Adafruit SAMD board that won't boot into CircuitPython, or show up as a boot volume? Are you
building your own SAMD board and want to flash our UF2-SAMD bootloader onto it?
This guide will cover wiring a J-Link to a SAMD board, flashing the bootloader, and (optionally) installing the latest
CircuitPython build.
This process does require extra hardware and some software installation time. It is unfortunate when a
microcontroller's firmware is corrupted - it does not happen often. But, rather than buy a new board and have one
sitting, this process will get your original board back to 100%.
About the SAMD UF2 Bootloader
You will need to program the Adafruit UF2-SAMD Bootloader (https://adafru.it/Dj0) onto the affected board. Adafruit
SAMD21 (M0) and SAMD51 (M4) boards feature an improved bootloader that makes it easier than ever to flash different
code onto the microcontroller. This bootloader makes it easy to switch between Microsoft MakeCode, CircuitPython
and Arduino.
Instead of needing drivers or a separate program for flashing (say, bossac , jlink or avrdude ), one can simply
drag a
If you have a functioning bootloader on your board, you do not need to use the techniques described in this
Guide to update the bootloader. Instead, refer to the Guide for your board about how to update.
© Adafruit Industries https://learn.adafruit.com/how-to-program-samd-bootloaders Page 3 of 32

UF2 file onto a removable drive
.
Parts
To flash the bootloader, you'll need a JTAG/SWD debugger. We suggest the J-Link EDU Mini. This version is smaller
(the size of a USB drive) and less expensive than the full-sized J-Link EDU, BUT it is for non-commerical use only.
What does that mean?
Basically, if you're making money (or plan to make money) off your project, you'll need to order the full commercial
version, or find a different debugger that suits your needs and budget better. But if you're working on personal, non-
commercial projects, such as publishing some open source designs you're not selling yourself, you're good. You don't
need to be a student, and you can even be a paid engineer during the week, using this on the weekend for personal
non-commercial projects. As long are your intentions are non-commercial, the J-Link EDU is an excellent choice!
We also carry the full-sized J-Link EDU (https://adafru.it/e9G)and the J-Link base (https://adafru.it/e5q) (this model is for
commercial use).
If you're a commercial user (not educational/home hobby) - you must use the commercial J-Link Base
The process for using the J-LINK models is identical, only differing in the software you will install for the specific unit on
the next page.
You'll also want to get a JTAG to SWD converter board and SWD cable (not needed for the JLink mini), and a SWD
breadboard breakout
SEGGER J-Link EDU Mini - JTAG/SWD Debugger
$19.95
IN STOCK
Add To Cart
SEGGER J-Link BASE - JTAG/SWD Debugger
$399.95
IN STOCK
Add To Cart
© Adafruit Industries https://learn.adafruit.com/how-to-program-samd-bootloaders Page 4 of 32

JTAG (2x10 2.54mm) to SWD (2x5 1.27mm) Cable Adapter
Board
$4.95
IN STOCK
Add To Cart
10-pin 2x5 Socket-Socket 1.27mm IDC (SWD) Cable - 150mm
long
$2.95
IN STOCK
Add To Cart
SWD (2x5 1.27mm) Cable Breakout Board
$1.95
IN STOCK
Add To Cart
© Adafruit Industries https://learn.adafruit.com/how-to-program-samd-bootloaders Page 5 of 32

Setup
Installing J-Link
Navigate to the Seger downloads page (https://adafru.it/vaI) and install the version of the
J-Link Software and
Documentation Pack
for your operating system:
Grab a Bootloader
You'll also want to download a compiled bootloader binary (.bin file) for the board you're recovering. These can be
found on the Adafruit/uf2-samdx1 repository (https://adafru.it/D3C):
https://adafru.it/D3C
https://adafru.it/D3C
(Optional) Grab the Latest CircuitPython UF2
If you want to install CircuitPython onto the UF2 bootloader, you'll need a board-specific .uf2 file. Click here to find the
latest build:
https://adafru.it/tBa
https://adafru.it/tBa
Click the file corresponding to the CircuitPython board you're recovering. Check the two letter code for your
language: english, espagnol, french, filipino (tagalog) - we'll be using the english build but instructions are the same for
other languages.
© Adafruit Industries https://learn.adafruit.com/how-to-program-samd-bootloaders Page 6 of 32

When the UF2 finishes downloading, move the file to your Desktop.
We'll leave this file alone and come back to it when we're ready to load CircuitPython onto our board's boot drive.
© Adafruit Industries https://learn.adafruit.com/how-to-program-samd-bootloaders Page 7 of 32

Metro M0/M4
Wiring
The Adafruit Metro M0 and M4 have a socket for connecting to a SWD cable built-in - you can connect (and
disconnect) a SWD cable quickly.
Remove the small plastic cap cap from the SWD socket
on the Metro.
Then, connect the SWD cable from the J-Link to the
Metro.
© Adafruit Industries https://learn.adafruit.com/how-to-program-samd-bootloaders Page 8 of 32

Once the Metro is wired up, plug the J-Link into a USB
port on your computer and wait for the status indicator
LED to turn green.
Then, plug a USB cable into the Metro, this is required!
© Adafruit Industries https://learn.adafruit.com/how-to-program-samd-bootloaders Page 9 of 32

ItsyBitsy M0/M4
Wiring
The ItsyBitsy has pins SWDIO and SWCLK broken out on the back edge of the board. You'll need a SWD cable
breakout to connect the J-Link to an ItsyBitsy:
ItsyBitsy Wiring
Make the following connections between the ItsyBitsy M0/M4 and the SWD Cable Breakout:
ItsyBitsy GND to Breakout GND
ItsyBitsy 3V to Breakout VRef
ItsyBitsy SWCLK to Breakout CLK
ItsyBitsy SWDIO to Breakout SWIO
SWD (2x5 1.27mm) Cable Breakout Board
$1.95
IN STOCK
Add To Cart
You must also plug in a USB cable to the ItsyBitsy to power it during progamming
© Adafruit Industries https://learn.adafruit.com/how-to-program-samd-bootloaders Page 10 of 32

© Adafruit Industries https://learn.adafruit.com/how-to-program-samd-bootloaders Page 11 of 32