Skip to main content

How to burn a bootloader at the ATtiny3217 with UPDI

Published: 03 February 2020
Last updated: 07 July 2025

The great advantage of the Arduino is that it can be programmed easily through the serial USB interface, which is made possible by a bootloader on the chip. This is called uploading. Before this is possible, a bootloader must first be burned onto the chip. This can be done via the SPI bus or the UPDI bus, depending on the chip you are using. For example, the ATmega328 uses the SPI bus for burning the bootloader, while the ATtiny3217 uses the UPDI bus for this. In this article, I describe the method for ATtiny chips.
The process of burning the bootloader on other Arduino chips such as ATmega with the SPI bus is described in the article
 How to burn a bootloader at the ATmega and ATtiny with SPI.

I've created a quick step-by-step guide on how to burn a bootloader into the ATtiny chips that are supported by the megaTinyCore.
In this article, I use the ATtiny3217 as an example, but it is synonymous with all other ATtiny chips.

I want to thank Spence Konde for his an extensive work on the megaTinyCore. Also Hans van Meijdam helped me a lot with the SerialUPDI HV programmer. Spence Konde also sells development boards for the ATtiny3227/3217/1607.

ATtiny3227 3217 1607 dev board Spence KondeDevelopment board from Spence Konde

Attention to the UPDI / Reset pin

To make the bootloader work, the UPDI pin has to be programmed as Reset pin.  After this, UPDI reprogramming via this pin is blocked for ever and this is fine.

However if you want to restore this pin to the original FTDI function, a HV programmer is needed as described here: High-Voltage Programmer. This is necessary if you want to, for example, burn another bootloader.

How to burn a bootloader into the ATtiny3217 via UPDI

Step 1

Build the Arduino SerialUPDI bootloader burner adapter.

Arduino SerialUPDI programmerArduino SerialUPDI bootloader burner adapter


You need an FTDI adapter with the CH340C. There may be no series resistors in the TX and RX line. If there are any, make them 0 ohms. This FTDI adapter doesn't have any series resistors:
CH340 FTDI adapterFTDI adapter with CH340C, without series resistors

https://nl.aliexpress.com/item/32643085356.html

Make the following circuit, this creates the UPDI signal:

SerialUPDI programmer circuitArduino SerialUPDI bootloader burner circuit

I designed a SerialUPDI bootloader burner adapter board for this, you can download it here on GitHub.|
The board is made for the same connector as the ATtiny self-clamping zigzag program connector.
Note: this board is only for burning the bootloader. For uploading sketches by FTDI use the 5p ATtiny adapter.
SerialUPDI programmer PCBArduino SerialUPDI bootloader burner PCB

Attention: the UPDI pin should NOT be connected to a resistor to 5V at this stage, which is needed later when uploading sketches via FTDI. See my Arduino Nano DIP board where a jumper (D) is used to isolate the resistor when burning the bootloader via UPDI.

Step 2

Install the megaTinyCore package.

Attention: Please use Arduino IDE v1.8.19,  uncheck setting "Check for updates on startup"

Sometimes the megaTinyCore package is in not shown, than change the URL to: https://archive.org/download/azduino_micronucleus-mirror/package_drazzy.com_index.json

Step 3

The file boards.txt has to be changed. The location is: C:\Users\xxxxx\AppData\Local\Arduino15\packages\megaTinyCore\hardware\megaavr\2.6.10

It is useful to download the modified boards.txt file here at GitHub.

This is changed in the boards.txt file:
Remove the '#' to uncomment all lines starting with #atxy7.menu.resetpin.Do the same with the lines starting with
#atxy6.menu.resetpin
#atxy4.menu.resetpin
#atxy2.menu.resetpin
It's about 4 to 6 lines each time. Save the file.

Step 4

You can skip this step if you've done it before.

To avoid mistakes, first test if the SerialUPDI programmer works well. Open this blinking-LED sketch: 

const byte ledPin = 0; // Edit this, for the Arduino Nano DIP = 0
void setup() { pinMode(ledPin, OUTPUT); } void loop() { digitalWrite(ledPin, 0); delay(500); digitalWrite(ledPin, 1); delay(500); }

Perform the following settings with tools menu:

  • Board > megaTinyCore = Attiny3227/3217... ...(not the w/Optiboot !)
  • Chip -> ATtiny3217
  • Clock = what you want (16MHz / 20MHz internal)
  • UPDI/Reset Pin = UPDI (default)
  • Programmer =  SerialUPDI – SLOW:57600 baud
  • Port, select the right port

Upload the sketch (as normal with Sketch > Upload or the -> button at the top).
The LED has to continue flash now.

Now we can set the board settings for burning the bootloader. This can be done in two ways: step 5a or step 5b (preferred).

Step 5a

The board settings must be set manually in the tools menu, but this is prone to errors. This is a serious problem with mass production if the bootloader needs to be burned. It is impossible to check afterwards whether the correct board settings have been made with the manual settings. Better use step 5b.

First, perform the following settings with the menu tools (or better, go to step 5b, see below)

  • Board = megaTinyCore > Attiny3217/3216....... w/optiboot
  • Chip = ATtiny3217
  • Clock = what you selected in step 4
  • UPDI/Reset pin = Reset (default optiboot for 1sec. after ext. reset *DANGER*....
  • Programmer =  SerialUPDI – SLOW:57600 baud
  • Port, select the right port

See here for the correct board settings:

Board settings bootloader ATtiny3217Board settings for burning the bootloader ATtiny3217

Detailed information about the board setting can be found here: https://github.com/SpenceKonde/megaTinyCore

Step 5b

The board settings are stored in the file preferences.txt, which is located at: C:\Users\xxx\AppData\Local\Arduino15\preferences.txt. Instead of manually editing the board settings with the tools menu, which is prone to errors, you can simply replace the preferences.txt file with another file that contains the correct settings. 

The settings required for burning the bootloader are stored in the file "preferences-bootloader-ATtiny3217", which you can download here on GitHub. First make a copy of the original preferences.txt file and then replace it with "preferences-bootloader-ATtiny3217.txt" (of course, change the name first). Restore the original preferences.txt file if you want.

Step 6

Tools > burn bootloader
The bootloader is burned into the ATtiny3217. The UPDI pin is now reprogrammed as reset pin and UPDI programming is blocked.

Ignore errors like this:
avrdude: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description
avrdude: jtagmkII_program_enable(): bad response to enter progmode command: RSP_ILLEGAL_MCU_STATE

Uploading sketches via FTDI

Step 7

Since the bootloader is now installed, sketched can be uploaded via the RXD - TXD pins by an FTDI adapter. Connect a common FTDI adapter to the ATtiny3217, like this:

ATtiny3217 FTDI FTDI adapter connection to the ATtiny3217

I always use the ZIGZAG connector method like this: Small ATtiny self-clamping program connector

Step 8

Now we can upload and edit sketches via the bootloader with an FTDI adapter.
Perform the following settings with menu tools:

  • Board =  Attiny3217 w/Optiboot

Upload the ATtiny3217-blinking-LED sketch. The LED has to continue flash now.

Restoring preferences.txt

If you delete this file and restart Arduino and then close it again, a new file will be automatically generated with the default values.

Board settings defaultDefault board settings for the ATtiny3217 in preferences.txt

UPDI pin reprogramming with High-Voltage Override

If the UPDI pin is programmed as a reset pin, reprogramming via UPDI is disabled. However if you want to restore this pin to the original FTDI function, a HV programmer is needed as described here: High-Voltage Programmer. This is necessary if you want to, for example, burn another bootloader.