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.
Take a 4 pin 2.54mm Male Header and solder it on the Arduino Duemilanove where X3 is marked on the board.
Now let’s connect the ICSP header with the X3 as in the following picture
and the result
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 (yuki-lab.jp 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
To setup the program we have to follow these steps:
- 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;
- From the Programmer group box select FT232R Synchronous BitBang (diecimila);
- In the Device group box select ATMega 328 (m328p);
- In the Command line Option type “-P ft0 -B 4800”;
- In the Port group box DO NOT SELECT anything;
- 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.
- 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.
- 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.
- In the Fuse group box press Write button. If you are using “-P ft0 -B 4800” now is time to remove “ -B 4800”.
- In the Flash group box press … button and browse to your Arduino IDE install folder;
- 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.
- After select the bootloader press Erase – Write – Verify and wait for the process to finish;
- 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);
- Disconnect your board from USB, disconnect the cable from ICSP or X3 or both;
- Connect the board to USB again, select the corresponding board (Duemilanove or UNO) and/or change the USB if necessary;
- Upload a sketch (Blink from examples is good as it doesn’t require any external hardware);
- 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 http://code.google.com/p/optiboot/
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