Skip to main content

How to burn / flash a bootloader into an external ATSAMD21

Published: 03 October 2016
Last updated: 20 September 2020

Burning a bootloader into the ATSAMD21

This article is dated, see here how to burn a bootloader simply with a J-Link Debugger:

ATSAMD21g18 Bootloader With J-link Debugger

I no longer sell the SAMD21 with bootloader.

Introduction

The SAMD21 bootloader is used to communicate with the Arduino IDE through its internal USB port, also called the native port. Burning a bootloader into a bare SAMD21 can be done with a programmer like the Atmel ICE, but we can also use an Arduino Zero. Here I will tell how to do it.
Note that the bootloader has nothing to do with the package file for the pin definitions.

Bare SAMD21GBare SAMD21G

Atmel-ICE programmer/debuggerAtmel-ICE programmer/debugger

Bare SAMD21G programmer with the Arduino ZeroBare SAMD21G programmer with the Arduino Zero

Examples

When do we have to burn a bootloader into a bare SAMD21?

  • If a SAMD21 is used in a project like this:

Project with a SAMD21Project with a SAMD21

  • If the SAMD21 on an Arduino board without Atmel Embedded Debugger (EDBG) has to be replaced. For instance these boards:

SAMD21 Mini Breakout without EDBGSAMD21 Mini Breakout without EDBG

SAM 15x15 board without EDBGSAM 15x15 board without EDBG

Circuit explanation

Circuit of the SAMD21 programmer with the Arduino ZeroCircuit of the SAMD21 programmer with the Arduino Zero

Burning the bootloader is only possible by use of the programming port, not the native USB port. The EDBG takes care of the programming. Three control signals are used: SWDIO, SWCLK and RESET and these can program the on-board SAMD21 and also an external SAMD21. The signals SWDIO and SWCLK have to be switched between the on-board SAMD21 and the external SAMD21G, see the schematic.

Arduino Zero modifications

Arduino Zero modificationsArduino Zero modifications

Note: there are cheap Arduino Zero board variants without the programming port, you can't use these. Remove the resistors R105 and R104, see the image. I used the Arduino M0 Pro, whose resistors are respectively R2 and R3.
Glue two SMD toggle switches and a 5 pin male connector to the board, I prefer Polyurethane glue.
Use the free pads of the removed resistors for soldering the wires to.
Note: the 5 pin JST connector is optional, you can use the 1.27mm pitch SWD connector CN2 to connect the TQFP48 socket program adapter.

TQFP48 socket program adapter

You can get a socket program adapter at eBay:

TQFP48 test socket from eBayTQFP48 test socket from eBay

TQFP48 test socket wiringTQFP48 test socket wiring

If the test socket has stacked PCBs, saw off the bottom PCB.
Wire the JST socket connector.
Solder the two capacitors to the board.
Wire the board according the schematic on your own understanding.
Sometimes we have to cut some traces on the board.

Burning the bootloader into the external SAMD21

First check if you can burn the bootloader into the on-board SAMD21 as before; first turn the switches in de right position.
To burn the bootloader into the external SAMD21, put the switches in de other position.

Notes

The procedure is slightly different than for the AVR boards, like the Arduino Uno, where you must first load the example program ArduinoISP. This is not needed for the SAMD21, just select Tools > Programmer > “Atmel EDBG”. Than do Tools > Burn bootloader.

 

Other articles from SAMD21