Computer pr0n

Burning Arduino bootrom on an ATmega328-PU

by on Mar.31, 2012, under Arduino, Hardware, How-to

loclhst

Like many people, I purchased a handful of the ATmega328-PU microprocessor chips, not realizing there are two, the ATmega328P-PU and ATmega328-PU.  Note the additional P in the first, which stands for picopower; in other words, it has better power consumption.

Well, since most of the arudino stuff is designed around flashing the 328P-PU chip, there are some modifications to be made to a few files to allow you to do this.  However the current instructions have you CHANGE the 328P-PU, then change it back. This does not fly for me, because I may be going between various systems, or not remember to change it back, so my solution, was to add additional support for the 328-PU chip, on top of the 328P-PU chip!

Without changing anything, you will get an error similar to

Expected signature for ATMEGA328P is 1E 95 0F Double check chip, or use -F to override this

The normal solution, provided by a number of places is to edit the avrdude.conf file, then change the signature for the ATMEGA328P chip from 0x1e 0x95 0x0F to 0x1e 0x95 0x14. [Google Search].

My solution is the copy the ATMEGA328P section, and rename the copy to ATMEGA328, then change the signature on this.  the avrdude.conf file should be located in the Arduino director, under hardware/tools/avr/etc. Remember to always make a back up of any file you edit!

Next up, you will need to replicate the Board/Hardware settings, changing the value for the mcu entry.

Since we do not want to edit the hardware.txt file directly, as this does not get saved between versions, you will want to go to your sketch folder, and make a sub folder called “hardware”, within this folder, have another sub folder called “breadboard”, and within this folder, you want a file called hardware.txt, which will contain our data.

For example, if you will be using “Arduino Duemilanove w/ ATmega328”, you will want to add an entry of:

# atmega328-pu (non-picopower)
atmega328npp.name=Arduino Duemilanove w/ ATmega328 (non-picopower)

atmega328drd.upload.protocol=arduino
atmega328drd.upload.maximum_size=30720
atmega328drd.upload.speed=57600

atmega328drd.bootloader.low_fuses=0xFF
atmega328drd.bootloader.high_fuses=0xDA
atmega328drd.bootloader.extended_fuses=0x05
atmega328drd.bootloader.path=atmega
atmega328drd.bootloader.file=ATmegaBOOT_168_atmega328.hex
atmega328drd.bootloader.unlock_bits=0x3F
atmega328drd.bootloader.lock_bits=0x0F

atmega328drd.build.mcu=atmega328
atmega328drd.build.f_cpu=16000000L
atmega328drd.build.core=arduino
atmega328drd.build.variant=standard

Notice, I added in drd to add the atmega328.* lines, the .name field has been changed, and the .mcu line has been changed to atmega328, which is the same name I used in the avrdude.conf file.

In my case, since I am using a breadboard to program, and not using an external crystal [ArduinoISP on a Breadboard], I am using an add on breadboard hardware.txt entry which was recommended from the Arduino website.

This should only be required when installing the bootrom, using the standard hardware selection, I am able to upload without any issues.

If all goes okay, you should now have a working ArduinoISP and similar that can flash the ATmega328-PU chips with no issues!

ArduinoISP on a Breadboard

 

Update: 2012-04-07

Here is the completed ArduinoISP on a solder board. Though the last image is missing one piece…10 points goes to who finds it..

Arduino-Like board pt 1Arduino-Like board pt 2Arduino-Like board pt 3

:, , , , , , ,

7 Comments for this entry

  • Deskwizard

    Hey loclhst, Happy Easter!

    I just got myself some of the non-picopower too, and while I managed to make something work, its far from optimal…
    There’s seem to be something I am missing in your modifications…
    Could you please post or send me the 2 modified sections (the one from avrdude.conf and from boards.txt) ?
    I tried multiple ways of getting it to work reliably but there’s something in the way…
    For the time being I resorted to commenting out one of 2 signatures I put in the original 328p section, switching the comment over when I need to program the bootloader.

    Hope you can help and thanks!
    Deskwizard

    (btw, if you want to use them with the internal OSC at 8mhz, no div clock, change lowfuse to 0xD2. Dont forget to change the bootloader to the pro also, or set upspeed to 28800 in your board def.)

  • Deskwizard

    Oh and I forgot…

    VCC at 20 & 21 ? maybe I just can’t see because of the angle… or you routed them underneat

    first guest was reset pull-up, like I always do 😉

  • Managed Network Services

    I am often to blogging and i really appreciate your content. The article has really peaks my interest. I am going to bookmark http://computerpr0n.com and keep checking for new information.

  • Managed Services

    http://computerpr0n.com is so cool! I dont suppose Ive read anything like this before. So nice to find somebody with some original thoughts on this subject. realy thank you for starting this up. http://computerpr0n.com is something that is needed on the web, someone with a little originality. useful job for bringing something new to the internet!

  • matt

    In your hardware.txt file, while did you add drd on every line except the .name, where you added npp?

  • Cefn Hoile

    Hi, there. I found this article when trawling for solutions for my ATMEGA328-PUs but finally settled on using Optiloader, ( see http://www.3guys1laser.com/blog-burn-bootloader-blank-atmega328atmega328p-arduino-uno _which bypasses all these issues in one go. It’s been invaluable for me preparing kits for http://shrimping.it , meaning I can use the cheaper chips, so it costs just £1.40 total component cost to create an Arduino-compatible #Shrimp!

  • Joselio Carneiro

    Hi There,

    I’m trying to write an Arduino Uno bootloader in a ATMEGA328p-mu. I get the message:

    C:\Desenvolvimento\arduino-1.0.1\hardware\tools\avr\bin>C:\Desenvolvimento\ardui
    no-1.0.1\hardware/tools/avr/bin/avrdude -CC:\Desenvolvimento\arduino-1.0.1\hardw
    are/tools/avr/etc/avrdude.conf -pm328p -cusbasp -Pusb

    avrdude: error: programm enable: target doesn’t answer. 1
    avrdude: initialization failed, rc=-1
    Double check connections and try again, or use -F to override
    this check.

    Do you have any clue to fix it?

    I’m using the USBasp program board, but already tried the ArduinoISP sketch without success.

    Thank you very much,

    Joselio

Leave a Reply

 

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!