Target Amount: $27 / $2000

Amount Raised will be updated once daily.

Thanks to those who have donated.

Starting Electronics Fund Raiser

It is that time of the year again when our annual web hosting subscription must be paid.
We also need to upgrade our lab equipment which is outdated (including test equipment).
Please consider giving a donation to Starting Electronics and help to fund this site.

Burning the Bootloader to an Arduino Uno using Atmel Studio and the AVRISP mkII

Created on: 13 October 2012

If your Arduino Uno microcontroller has been damaged or got "bricked up" and you need to get it working again quickly, you will need to replace the microcontroller chip (ATMEGA328P) and then load the bootloader program to the microcontroller. Although there are ways of restoring a "bricked up" microcontroller, a quick fix to get your Arduino Uno board working is to replace the microcontroller and then sort out the bricked up microcontroller at your leisure.

When a new blank microcontroller is inserted into an Arduino board, it must have the Arduino bootloader programmed into it. This only has to be done once. The bootloader is a piece of software that allows sketches to be loaded to the Arduino via the USB or serial port from the Arduino IDE.

This video shows what needs to be done to load or "burn" the bootloader to the blank microcontroller in an Arduino Uno board. Atmel Studio 6 and the AVRISP mkII USB programmer is used to burn the bootloader. The rest of this tutorial covers the details.

Can't see the video? View on YouTube →



Why Use Atmel Studio?

If you have loaded Atmel Studio on your PC and you try to burn the bootloader to the Arduino using the Arduino IDE, you will get an error message in the Arduino IDE because of a driver clash between Atmel Studio and the Arduino IDE drivers.

The Arduino IDE displays the error message:

Error while burning bootloader.
avrdude: usbdev_open(): did not find any USB device "usb"

The best solution to this problem is to use Atmel Studio to burn the bootloader, rather than removing Atmel Studio and its drivers.

Hardware Setup

Plug the AVRISP mkII USB connection into a spare USB port on the PC. Plug the AVRISP ribbon cable connector into the 3 by 2 header on the Arduino board. Make sure that you connect it the right way around. Pin 1 is marked on the AVRISP connector and on the Arduino header.

Power up the Arduino either from the PC via a USB cable or by an external power supply.

Burning the Arduino Bootloader

The bootloader is included with the Arduino IDE software. In version 1.0.1 of the Arduino software, you will find the bootloader in the Arduino folder:

arduino-1.0.1\hardware\arduino\bootloaders\optiboot\

The bootloader in this folder that must be loaded to the Arduino Uno is optiboot_atmega328.hex

Steps to Burn the Bootloader

1. Connect the hardware as described above

2. Start Atmel Studio

3. In Atmel Studio, click Tools → Device Programming

4. In the Device Programming dialog box, select AVRISP mkII in the Tool drop-down box, ATmega328P in the Device drop-down box and ISP in the Interface drop-down box

Atmel Studio settings for the Arduino Uno microcontroller (ATMEGA328P) and the AVRISP mkII programmer

Atmel Studio Interface Settings - click for a bigger image


5. Click the Apply button

6. You can click the Read button under Device signature to make sure that you can connect to the ATMEGA328P microcontroller

7. Click Memories in the left pane of the dialog box

8. Browse to the bootloader hex file using the ... button and then select the hex file

9. Click the Program button

Burning the Arduino Uno bootloader in Atmel Studio

Burning the Arduino Uno Bootloader - click for a bigger image


10. After programming has finished, click Fuses in the left pane

11. Change the fuse values to:
EXTENDED: 0x05
HIGH: 0xDE
LOW: 0xFF

12. Click the Program button

The Arduino Uno fuse settings in Atmel Studio

Arduino Uno Fuse Setting - click for a bigger image


13. You can now close Atmel Studio

14. Start the Arduino IDE and load a sketch to test that the bootloader is working, e.g. load the Blink sketch to flash the on-board LED

© 2012 – 2014, Starting Electronics