Let's Make Robots!

Burning the Arduino Bootloader onto an ATmega168PA

Helps you burn the bootloader on a ATmega168PA.
AttachmentSize
avrdude.conf_.txt414 KB
boards.txt11.13 KB

Introduction:

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.

 

Programming:

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.

 

 

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Hi,

I'm trying to burning the Arduino bootloader onto an ATmega168PA from the Wild Thumper controller (the same as the picture) ut with an Arduino Uno. I'm following the tutorial:

http://arduino.cc/en/Tutorial/ArduinoISP

But it doesnt work, and i can't find on internet more information to burn the bootloader onto this exactly controller.

Any help is very appreciated.

Thank you!

 

 

Sorry for this stupid question.

Is Atmega 168 and Atmega 168 PA the same?

if yes then Is this process works only for Arduino Nano?or other board (like duemilanove,uno)?

I have two Severino(atmega 168) boards in my house.Which I have to bootload.If this thing works for duemilanove.It will be a great help for me.

The Arduino boards used the ATmega168-20AU, now I am told that that chip is no longer in production as it has been replaced by the ATmega168-PA.

The 168PA is manufactured using a different process that allows it to use slightly less power. The big issue for Arduino users is that the chip has a different signature ID that is not recognized by the AVRdude included with the Arduino IDE. This is why you get a "Yikes! signature not recognized" error from AVRdude.

Look at the part number on your Severino's MCU to see which chip is used. If the Severino uses 168PA then try burning the bootloader with the latest version of Arduino. Maybe they have updated it. otherwise you will need to go through the process I described.

 

 

I tried the following from windows command prompt:

 

avrdude -P COM3 -b 19200 -C "C:\Program Files\arduino-0023 - Copy\arduino-0023\hardware\tools\avr\etc\avrdude.conf" -c avrisp -p ATMEGA168P -v -e -U flash:w:ATmegaBOOT_168_diecimila.hex -U -F lock:w:0x0F:m

 

 

Upon completion the message:

 

"AVR device initialised  and ready to accept instructions"

avrdude: Device signature = 0x1e9406

avrdude: Expected signature for ATMEGA168P is 1E 94 0B.

Double check chip, or use -F to override this check.

avrdude done. Thank you.

 

Note I did use the -F argument.  When trying to upload a sketch such as the example "blink" I get the "Problem uploading to board", with the following logged (Note I choose the new board config from Oddbot's file Dagu product with ATMega168PA, and have tried the ATMEGA168 default too).

 

avrdude: stk500_read_sig_bytes(): (a) protocol error, expect=0x14, resp=0x10

avrdude: error reading signature data for part "ATMEGA168p", rc=-2

avrdude: error reading signature data, rc=-1

avrdude: Send: Q [51]   [20] 

avrdude: Recv: 

avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

 

Seems there is a mismatch between the bootloader uploaded and the signature of the chip??
Most grateful for any help, or at least be put out of my pain with a "once it's gone its gone", as it seems like this board is bricked as soon as there is a need to upload a new bootloader.

 

 

 

 

the signature: 1E 94 06 is for an ATMega168. (Notice no following letters.)

What is the expected output? What do you see instead?
1E 94 0B (for ATmega168P) but is 1E 94 06 (for ATmega168)
Info from https://code.google.com/p/optiboot/issues/detail?id=67

I just did a simple search for 1e9406 and found that info.

And I was not aware of Optibot, having read up on it now looks like a viable bootloader alternative, so thanks for the info.

 

Apologies, did not think to google 1e9406, thats a little lesson for me to search using part/serial numbers etc.

Don't worry about it Birdmun.

If they bothered to read this tutorial they would see that they need to use the attached files to update AVRdude with the new signiture.

The information is there. They just are not bothering to read it.

For a customer who purchased both thumper and 2 WTC's I find the response rather too easy and rude.

 

If you had bothered to read my reply properly you would have seen that in the call to avrdude I state the config file in the folder Arduino copy, which might indicate I had gone through the process of taking a copy of the IDE and replacing the conf and board files. I had also mentioned I used the option dagu with at168, which also shows the files were updated.

 

After spending several hours trying, reading up on several threads about using Arduinos as ISPs and looking at how to use avrdude at the command line level the words "not bothered to read" are a little frustrating.

With a name like Grupmy beard I hope you can apreciate that I also get a little grumpy occasionally. What I saw in your reply is that your using the windows command prompt (why? I never said to do that!) when my tutorial tells you what files to replace, what directory to find the old files in etc.

If you follow my directions precisely then the Arduino IDE will work fine with the new Atmega168P chip.

If you start doing stuff that I didn't say to do then my patience wears down very quickly.

 

 

Hi Oddbot,

 

Bought a second WTC to reload bootloader into first, as first seems "stuck".  

 

Thanks for this post, diagram and files which really help.  

 

As you can see from message below, when running the Bootloader directly from within the modified Arduino IDE according to your instructions I get the following error message.  It would almost seem I have the same issue as you report here:

 

http://letsmakerobots.com/node/31956

 

But given this is dated before this tutorial I imagined it is resolved by the board and config changes?  I've searched but unsure as to achieve this, would I have to run Avrdude at the Windows (7) command line using your parameters adding -F, or modify your config file?  FYI both WTC Atmega chips are 168PA AU.  Grateful if you can help.

 

avrdude: Expected signature for ATMEGA168p is 1E 94 0B

Double check chip, or use -F to override this check