Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
cec2650
Bootloader reloading (non-AVR boards)
Hannes7eicher Dec 21, 2022
414e114
Structural FIxes
Hannes7eicher Dec 22, 2022
d6a3c8e
Content adjustments
Hannes7eicher Dec 22, 2022
da79427
.md spacing fixes
Hannes7eicher Dec 22, 2022
9f2d9c4
Content Adjustments
Hannes7eicher Dec 22, 2022
c7ac70e
missing space
Hannes7eicher Dec 22, 2022
88efd7f
updating header
Hannes7eicher Dec 22, 2022
d21035a
Update content/tutorials/generic/bootloader-reloading/bootloader-relo…
Hannes7eicher Jan 12, 2023
463444e
Update content/tutorials/generic/bootloader-reloading/bootloader-relo…
Hannes7eicher Jan 12, 2023
eaef233
Update content/tutorials/generic/bootloader-reloading/bootloader-relo…
Hannes7eicher Jan 12, 2023
e73fc8c
Update content/tutorials/generic/bootloader-reloading/bootloader-relo…
Hannes7eicher Jan 12, 2023
2665e0d
Update content/tutorials/generic/bootloader-reloading/bootloader-relo…
Hannes7eicher Jan 12, 2023
162da4c
Update content/tutorials/generic/bootloader-reloading/bootloader-relo…
Hannes7eicher Jan 12, 2023
e09c2c5
Update content/tutorials/generic/bootloader-reloading/bootloader-relo…
Hannes7eicher Jan 12, 2023
17e7409
Update content/tutorials/generic/bootloader-reloading/bootloader-relo…
Hannes7eicher Jan 12, 2023
5961cd8
Adding alternative approach for bootloader burning
Hannes7eicher Jan 12, 2023
c58549f
Fix md syntax
Hannes7eicher Jan 12, 2023
5d89e4d
Mergin both approaches
Hannes7eicher Jan 13, 2023
b1551ee
Fix md syntax
Hannes7eicher Jan 13, 2023
fd4acf4
Update content/tutorials/generic/bootloader-reloading/bootloader-relo…
Hannes7eicher Jan 16, 2023
c89851a
Update content/tutorials/generic/bootloader-reloading/bootloader-relo…
Hannes7eicher Jan 16, 2023
fba50c8
Update content/tutorials/generic/bootloader-reloading/bootloader-relo…
Hannes7eicher Jan 16, 2023
f76e567
Update content/tutorials/generic/bootloader-reloading/bootloader-relo…
Hannes7eicher Jan 16, 2023
7376403
Update content/tutorials/generic/bootloader-reloading/bootloader-relo…
Hannes7eicher Jan 16, 2023
7227edb
Update content/tutorials/generic/bootloader-reloading/bootloader-relo…
Hannes7eicher Jan 16, 2023
3827b0b
Change the order, showing the user the easier approach first
Hannes7eicher Jan 16, 2023
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Content adjustments
  • Loading branch information
Hannes7eicher committed Dec 22, 2022
commit d6a3c8ed6473561edc9b64d67cbb125d0eecfb4d
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ difficulty: Advanced
featuredImage: 'clip'
---

In this tutorial we will learn how to burn the bootloader on non-AVR boards using another Arduino board. The bootloader is a small piece of software that allows uploading sketches onto the Arduino board. It comes preprogrammed on the microcontrollers on Arduino boards. Whether the bootloader has been corrupted or intentionally has been removed, it can be restored by burning (also called, flashing or programming) a new bootloader to the board.
In this tutorial, we will learn how to burn the bootloader on non-AVR boards using another Arduino board. The bootloader is a small piece of software that allows uploading sketches onto the Arduino board. It comes preprogrammed on the microcontrollers on Arduino boards. Whether the bootloader has been corrupted or intentionally has been removed, it can be restored by burning (also called, flashing or programming) a new bootloader to the board.

