# How to Program SAMD Bootloaders

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/069/849/medium800/micropython___circuitpython_metro_flash.png?1548362569)

Info: 

_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&nbsp;[the Adafruit UF2-SAMD Bootloader](https://github.com/adafruit/uf2-samdx1) 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,&nbsp;`bossac`,&nbsp;`jlink`&nbsp;or&nbsp;`avrdude`), one can simply&nbsp; **_drag a 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!

### SEGGER J-Link EDU Mini - JTAG/SWD Debugger

[SEGGER J-Link EDU Mini - JTAG/SWD Debugger](https://www.adafruit.com/product/3571)
Doing some serious development on any ARM-based platform, and tired of 'printf' plus an LED to debug? A proper JTAG/SWD HW debugger can make debugging more of a pleasure and less of a pain. It allows you to program your devices at the click of a button, read or write memory addresses...

In Stock
[Buy Now](https://www.adafruit.com/product/3571)
[Related Guides to the Product](https://learn.adafruit.com/products/3571/guides)
![Segger debugger in plastic housing.](https://cdn-shop.adafruit.com/640x480/3571-04.jpg)

We also carry the [full-sized J-Link EDU&nbsp;](https://www.adafruit.com/product/1369)and the [J-Link base](https://www.adafruit.com/product/2209) (this model is for commercial use).

If you're a commercial user (not educational/home hobby) - you must use the commercial J-Link Base

### SEGGER J-Link BASE - JTAG/SWD Debugger

[SEGGER J-Link BASE - JTAG/SWD Debugger](https://www.adafruit.com/product/2209)
The SEGGER J-Link BASE is identical to the cheaper&nbsp;[J-Link EDU](https://www.adafruit.com/products/1369)&nbsp;model except for the **terms of use**.

If you're going to use your debugger strictly for personal, non-commercial projects, such as publishing...

In Stock
[Buy Now](https://www.adafruit.com/product/2209)
[Related Guides to the Product](https://learn.adafruit.com/products/2209/guides)
![SEGGER J-Link JTAG/SWD Debugger brick and JTAG cable](https://cdn-shop.adafruit.com/640x480/2209-00.jpg)

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

### JTAG (2x10 2.54mm) to SWD (2x5 1.27mm) Cable Adapter Board

[JTAG (2x10 2.54mm) to SWD (2x5 1.27mm) Cable Adapter Board](https://www.adafruit.com/product/2094)
This adapter board is designed for adapting a 'classic' 2x10 (0.1"/2.54mm pitch) JTAG cable to a slimmer 2x5 (0.05"/1.27mm pitch) SWD Cable. &nbsp;It's helpful for using products like the [JTAGulator](https://www.adafruit.com/products/1550) or <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/2094)
[Related Guides to the Product](https://learn.adafruit.com/products/2094/guides)
![JTAG to SWD cable adapter board.](https://cdn-shop.adafruit.com/640x480/2094-04.jpg)

### 10-pin 2x5 Socket-Socket 1.27mm IDC (SWD) Cable - 150mm long

[10-pin 2x5 Socket-Socket 1.27mm IDC (SWD) Cable - 150mm long](https://www.adafruit.com/product/1675)
These little cables are handy when programming or debugging a tiny board that uses 10-pin 1.27mm (0.05") pitch SWD programming connectors. We see these connectors often on ARM Cortex dev kits, and have a few handy in our ARM-dev box. We thought you may want a backup cable as well, so now...

In Stock
[Buy Now](https://www.adafruit.com/product/1675)
[Related Guides to the Product](https://learn.adafruit.com/products/1675/guides)
![10-pin 2x5 Socket-Socket 1.27mm IDC Cable](https://cdn-shop.adafruit.com/640x480/1675-00.jpg)

### SWD (2x5 1.27mm) Cable Breakout Board

[SWD (2x5 1.27mm) Cable Breakout Board](https://www.adafruit.com/product/2743)
This adapter board is designed to make it easier to use ARM dev boards that use slimmer 2x5 (0.05"/1.27mm pitch) SWD cables for programming. &nbsp;It's helpful for using products like the [JTAGulator](https://www.adafruit.com/products/1550), <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/2743)
[Related Guides to the Product](https://learn.adafruit.com/products/2743/guides)
![Angled shot of SWD (2x5 1.27mm) Cable Breakout Board](https://cdn-shop.adafruit.com/640x480/2743-05.jpg)

# How to Program SAMD Bootloaders

## Setup

## Installing J-Link

Navigate to the [Segger downloads page](https://www.segger.com/downloads/jlink#J-LinkSoftwareAndDocumentationPack) and install the version of the _J-Link Software and Documentation Pack&nbsp;_for your operating system:

![](https://cdn-learn.adafruit.com/assets/assets/000/069/609/medium800/micropython___circuitpython_segger_downloads_page.png?1547837275)

## 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://github.com/adafruit/uf2-samdx1/releases):

[Adafruit SAMD Bootloader Releases](https://github.com/adafruit/uf2-samdx1/releases)
## (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 for your hardware:

[Latest CircuitPython Releases](https://circuitpython.org/downloads)
When the UF2 finishes downloading, **move the file to your Desktop**.&nbsp;

We'll leave this file alone and come back to it when we're ready to load CircuitPython onto our board's boot drive.

# How to Program SAMD Bootloaders

## 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.&nbsp;

Remove the small plastic cap cap from the SWD socket on the Metro.

![micropython___circuitpython_metro_m0_swd.png](https://cdn-learn.adafruit.com/assets/assets/000/069/647/medium640/micropython___circuitpython_metro_m0_swd.png?1547845107)

Then, connect the SWD cable from the J-Link to the Metro.

![micropython___circuitpython_metro_m0_swd_plug.jpg](https://cdn-learn.adafruit.com/assets/assets/000/069/648/medium640/micropython___circuitpython_metro_m0_swd_plug.jpg?1547845151)

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.

&nbsp;

Then, **plug a USB cable into the Metro** , this is required!

![micropython___circuitpython_metro_flash.png](https://cdn-learn.adafruit.com/assets/assets/000/069/767/medium640/micropython___circuitpython_metro_flash.png?1548194287)

# How to Program SAMD Bootloaders

## 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:

### SWD (2x5 1.27mm) Cable Breakout Board

[SWD (2x5 1.27mm) Cable Breakout Board](https://www.adafruit.com/product/2743)
This adapter board is designed to make it easier to use ARM dev boards that use slimmer 2x5 (0.05"/1.27mm pitch) SWD cables for programming. &nbsp;It's helpful for using products like the [JTAGulator](https://www.adafruit.com/products/1550), <a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/2743)
[Related Guides to the Product](https://learn.adafruit.com/products/2743/guides)
![Angled shot of SWD (2x5 1.27mm) Cable Breakout Board](https://cdn-shop.adafruit.com/640x480/2743-05.jpg)

## ItsyBitsy Wiring
![](https://cdn-learn.adafruit.com/assets/assets/000/069/853/medium800/micropython___circuitpython_itsy_fritzing_bb.png?1548363588)

Make the following connections between the ItsyBitsy M0/M4 and the SWD Cable Breakout:

- **ItsyBitsy GND&nbsp;** to **Breakout GND**
- **ItsyBitsy 3V** to **Breakout VRef**
- **ItsyBitsy SWCLK&nbsp;** to&nbsp; **Breakout CLK**
- **ItsyBitsy SWDIO** to **Breakout SWIO**

Warning: 

# How to Program SAMD Bootloaders

## Feather M0/M4 Wiring

The debugging interface on the Feathers are a little bit harder to get to than the ItsyBitsy and the Metro. They're on the bottom of the board - labeled&nbsp; **SWDIO&nbsp;** and **SWCLK**. We'll need to solder a wire to each of them.

![](https://cdn-learn.adafruit.com/assets/assets/000/069/657/medium800/micropython___circuitpython_arduino_compatibles_swd.jpg?1547849993)

 **Cut and strip two wires**. **Solder one of them to the SWDIO pad** and **the other to the SWCLK pad** , making sure that the two wires do not touch.&nbsp;

&nbsp;

After soldering, add a small piece of tape to secure the connection between the wire and the pad.

![micropython___circuitpython_IMG_1600.jpg](https://cdn-learn.adafruit.com/assets/assets/000/069/834/medium640/micropython___circuitpython_IMG_1600.jpg?1548348972)

Make the following connections between the Feather and a SWD Breakout:

- **Feather SWDIO** &nbsp;to&nbsp; **Breakout SWIO**
- **Feather SWCLK** &nbsp;to&nbsp; **Breakout CLK**
- **Feather 3V** &nbsp;to&nbsp; **Breakout VRef**
- **Feather GND** &nbsp;to&nbsp; **Breakout GND**

![feather_boards_IMG_2227.jpg](https://cdn-learn.adafruit.com/assets/assets/000/069/940/medium640/feather_boards_IMG_2227.jpg?1548431750)

Warning: 

# How to Program SAMD Bootloaders

## Trinket M0 Wiring

There are two programming pads located at the bottom of the Trinket M0:

![](https://cdn-learn.adafruit.com/assets/assets/000/069/770/medium800/micropython___circuitpython_trinket_swd_pads.png?1548195487)

Cut and strip two wires.

&nbsp;

Solder one of them to the SWDIO pad and the other to the SWCLK pad, making sure that the two wires do not touch.&nbsp;

&nbsp;

After soldering, add a small piece of tape to secure the connection between the wire and the pad.

![micropython___circuitpython_trinket.png](https://cdn-learn.adafruit.com/assets/assets/000/069/807/medium640/micropython___circuitpython_trinket.png?1548271711)

Then, make the following connections between the Trinket and the SWD breakout:

- **Trinket SWDIO&nbsp;** to **&nbsp;Breakout SWIO**
- **Trinket SWCLK&nbsp;** to **&nbsp;Breakout CLK**
- **Trinket 3Vo&nbsp;** to **&nbsp;Breakout VRef**
- **Trinket GND&nbsp;** to **&nbsp;Breakout GND**

&nbsp;

![micropython___circuitpython_trinket_breadboard.png](https://cdn-learn.adafruit.com/assets/assets/000/069/855/medium640/micropython___circuitpython_trinket_breadboard.png?1548363969)

Warning: 

# How to Program SAMD Bootloaders

## Gemma M0 Wiring

On the bottom of the Gemma, there are three small pads used for programming:

![](https://cdn-learn.adafruit.com/assets/assets/000/069/744/medium800/micropython___circuitpython_gemma_swd.png?1548180910)

Cut and strip two wires.

&nbsp;

Solder one of them to the **SWDIO** pad and the other to the **SWCLK** pad, making sure that the two wires do not touch.&nbsp;

&nbsp;

After soldering, add a small piece of tape to secure the connection between the wire and the pad.

![micropython___circuitpython_IMG_9160.jpg](https://cdn-learn.adafruit.com/assets/assets/000/069/745/medium640/micropython___circuitpython_IMG_9160.jpg?1548183059)

Then, make the following connections between the Gemma and the SWD breakout:

&nbsp;

- **Gemma SWDIO&nbsp;** to **&nbsp;Breakout SWIO**
- **Gemma SWCLK&nbsp;** to **&nbsp;Breakout CLK**
- **Gemma 3Vo&nbsp;** to **&nbsp;Breakout VRef**
- **Gemma GND&nbsp;** to **&nbsp;Breakout GND**

&nbsp;

You can use&nbsp;[breadboard-friendly&nbsp;Alligator clips](https://www.adafruit.com/product/3255)&nbsp;to attach the Gemma M0's **3Vo** and **GND** pins to the breakout.

![micropython___circuitpython_gemma_wiring.jpeg](https://cdn-learn.adafruit.com/assets/assets/000/069/765/medium640/micropython___circuitpython_gemma_wiring.jpeg?1548193832)

Warning: 

# How to Program SAMD Bootloaders

## Circuit Playground Express M0 Wiring

![](https://cdn-learn.adafruit.com/assets/assets/000/069/751/medium800/micropython___circuitpython_cpx.png?1548187704)

To program the Circuit Playground Express,&nbsp; **you'll need to solder directly to the SWCLK and SWDIO pads on the back of the board**.

&nbsp;

After soldering, use a piece of tape or a dab of hot glue to hold the wires in place so they don't rip off of the pads.

![micropython___circuitpython_IMG_4018.jpg](https://cdn-learn.adafruit.com/assets/assets/000/069/769/medium640/micropython___circuitpython_IMG_4018.jpg?1548194736)

Then, make the following connections between the Circuit Playground Express M0 and the SWD breakout:

&nbsp;

- **Circuit Playground Express SWDIO** to **Breakout SWIO**
- **Circuit Playground Express SWCLK** to **Breakout CLK**
- **Circuit Playground Express VOut&nbsp;** to **Breakout VRef**
- **Circuit Playground Express GND** to **Breakout GND**

![micropython___circuitpython_cpx_setup.jpg](https://cdn-learn.adafruit.com/assets/assets/000/069/771/medium640/micropython___circuitpython_cpx_setup.jpg?1548195797)

You can use&nbsp;[breadboard-friendly&nbsp;Alligator clips](https://www.adafruit.com/product/3255)&nbsp;to attach the Circuit Playground Express **VOut** and **GND** pins to the breakout.

Warning: 

# How to Program SAMD Bootloaders

## Programming the Bootloader with Atmel Studio

![](https://cdn-learn.adafruit.com/assets/assets/000/069/821/medium800/micropython___circuitpython_circuitpython_arduino_Studio7__HomePage_980x352.jpg?1548343675)

You'll need to **install Atmel Studio 7**. This software is **free** and **only works on a Windows host computer**.&nbsp;

- If you're running macOS or Linux, you can run Windows in a virtual machine (Parallels, VirtualBox) and install Atmel Studio on the Windows virtual machine.

The download ( **we recommend the online installer** ) is available from Microchip's website.

[Download Microchip Studio 7](https://www.microchip.com/en-us/development-tools-tools-and-software/microchip-studio-for-avr-and-sam-devices#Downloads)
# Setting up JLink for Atmel Studio
JLinks ship with the firmware they are programmed with from the factory. We'll want to update ours to the latest version.

From the Windows search bar, search for the&nbsp; **Jlink Configurator&nbsp;** application and launch it.

The JLink Configurator tool will show all connected devices. Tick the box next to the JLink you want to update.

Then, click&nbsp; **Update Firmware of Selected Emulators**.

&nbsp;

If a new firmware is available, the JLink will launch a pop-up window, updating the firmware.

![feather_boards_jlinkfirmwareupdate.png](https://cdn-learn.adafruit.com/assets/assets/000/069/968/medium640/feather_boards_jlinkfirmwareupdate.png?1548440167)

![feather_boards_JLinkCfgFWUpdateDialog.png](https://cdn-learn.adafruit.com/assets/assets/000/069/969/medium640/feather_boards_JLinkCfgFWUpdateDialog.png?1548440198)

Next, launch the SEGGER JLink DLL Updater from the start menu.

If there is an update available for Atmel Studio 7, **tick the checkbox** and click&nbsp; **OK&nbsp;** to update Atmel Studio 7's the latest JLink software.

![feather_boards_dll_updator.png](https://cdn-learn.adafruit.com/assets/assets/000/069/977/medium640/feather_boards_dll_updator.png?1548440895)

# Verify Connection in Atmel Studio

Next, open Atmel Studio. From the toolbar, **select&nbsp;Tools -\> Device Programming.**

![](https://cdn-learn.adafruit.com/assets/assets/000/069/823/medium800/micropython___circuitpython_ice_dev_prog_menu.png?1548344184)

The device programming window will open. Before we proceed, make sure your J-Link and board are both plugged into your computer.&nbsp;

&nbsp;

Then,&nbsp; **select Tool-\>J-Link.**

&nbsp;

- If you're using a J-Link EDU, the terms of use will pop up after selecting the J-Link interface. **Click ACCEPT**.

![micropython___circuitpython_ice_tool_swd.png](https://cdn-learn.adafruit.com/assets/assets/000/069/824/medium640/micropython___circuitpython_ice_tool_swd.png?1548344391)

![micropython___circuitpython_ice4.png](https://cdn-learn.adafruit.com/assets/assets/000/069/825/medium640/micropython___circuitpython_ice4.png?1548344413)

# Flashing a SAMD21 M0 Board with Atmel Studio
Next, we're going to **select the&nbsp;Device&nbsp;** (the type of chip you're programming):

- For the Feather M0, Metro M0, Trinket M0, and Circuit Playground Express, **select&nbsp;ATSAMD21G18A**
- For the Gemma M0 and Trinket M0, **select&nbsp;ATSAMD21E18A**

**Click Apply.**

![micropython___circuitpython_ice_tool_board.png](https://cdn-learn.adafruit.com/assets/assets/000/069/826/medium640/micropython___circuitpython_ice_tool_board.png?1548344495)

Make sure your board is plugged into USB, then click&nbsp; **Read** in the top nav br. The empty fields for&nbsp;_Device Signature&nbsp;_and&nbsp;_Target Voltage_ will populate.

**Make sure these values appear before proceeding!**

- If the board is not detected, or your wiring is not detected, Atmel Studio will throw an error that it could not connect to the board. Check your wiring (especially the **SWDIO** / **SWCLK** wires), that your USB cables are connected to the computer, and try to connect again.&nbsp;

Warning: 

![](https://cdn-learn.adafruit.com/assets/assets/000/069/822/medium800thumb/micropython___circuitpython_ice_device_sig.jpg?1548344167)

## Un-set Bootloader Protection Fuse

The SAMD21 has a `BOOTPROT` fuse protecting the flash area of the bootloader. You'll want to clear the `BOOTPROT` fuse before flashing the bootloader.

Go to the **Fuses** page

![](https://cdn-learn.adafruit.com/assets/assets/000/096/253/medium800/feather_boards_image.png?1603399901)

Click **Read** in the bottom right section to read the fuses. Look for the **BOOTPROT** fuse

For SAMD21, you will need to set it to `0x07` or **Zero Bytes**

![](https://cdn-learn.adafruit.com/assets/assets/000/096/254/medium800/feather_boards_image.png?1603400026)

 **Click Program,&nbsp;** wait for a confirmation that the fuses have been set. Then, **click**  **Verify**.

## Program Binary File

On the sidebar, **click&nbsp;Memories.**

**Select the bootloader** for the CircuitPython board you're recovering (the **.bin** file you downloaded earlier).

**Select&nbsp;_Erase Flash before programming_ and _Verify flash after programming_** _._

Then, **click** &nbsp; **Program**.

![](https://cdn-learn.adafruit.com/assets/assets/000/069/827/medium800/micropython___circuitpython_Win10_FPGA_Dev_.png?1548347172)

After clicking&nbsp; **Program** , the serial will output:

`Erasing Device...OK`

`Programming Flash...OK`

`Verifying Flash...OK`

![micropython___circuitpython_ok.png](https://cdn-learn.adafruit.com/assets/assets/000/069/830/medium640/micropython___circuitpython_ok.png?1548347514)

After flashing, you'll need to set the `BOOTPROT` fuse _back_ to a 8kB bootloader size.

From **Fuses** , **set `BOOTPROT` to 0x2** or 8KB and **click Program**

![](https://cdn-learn.adafruit.com/assets/assets/000/096/255/medium800/feather_boards_image.png?1603400132)

## Check Success!

Open Windows Explorer - there should be a new volume mounted on your machine indicating that the board has been programed with the UF2 bootloader:

![](https://cdn-learn.adafruit.com/assets/assets/000/069/792/medium800/micropython___circuitpython_ice_5.png?1548262470)

If you want to use the SAMD21 board with Arduino or Microsoft MakeCode, you can stop here.&nbsp;

If you want to use it with CircuitPython, let's continue to installing a CircuitPython build.

## Flashing a SAMD51 M4 Board with Atmel Studio

Boards like the Metro M4 and the Grand Central use a different, more powerful chip than the SAMD21, the SAMD51 - the flashing process is a little bit different for these boards.

In the Device Programming window, select the device based off which M4 CircuitPython Board you have.

- Feather M4 and Metro M4, **select&nbsp;ATSAMD51J19A**
- ItsyBitsy M4, select **ATSAMD51G19A**
- For the Grand Central M4, **select ATSAMD51P20**

**Click Apply.**

![feather_boards_m4_board_select.png](https://cdn-learn.adafruit.com/assets/assets/000/069/979/medium640/feather_boards_m4_board_select.png?1548441087)

Make sure your board is plugged into USB, then click&nbsp; **Read**. The empty fields for&nbsp;_Device Signature&nbsp;_and&nbsp;_Target Voltage_&nbsp;will populate.

**Make sure these values appear before proceeding!**

- If the board is not detected, or your wiring is not detected, Atmel Studio will throw an error that it could not connect to the board. Check your wiring (especially the&nbsp; **SWDIO** / **SWCLK** &nbsp;wires), that your USB cables are connected to the computer, and try to connect again.&nbsp;

Warning: 

![](https://cdn-learn.adafruit.com/assets/assets/000/070/003/medium800thumb/feather_boards_samd51.jpg?1548441869)

The SAMD51 has a&nbsp;`BOOTPROT`&nbsp;fuse protecting the flash area of the bootloader. You'll want to clear the&nbsp;`BOOTPROT`&nbsp;fuse before flashing the bootloader.

- From the Device Programming window, select&nbsp; **Fuses**.
- Then, **change the value of** `USER_WORD_0.NVMCTRL_BOOTPROT`&nbsp; **to** `0x0F` or **0 kbytes**
- **Click Program**
- Then, click&nbsp; **VERIFY&nbsp;** to verify that the fuse has been set correctly.

![feather_boards_samd51_fuse.png](https://cdn-learn.adafruit.com/assets/assets/000/069/993/medium640/feather_boards_samd51_fuse.png?1548441559)

![feather_boards_Untitled.png](https://cdn-learn.adafruit.com/assets/assets/000/096/256/medium640/feather_boards_Untitled.png?1603400279)

On the sidebar, **click&nbsp;Memories.**

**Select the bootloader** for the CircuitPython board you're recovering (the **.bin** file you downloaded earlier).

**Select&nbsp;_Erase Flash before programming_ and _Verify flash after programming_** _._

Then, **click** &nbsp; **Program**.

On the sidebar,&nbsp; **click&nbsp;Memories.**

**Select the bootloader** &nbsp;for the CircuitPython board you're recovering (the&nbsp; **.bin** &nbsp;file you downloaded earlier).

**Select&nbsp;_Erase Flash before programming_**

**Click&nbsp;Program.**

**Then, click Verify&nbsp;&nbsp;**

![feather_boards_program_samd51.png](https://cdn-learn.adafruit.com/assets/assets/000/069/994/medium640/feather_boards_program_samd51.png?1548441608)

![feather_boards_verify_samd51.png](https://cdn-learn.adafruit.com/assets/assets/000/069/996/medium640/feather_boards_verify_samd51.png?1548441639)

After clicking&nbsp; **Program** , the serial will output:

`Erasing Device...OK`

`Programming Flash...OK`

`Verifying Flash...OK`

![feather_boards_micropython___circuitpython_ok.png](https://cdn-learn.adafruit.com/assets/assets/000/069/997/medium640/feather_boards_micropython___circuitpython_ok.png?1548441659)

Open Windows Explorer - there should be a new volume mounted on your machine indicating that the board has been programed with the UF2 bootloader:

![](https://cdn-learn.adafruit.com/assets/assets/000/070/002/medium800/feather_boards_micropython___circuitpython_ice_5.png?1548441684)

If you want to use the SAMD51 board with Arduino or Microsoft MakeCode, you can stop here.&nbsp;

If you want to use it with CircuitPython, let's continue to installing a CircuitPython build.

# How to Program SAMD Bootloaders

## Installing CircuitPython

A perk of the SAMD UF2 bootloader is the ability to load other firmware (like CircuitPython) onto the board without re-programming the bootloader.

**Double tap the Reset button** ,&nbsp;a new volume should appear on your computer - **boardNameBOOT** &nbsp;(the name of this volume differs between boards).

**Drag and drop the CircuitPython board and language-specific UF2 file** we downloaded earlier **from the desktop** to the&nbsp; **boardNameBOOT** &nbsp;volume.&nbsp;

![](https://cdn-learn.adafruit.com/assets/assets/000/069/820/medium800/micropython___circuitpython_Desktop_and_METROBOOT.png?1548343416)

The volume should briefly disappear, and reappear as **CIRCUITPY**.

Congrats, your board is un-bricked and running CircuitPython again!


## Featured Products

### Adafruit METRO M0 Express - designed for CircuitPython

[Adafruit METRO M0 Express - designed for CircuitPython](https://www.adafruit.com/product/3505)
Metro is our series of microcontroller boards for use with the Arduino IDE. This new **Metro M0 Express** board looks a whole lot like our&nbsp;[original Metro 328](https://www.adafruit.com/product/2488), but with a huge upgrade. Instead of the ATmega328, this Metro...

In Stock
[Buy Now](https://www.adafruit.com/product/3505)
[Related Guides to the Product](https://learn.adafruit.com/products/3505/guides)
### Adafruit ItsyBitsy M0 Express - for CircuitPython & Arduino IDE

[Adafruit ItsyBitsy M0 Express - for CircuitPython & Arduino IDE](https://www.adafruit.com/product/3727)
What's smaller than a Feather but larger than a Trinket? It's an **Adafruit ItsyBitsy M0 Express**! Small, powerful, with a rockin' ATSAMD21 Cortex M0 processor running at 48 MHz - this microcontroller board is perfect when you want something very compact, but still...

In Stock
[Buy Now](https://www.adafruit.com/product/3727)
[Related Guides to the Product](https://learn.adafruit.com/products/3727/guides)
### Adafruit Feather M0 Express

[Adafruit Feather M0 Express](https://www.adafruit.com/product/3403)
At the Feather M0's heart is an ATSAMD21G18 ARM Cortex M0+ processor, clocked at 48 MHz and at 3.3V logic, the same one used in the new&nbsp;[Arduino Zero](https://www.adafruit.com/products/2843). This chip has a whopping 256K of FLASH (8x more than the Atmega328 or 32u4) and...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3403)
[Related Guides to the Product](https://learn.adafruit.com/products/3403/guides)
### Adafruit Trinket M0 - for use with CircuitPython & Arduino IDE

[Adafruit Trinket M0 - for use with CircuitPython & Arduino IDE](https://www.adafruit.com/product/3500)
The&nbsp;Adafruit Trinket M0 may be small, but do not be fooled by its size! It's a tiny microcontroller board, built around the Atmel ATSAMD21, a little chip with _a lot_ of power. We wanted to design a microcontroller board that was small enough to fit into any project, and low...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3500)
[Related Guides to the Product](https://learn.adafruit.com/products/3500/guides)
### Adafruit GEMMA M0 - Miniature wearable electronic platform

[Adafruit GEMMA M0 - Miniature wearable electronic platform](https://www.adafruit.com/product/3501)
The **Adafruit Gemma M0** is a super small microcontroller board, with just enough built-in to create many simple projects. It may look small and cute: round, about the size of a quarter, with friendly alligator-clip sew pads. But do not be fooled! The Gemma M0 is incredibly...

In Stock
[Buy Now](https://www.adafruit.com/product/3501)
[Related Guides to the Product](https://learn.adafruit.com/products/3501/guides)
### Circuit Playground Express

[Circuit Playground Express](https://www.adafruit.com/product/3333)
 **Circuit Playground Express** is the next step towards a perfect introduction to electronics and programming. We've taken the original Circuit Playground Classic and made it even better! Not only did we pack even more sensors in, we also made it even easier to...

In Stock
[Buy Now](https://www.adafruit.com/product/3333)
[Related Guides to the Product](https://learn.adafruit.com/products/3333/guides)
### SEGGER J-Link EDU - JTAG/SWD Debugger

[SEGGER J-Link EDU - JTAG/SWD Debugger](https://www.adafruit.com/product/1369)
[Discontinued - **you can grab&nbsp;** SEGGER J-Link EDU Mini - JTAG/SWD Debugger **instead!**](https://www.adafruit.com/product/3571)

The SEGGER J-Link EDU is identical to the more expensive [J-Link BASE](https://www.adafruit.com/products/2209) model except...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/1369)
[Related Guides to the Product](https://learn.adafruit.com/products/1369/guides)
### SEGGER J-Link EDU Mini - JTAG/SWD Debugger

[SEGGER J-Link EDU Mini - JTAG/SWD Debugger](https://www.adafruit.com/product/3571)
Doing some serious development on any ARM-based platform, and tired of 'printf' plus an LED to debug? A proper JTAG/SWD HW debugger can make debugging more of a pleasure and less of a pain. It allows you to program your devices at the click of a button, read or write memory addresses...

In Stock
[Buy Now](https://www.adafruit.com/product/3571)
[Related Guides to the Product](https://learn.adafruit.com/products/3571/guides)

## Related Guides

- [Adafruit Feather M0 Express](https://learn.adafruit.com/adafruit-feather-m0-express-designed-for-circuit-python-circuitpython.md)
- [Adafruit Metro M0 Express](https://learn.adafruit.com/adafruit-metro-m0-express.md)
- [Adafruit Trinket M0](https://learn.adafruit.com/adafruit-trinket-m0-circuitpython-arduino.md)
- [Adafruit Circuit Playground Express](https://learn.adafruit.com/adafruit-circuit-playground-express.md)
- [Introducing ItsyBitsy M0 Express](https://learn.adafruit.com/introducing-itsy-bitsy-m0.md)
- [Animatronic Hand](https://learn.adafruit.com/animatronic-hands.md)
- [Flashing LED Strand with MakeCode](https://learn.adafruit.com/flashing-led-strand-with-makecode.md)
- [Using WebUSB with Arduino and TinyUSB](https://learn.adafruit.com/using-webusb-with-arduino-and-tinyusb.md)
- [Glowing Fascinator Hat with Gemma M0 and MakeCode](https://learn.adafruit.com/glowing-fascinator-hat-gemma-m0-makecode.md)
- [Cartoon Network and Make Code - Rose Quartz Shield Umbrella](https://learn.adafruit.com/cartoon-network-and-make-code-rose-quartz-shield-umbrella.md)
- [Circuit Playground Express Perk-up Ears](https://learn.adafruit.com/perk-up-ears.md)
- [CircuitPython 101: Basic Builtin Data Structures](https://learn.adafruit.com/basic-datastructures-in-circuitpython.md)
- [Programming an M0 using an Arduino](https://learn.adafruit.com/programming-an-m0-using-an-arduino.md)
- [Circuit Playground Express: Piano in the Key of Lime](https://learn.adafruit.com/circuit-playground-express-piano-in-the-key-of-lime.md)
- [Using MPL3115A2 with CircuitPython](https://learn.adafruit.com/using-mpl3115a2-with-circuitpython.md)
- [Welcome to CircuitPython!](https://learn.adafruit.com/welcome-to-circuitpython.md)
- [Digital Fidget Spinner](https://learn.adafruit.com/digital-fidget-spinner.md)
- [Slider Crank Mechanism -- from Cardboard and Craft Sticks](https://learn.adafruit.com/cardboard-slider-crank.md)
- [NeoPixel Basketball Hoop](https://learn.adafruit.com/neopixel-mini-basketball-hoop.md)
- [The MonkMakes Plant Monitor and CircuitPython](https://learn.adafruit.com/monkmakes-plant-monitor-and-circuitpython.md)
