Burning the Arduino Bootloader onto an ATmega168PA
These instructions were based on Arduino 1.0 running on Windows XP. They should work for other operating systems.
Since version 0018 of the Arduino IDE there has been example code that lets you use a spare Arduino to burn the bootloader. The ability to burn the bootloader is useful for creating your own Arduino boards and repairing boards that have had their memory corrupted. This can occur if the supply voltage falls too low because the brownout function is not normally enabled on an Arduino.
Trials and tribblations:
Recently I wanted to burn the bootloader into an ATmega168 PA-AU processor. This chip is almost identical to the ATmega168 20-AU chips previously used but it has a different signature ID. I looked on the internet only to find that other people had similar problems. Eventually I found that the avrdude.conf file needed to be changed as well as needing to create a new board.
Modifying the Arduino IDE:
If you do not have Arduino 1.0 then download it first. This version uses a different avrdude to previous versions making the bootloader burning process much easier.
Since we need to make a few modifications I suggest making a copy of your Arduino folder and giving it a new name like "Arduino Bootloader Burner". Download the new boards.txt and avrdude.conf files I have attached to this tutorial.
Go to arduino-1.0\hardware\arduino\ and replace the board.txt file with the attached file. This adds:
- DAGU product w/ ATmega168PA
- Micro Magician (3.3V, 8MHz) w/ ATmega168PA
The first option is for standard 5V logic @ 16MHz as used on the Wild Thumper controller and Adventure robots. The second is for 3.3V logic and 8MHz clocks. The key thing to note is that in the configuration the MCU is now set to 168p.
Next we need to go to arduino-1.0\hardware\tools\avr\etc\ and replace the avrdude.conf file. This adds a new definition ATmega168P. This definition is the same as the ATmega168 definition except that I changed the signiture ID from 1E 94 06 to 1E 94 0B.
Once this has been done, run your Arduino 1.0, select your com port, board type and programmer type. If your using an Arduino as your ISP programmer then wire it up to your target board as instructed in the example code. In my photo (click for a detailed image) I show two Wild Thumper controllers connected together via the ISP sockets. This will work for any board using an ATmega168 or ATmega328.
For some reason I found the first time I burned the bootloader it came up with an error straight away but the second time it always works fine.
Once your bootloader is installed then use your unmodified Arduino IDE to program your controller. You can just select the Arduino Nano w/ 168 for your board type for 5V devices. Use Arduino Pro 3.3V @ 8MHz for the Micro Magician.
I am sorry that this tutorial is somewhat incomplete. It was written in a hurry to help someone. I will try and update in the future.