You'll need to install Atmel Studio 7. This software is free and only works on a Windows host computer.
- 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.
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 Jlink Configurator 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 Update Firmware of Selected Emulators.
If a new firmware is available, the JLink will launch a pop-up window, updating the firmware.
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 OK to update Atmel Studio 7's the latest JLink software.
Verify Connection in Atmel Studio
Next, open Atmel Studio. From the toolbar, select Tools -> Device Programming.
The device programming window will open. Before we proceed, make sure your J-Link and board are both plugged into your computer.
Then, select Tool->J-Link.
- If you're using a J-Link EDU, the terms of use will pop up after selecting the J-Link interface. Click ACCEPT.
Next, we're going to select the Device (the type of chip you're programming):
- For the Feather M0, Metro M0, Trinket M0, and Circuit Playground Express, select ATSAMD21G18A
- For the Gemma M0 and Trinket M0, select ATSAMD21E18A
Click Apply.
Make sure your board is plugged into USB, then click Read in the top nav br. The empty fields for Device Signature and 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.
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
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
Click Program, wait for a confirmation that the fuses have been set. Then, click Verify.
Program Binary File
On the sidebar, click Memories.
Select the bootloader for the CircuitPython board you're recovering (the .bin file you downloaded earlier).
Select Erase Flash before programming and Verify flash after programming.
Then, click Program.
After clicking Program, the serial will output:
Erasing Device...OK
Programming Flash...OK
Verifying Flash...OK
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
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:
If you want to use the SAMD21 board with Arduino or Microsoft MakeCode, you can stop here.
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 ATSAMD51J19A
- ItsyBitsy M4, select ATSAMD51G19A
- For the Grand Central M4, select ATSAMD51P20
Click Apply.
Make sure your board is plugged into USB, then click Read. The empty fields for Device Signature and 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.
The SAMD51 has a BOOTPROT
fuse protecting the flash area of the bootloader. You'll want to clear the BOOTPROT
fuse before flashing the bootloader.
- From the Device Programming window, select Fuses.
- Then, change the value of
USER_WORD_0.NVMCTRL_BOOTPROT
to0x0F
or 0 kbytes - Click Program
- Then, click VERIFY to verify that the fuse has been set correctly.
On the sidebar, click Memories.
Select the bootloader for the CircuitPython board you're recovering (the .bin file you downloaded earlier).
Select Erase Flash before programming and Verify flash after programming.
Then, click Program.
On the sidebar, click Memories.
Select the bootloader for the CircuitPython board you're recovering (the .bin file you downloaded earlier).
Select Erase Flash before programming
Click Program.
Then, click Verify
After clicking Program, the serial will output:
Erasing Device...OK
Programming Flash...OK
Verifying Flash...OK
Open Windows Explorer - there should be a new volume mounted on your machine indicating that the board has been programed with the UF2 bootloader:
If you want to use the SAMD51 board with Arduino or Microsoft MakeCode, you can stop here.
If you want to use it with CircuitPython, let's continue to installing a CircuitPython build.
Page last edited March 08, 2024
Text editor powered by tinymce.