Skip to main content

How to burn a bootloader on the ATmega and ATtiny

Published: 22 November 2011
Last updated: 22 January 2026

Intro

The great advantage of the Arduino is that it can be programmed easily through the serial USB interface, which is made possible by the 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, while the ATtiny3217 uses the UPDI bus. In this article, I describe the method using the SPI bus. The process of burning the bootloader on chips with the UPDI bus is described in the article How to burn a bootloader at the ATtiny with UPDI.

Arduino ICs can be programmed while they are already assembled in the product (system) by the four ISP pins on the chip and a connection cable to an ISP programmer. If in system program isn't possible, the chip must be separately programmed on an IC socket at the ISP programmer. With a programmer we can burn the Arduino bootloader and uploading sketches. The easiest way is to use a USBasp as a bootloader programmer but it can also be done with a second Arduino board used as a programmer.

USBasp used as bootloader programmerUSBasp used as a bootloader programmer

Using a second Arduino board as an In Circuit System Programmer (ISP)

If you don't have an USBasp available you can use a second Arduino board as a programmer. There exists several circuits; some use components such as a capacitor between reset and ground, these parts are omitted.

 How to burn the Arduino bootloaderHow to burn the Arduino bootloaderThe Arduino board as a programmer is located on the right in the schematic

The first step for burning the Arduino bootloader or burning ATtiny chips is to change the Arduino board into an ISP.

  • For ATtiny chips, use the boards manager, see the article here.
  • Install always the latest Arduino software. 
  • Copy the entire "tiny" folder to \arduino-1.0.4\hardware\ (for version 1.0.4). This completes the board list in Extra > Board with the ATtiny chips.
  • Open the folder C:\Projects\Arduino\hardware\tiny and rename Prospective Boards.txt to Boards.txt.
  • Start Arduino with the Arduino board connected to the USB.
  • Tools > Board > select your Arduino board as usual, for instance Arduino Uno.
  • File > Examples > ArduinoISP.
  • Do not insert the program board.
  • Upload the ArduinoISP sketch to the Arduino.
  • The Arduino is a bootloader programmer now.

Burning the ATmega bootloader

  • Open the Arduino IDE
  • Select the board in which the processor will be used, for instance: Tools > Board > Arduino Uno. Don't take the Arduino board that is used for ISP.
  • Select the programmer: Tools > Programmer > Arduino as ISP / USBasp
  • Tools > Burn Bootloader.

Burning the ATtiny bootloader

  • Insert the program board with the ATtiny chip into the Arduino.
  • Check if the heartbeat LED blinks now, if not, disconnect the Arduino and connect again.
  • Extra > Board > select your ATtiny chip, for instance "Attiny85 @ 1MHz (internal oscillator; BOD disabled)".
  • Select the programmer: Tools > Programmer > Arduino as ISP / USBasp
  • Upload the example blink program, see below.
  • Ignore two error messages: "avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85".
  • The test LED should blink now, the on and off time is 1 sec. 

Chips without a serial interface

Some small Atmel ATtiny chips don't have a serial interface, such as the 8pin ATtiny85. Here we need to upload the sketch directly via the In System Programmer (ISP), without using a bootloader.
Attention: when uploading a sketch this way, a bootloader will be deleted!
Normally we use the serial USB port or a FTDI breakout board to upload sketches. But for chips without a serial interface, a SPI programmer has to be used.

  • Sketch > Upload Using Programmer.
  • Note: the upload button doesn't work here, this is confusing.

ATtiny45 pin1 used as PB5 or ADC0

As the other ATtiny pins, pin 1 can be used as for instance an I/O line PB5 or an analog input ADC0. But with the Arduino program environment, pin1 can't be used for other purposes. When pin1 is changed once, the chip can't be programmed anymore with the Arduino. So we have to live with just 5 available pins.

Setting the internal ATtiny clock

The fuse bits of the ATtiny, which configures the internal clock, are automatically set by selecting the chip: "Attiny85 (internal 1 MHz clock)" /  "Attiny85 (internal 8 MHz clock)". Note that this influences the timer functions such as delay(). 

Other articles from Interfacing with hardware