How to burn / flash a bootloader into an external ATSAMD21
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.
Examples
When do we have to burn a bootloader into a bare SAMD21?
- If a SAMD21 is used in a project like this:
- If the SAMD21 on an Arduino board without Atmel Embedded Debugger (EDBG) has to be replaced. For instance these boards:
Circuit explanation
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
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:
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.
Links
- cogito ergo blog
- Mini SAMD21 development board 15x15mm (Arduino compatible)
- SAMD21 for dummies
- Arduino Zero for dummies
- How to use all SAMD21G pins
- SAMD21 Arduino bootloader virus