>**Note:** If you want to burn the bootloader on AVR boards such as an UNO, Mega, and classic Nano you can check out [these instructions](https://support.arduino.cc/hc/en-us/articles/4841602539164-Burn-the-bootloader-on-UNO-Mega-and-classic-Nano-using-another-Arduino).

Expand All @@ -14,14 +14,16 @@ In this tutorial we will learn how to burn the bootloader on non-AVR boards usin

>**Note:** Certain Arduino boards can't be used with the sketch that converts it to a programmer. It is possible to use an Arduino board that runs at 5V as the programmer, but you will need to use level shifting circuitry on the programming lines to avoid exposing the target board to 5V logic levels, which would damage it.

| Working | UNtested | Not working |
| Working | Untested | Not working |
| ----------- | ----------- |----------- |
| SAMD architecture boards | AVR architecture boards |Nano 33 BLE |

- An SD slot. This could be built into your Arduino board (e.g., ([MKR Zero](https://store.arduino.cc/products/arduino-mkr-zero-i2s-bus-sd-for-sound-music-digital-audio-data?_gl=1%2A17dcyg9%2A_ga%2AMjEyMzQ2MjgwOC4xNjY1NjUyNTY3%2A_ga_NEXN8H46L5%2AMTY3MTYyNzMzMS4xNjEuMS4xNjcxNjI5ODA2LjAuMC4w)), a shield (e.g., [MKR SD Proto Shield](https://store.arduino.cc/products/mkr-sd-proto-shield?_gl=1%2A1xs1eol%2A_ga%2AMjEyMzQ2MjgwOC4xNjY1NjUyNTY3%2A_ga_NEXN8H46L5%2AMTY3MTYyNzMzMS4xNjEuMS4xNjcxNjMwMzgxLjAuMC4w)), or one of the common SD modules.
- An SD slot. This could be built into your Arduino board (e.g., [MKR Zero](https://store.arduino.cc/products/arduino-mkr-zero-i2s-bus-sd-for-sound-music-digital-audio-data?_gl=1%2A17dcyg9%2A_ga%2AMjEyMzQ2MjgwOC4xNjY1NjUyNTY3%2A_ga_NEXN8H46L5%2AMTY3MTYyNzMzMS4xNjEuMS4xNjcxNjI5ODA2LjAuMC4w)), a shield (e.g., [MKR SD Proto Shield](https://store.arduino.cc/products/mkr-sd-proto-shield?_gl=1%2A1xs1eol%2A_ga%2AMjEyMzQ2MjgwOC4xNjY1NjUyNTY3%2A_ga_NEXN8H46L5%2AMTY3MTYyNzMzMS4xNjEuMS4xNjcxNjMwMzgxLjAuMC4w)), or one of the common SD modules.
- An SD card that fits your SD slot.
- A way to connect the SD card to your computer.
- A way to make the connections to the SWD pins on your target Arduino board. For the [Nano 33 IoT](https://store.arduino.cc/products/arduino-nano-33-iot?_gl=1%2A80ta1j%2A_ga%2AMjEyMzQ2MjgwOC4xNjY1NjUyNTY3%2A_ga_NEXN8H46L5%2AMTY3MTYyNzMzMS4xNjEuMS4xNjcxNjMwNDIwLjAuMC4w) and the MKR Boards other than MKR1000, we found it the easiest to use a 0.1" pitch 2x3 POGO adapter. You could also solder wires to the test points if you prefer. On the MKR boards other than the MKR1000, the SWD header is on the bottom of the board and is the footprint for a 0.1" pitch 2x3 SMD header. On the MKR1000, it is a 0.05" pitch 2x5 male header on the top of the board, which you will need an adapter 1 and cable for.
- A way to make the connections to the SWD pins on your target Arduino board.

For the [Nano 33 IoT](https://store.arduino.cc/products/arduino-nano-33-iot?_gl=1%2A80ta1j%2A_ga%2AMjEyMzQ2MjgwOC4xNjY1NjUyNTY3%2A_ga_NEXN8H46L5%2AMTY3MTYyNzMzMS4xNjEuMS4xNjcxNjMwNDIwLjAuMC4w) and the MKR Boards other than MKR1000, we found it the easiest to use a 0.1" pitch 2x3 POGO adapter. You could also solder wires to the test points if you prefer. On the MKR boards other than the MKR1000, the SWD header is on the bottom of the board and is the footprint for a 0.1" pitch 2x3 SMD header. On the MKR1000, it is a 0.05" pitch 2x5 male header on the top of the board, which you will need an adapter and one cable for.

## Instructions
- Connect an SD card to your computer.
Expand All @@ -44,7 +46,7 @@ In this tutorial we will learn how to burn the bootloader on non-AVR boards usin
- Select **File > Examples > Adafruit DAP library > samd21 > flash_from_SD** from the Arduino IDE's menus.
- Change this line: ```#define SD_CS 4```

according to the Arduino pin connected to the SD CS pin. If your board has a built-in SD slot (e.g., MKR Zero 9), then you can change this line:
according to the Arduino pin connected to the SD CS pin. If your board has a built-in SD slot (e.g., [MKR Zero 9](https://store.arduino.cc/products/arduino-mkr-zero-i2s-bus-sd-for-sound-music-digital-audio-data)), then you can change this line:

```
(!SD.begin(SD_CS)) {
Expand Down Expand Up @@ -74,15 +76,15 @@ In this tutorial we will learn how to burn the bootloader on non-AVR boards usin

SWD pads on MKR boards other than MKR 1000:

![SWD pads on MKR boards other than MKR 1000](assets/SWDpadsMKR1000.png)
![](assets/SWDpadsMKR1000.png)

MKR1000 SWD header pinout:

![SWD pads on MKR boards other than MKR 1000](assets/SWDMKR1000header.png)
![](assets/SWDMKR1000header.png)

Nano 33 IoT SWD pads:

![SWD pads on MKR boards other than MKR 1000](assets/SWDpadsNano33IoT.png)
![](assets/SWDpadsNano33IoT.png)

- Plug the USB cable of the programmer Arduino board into your computer.
- Select **Tools > Serial Monitor** from the Arduino IDE's menus. You should now see the Serial Monitor output showing the target board detected, and the bootloader file flashed to it successfully.
Expand All @@ -99,16 +101,10 @@ If you have a CMSIS-DAP compliant debug probe, you can just do this instead:
- Select **Tools > Programmer > Atmel EDBG** from the Arduino IDE's menus.
- Select **Tools > Burn Bootloader** from the Arduino IDE's menus. - The "Burn Bootloader" process should now finish successfully.

You can use [this little open source debugger](https://www.tindie.com/products/ataradov/cmsis-dap-compliant-swd-debugger/)
You can use [this little open-source debugger](https://www.tindie.com/products/ataradov/cmsis-dap-compliant-swd-debugger/)

**Using a J-Link as the programmer**
Segger J-Link debug probes (e.g., J-Link EDU Mini) can be used with the Adalink software:
https://github.com/adafruit/Adafruit_Adalink

This is a fairly complex procedure, so we recommend against this option unless you already own a J-Link and don't have the supplies on hand for one of the other options.

See the table below for more information on which board you can use:

- Working: SAMD architecture boards (e.g., MKR boards, Nano 33 IoT, Zero).
- Untested: AVR architecture boards (e.g., Mega), but the sketch does compile for them.
- Not working: Nano 33 BLE
This is a fairly complex procedure, so we recommend against this option unless you already own a J-Link and don't have the supplies on hand for one of the other options.