ATMega328P - Burning bootloader

ATMega328P - Burning bootloader

Please read Liability Disclaimer and License Agreement CAREFULLY

In this article I will describe how to burn boot loader on a new ATMega328P using an Arduino Duemilanove board - BitBang Mode - and also how can you “morph” your Duemilanove into a Uno.

Almost everything posted here is taken from an article called “Burning the Bootloader without external AVR-Writer”, so all the credits goes to KIMIO KOSAKA.


Let the transformation begin…


First we will need some wires to create connections on the Arduino Duemilanove board.

For a flexible use I recommend to take an USB cable like in the picture below and cut it at about 10 cm from the connector.

USB Cable

Take a 4 pin 2.54mm Male Header and solder it on the Arduino Duemilanove where X3 is marked on the board.

Male Pin Header

Now let’s connect the ICSP header with the X3 as in the following picture

arduino duemilanove

and the result

ICSP Cable


ICSP Connected

Before you proceed with each connection check it twice, you don’t want to solder the wrong pins here.

Did you finish the cable? If YES then we have all hardware needed to burn Arduino bootloader on a new/used ATMega328P chip.

In order to do that download and unarchive this in c:\Program Files.

 This archive includes avrdude-serjtag with avrdude.conf updated with support for ATMega 328P, 168P and 88P and avrdude-GUI ( Version). Be aware that you need .NET Framework 2.0 installed on your computer before you run avrdude-GUI.

Open the file avrdude-GUI.exe from "C:\Program Files\avrdude-GUI-1.0.5\" and you will get the following screen filled with blanks

Avrdude interface

To setup the program we have to follow these steps:

  1. In the group box called avrdude.exe File press button,browse to C:\Program Files\avrdude-serjtag\binary folder and select avrdude.exe, then press Open button;
  2. From the Programmer group box select FT232R Synchronous BitBang (diecimila);
  3. In the Device group box select ATMega 328 (m328p);
  4. In the Command line Option type “-P ft0 -B 4800”;
  5. In the Port group box DO NOT SELECT anything;
  6. Test your settings by pressing Read button in the Fuse group box; the resulted values should be hfuse = DA, lfuse = FF, efuse = 05. If the values differ and you are using an ATMega328P then change them to those specified above.
  7. Retest your settings by removing “-B 4800” fromstep 4 and press Read button again. If you receive an error then let the valu of the field as described at 4, else – everything is ok – you can use “-P ft0”. In the original post they say that an “Attention!!! A virgin chip cannot run by fast clock mode.” So the step 4 must be respected, but in my case all the chips were written using high speed (only -P ft0”), so it’s your decision here.
  8. Click on Chip Erase button, wait a wile then click on Read button from Lock Bit group box. The text box value must be 3F.
  9. In the Fuse group box press Write button. If you are using “-P ft0 -B 4800” now is time to remove “ -B 4800”.
  10. In the Flash group box press button and browse to your Arduino IDE install folder;
  11. In the folder  "hardware/arduino/bootloaders/atmega/" select file ATmegaBOOT_168_atmega328.hex. If you want to make yourself an UNO in the folder " hardware/arduino/bootloaders/optiboot/" select file optiboot_atmega328.hex.This is the step where you morph your Duemilanove into an Uno … or not.
  12. After select the bootloader press Erase – Write – Verify and wait for the process to finish;
  13. In the Lock Bit group box change the value 3F to 0F and then press Write. The new boot loader is written (unlock = 3F, lock = 0F);
  14. Disconnect your board from USB, disconnect the cable from ICSP or X3 or both;
  15. Connect the board to USB again, select the corresponding board (Duemilanove or UNO) and/or change the USB if necessary;
  16. Upload a sketch (Blink from examples is good as it doesn’t require any external hardware);
  17. If the sketch is uploaded then your work is done, else repeat the forces from step 4, and if still doesn’t work the chip is damaged.


According to

Optiboot is an easy to install upgrade to the Arduino bootloader within Arduino boards. It provides the following features:

- Allows larger sketches. Optiboot is a quarter of the size of the default bootloader, freeing 1.5k of extra space.

- Makes your sketches upload faster. Optiboot operates at higher baud rates and has streamlined programming.

- Adaboot performance improvements. Optiboot runs your sketches sooner, with no watchdog issues.

- Compatible with 168 and 328 Arduinos including Lilypad, Pro, Nano

- Smaller bootloader footprint – An additional 1.5kB of space for sketches.

- Increased bootloader baudrate – Faster sketch uploading.

The downside? The UNO uses a new USB interface, the Duemilanove uses a tried and tested one.

For ATMega168P and 88P please consult this page

Comments powered by CComment