Burining Bootloader via AVRISP-MKII onto ATMEGA328-AU

having issues with using an AVRISP-MKII to burn a bootloader for an ATMEGA328-AU (the same as on the Pro and Pro Mini)

Error:

avrdude: Expected signature for ATMEGA328P is 1E 95 0F

I have a schema here

any thoughts?

'avrdude' checks the signature bytes in the target processor against what it expects, given the processor that you told it about. So, if the actual processor is a 328-AU and it's expecting a 328P, the signature won't match. Can you select a different processor from the menu?

i take it i can add a new board to the boards.txt file.
like so

[new board name].build.mcu=atmega328p

where can i change the mcu listing type. i can't find how to add the AU

Looks like the atmega328 (without the P) isn't in the config file for avrdude. Locate file avrdude.conf, open it in an editor and locate the atmega328p section, which starts like this:

#------------------------------------------------------------
# ATmega328
#------------------------------------------------------------

part
    id              = "m328p";
    desc            = "ATMEGA328P";
     has_debugwire = yes;
     flash_instr   = 0xB6, 0x01, 0x11;
     eeprom_instr  = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
	             0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
	             0x99, 0xF9, 0xBB, 0xAF;
    stk500_devcode  = 0x86;
    # avr910_devcode = 0x;
    signature       = 0x1e 0x95 0x0F;

If you change the final signature byte from 0x0F to 0x14 then it should recognise your chip (but not a atmega328p). Or you could try copying the whole atmega328p definition and in the copy change the id, desc and signature byte fields, then use the new id or desc to identify the chip in boards.txt, but I don't know whether this works.

Okay, so turns out i actually have an ATMEGA328-AU-ND not an ATMEGA328P-AU-ND

any suggestions?

everything after the first dash is irrelevant, dc42 still has exactly the answer you need.

silly question but where do i find the avrdude.conf on PC

I installed the arduino software into C:\arduino-0022. My conf file is C:\arduino-0022\hardware\tools\avr\etc\avrdude.conf.

Creating a new entry worked beautifully

#------------------------------------------------------------
# ATmega328-AU-ND
#------------------------------------------------------------

part
    id              = "m328au";
    desc            = "ATMEGA328-AU-ND";
     has_debugwire = yes;
     flash_instr   = 0xB6, 0x01, 0x11;
     eeprom_instr  = 0xBD, 0xF2, 0xBD, 0xE1, 0xBB, 0xCF, 0xB4, 0x00,
	             0xBE, 0x01, 0xB6, 0x01, 0xBC, 0x00, 0xBB, 0xBF,
	             0x99, 0xF9, 0xBB, 0xAF;
    stk500_devcode  = 0x86;
    # avr910_devcode = 0x;
    signature       = 0x1e 0x95 0x14;

and then in boards.txt

.build.mcu=m328au

thanks again for all your helps

Hm, I am attempting to program an ATMEGA-328-PU-ND using an Arduino Duemilanove w/ ArduinoISP loaded onto it. I just added the entries as stated by 32teeth to my avrdude.conf and board.txt file, but I got the following error message when I tried to upload my sketch:

unknown MCU 'm328au' specified
Known MCU names:
   avr2
   at90s2313
   at90s2323
   at90s2333
   at90s2343
   attiny22
   attiny26
   at90s4414
   at90s4433
   at90s4434
   at90s8515
   at90c8534
   at90s8535
   avr25
   attiny13
   attiny13a
   attiny2313
   attiny24
   attiny44
   attiny84
   attiny25
   attiny45
   attiny85
   attiny261
   attiny461
   attiny861
   attiny43u
   attiny87
   attiny48
   attiny88
   at86rf401
   avr3
   at43usb320
   at43usb355
   at76c711
   avr31
   atmega103
   avr35
   at90usb82
   at90usb162
   attiny167
   attiny327
   avr4
   atmega8
   atmega48
   atmega48p
   atmega88
   atmega88p
   atmega8515
   atmega8535
   atmega8hva
   at90pwm1
   at90pwm2
   at90pwm2b
   at90pwm3
   at90pwm3b
   at90pwm81
   avr5
   atmega16
   atmega161
   atmega162
   atmega163
   atmega164p
   atmega165
   atmega165p
   atmega168
   atmega168p
   atmega169
   atmega169p
   atmega32
   atmega323
   atmega324p
   atmega325
   atmega325p
   atmega3250
   atmega3250p
   atmega328p
   atmega329
   atmega329p
   atmega3290
   atmega3290p
   atmega32hvb
   atmega406
   atmega64
   atmega640
   atmega644
   atmega644p
   atmega645
   atmega6450
   atmega649
   atmega6490
   atmega16hva
   at90can32
   at90can64
   at90pwm216
   at90pwm316
   atmega32c1
   atmega64c1
   atmega16m1
   atmega32m1
   atmega64m1
   atmega16u4
   atmega32u4
   atmega32u6
   at90scr100
   at90usb646
   at90usb647
   at94k
   avr51
   atmega128
   atmega1280
   atmega1281
   atmega1284p
   atmega128rfa1
   at90can128
   at90usb1286
   at90usb1287
   m3000f
   m3000s
   m3001b
   avr6
   atmega2560
   atmega2561
   avrxmega3
   atxmega32a4
   avrxmega4
   atxmega64a3
   avrxmega5
   atxmega64a1
   avrxmega6
   atxmega128a3
   atxmega256a3
   atxmega256a3b
   avrxmega7
   atxmega128a1
   avr1
   at90s1200
   attiny11
   attiny12
   attiny15
   attiny28
/home/jason/arduino-0021/hardware/arduino/cores/arduino/WInterrupts.c:1: error: MCU ‘m328au’ supported for assembler only
/home/jason/arduino-0021/hardware/arduino/cores/arduino/WInterrupts.c: In function ‘attachInterrupt’:
/home/jason/arduino-0021/hardware/arduino/cores/arduino/WInterrupts.c:90: error: ‘EICRA’ undeclared (first use in this function)
/home/jason/arduino-0021/hardware/arduino/cores/arduino/WInterrupts.c:90: error: (Each undeclared identifier is reported only once
/home/jason/arduino-0021/hardware/arduino/cores/arduino/WInterrupts.c:90: error: for each function it appears in.)
/home/jason/arduino-0021/hardware/arduino/cores/arduino/WInterrupts.c:90: error: ‘ISC00’ undeclared (first use in this function)
/home/jason/arduino-0021/hardware/arduino/cores/arduino/WInterrupts.c:90: error: ‘ISC01’ undeclared (first use in this function)
/home/jason/arduino-0021/hardware/arduino/cores/arduino/WInterrupts.c:91: error: ‘EIMSK’ undeclared (first use in this function)
/home/jason/arduino-0021/hardware/arduino/cores/arduino/WInterrupts.c:91: error: ‘INT0’ undeclared (first use in this function)
/home/jason/arduino-0021/hardware/arduino/cores/arduino/WInterrupts.c:94: error: ‘ISC10’ undeclared (first use in this function)
/home/jason/arduino-0021/hardware/arduino/cores/arduino/WInterrupts.c:94: error: ‘ISC11’ undeclared (first use in this function)
/home/jason/arduino-0021/hardware/arduino/cores/arduino/WInterrupts.c:95: error: ‘INT1’ undeclared (first use in this function)
/home/jason/arduino-0021/hardware/arduino/cores/arduino/WInterrupts.c: In function ‘detachInterrupt’:
/home/jason/arduino-0021/hardware/arduino/cores/arduino/WInterrupts.c:135: error: ‘EIMSK’ undeclared (first use in this function)
/home/jason/arduino-0021/hardware/arduino/cores/arduino/WInterrupts.c:135: error: ‘INT0’ undeclared (first use in this function)
/home/jason/arduino-0021/hardware/arduino/cores/arduino/WInterrupts.c:138: error: ‘INT1’ undeclared (first use in this function)

I am using Arduino 0021 on a 32-bit Ubuntu 10.04 installation.

Are you sure that avrdude is looking at the correct conf file? it doesn't look like your edit is in the config that it's reading at all.

The only other nitpick is that 328 is the proper device name, 328AU does not exist. But that is entirely a cosmetic change and has no relation to your problem.

That error looks very odd as if you are missing a part of the .conf file.
Did you add an entire duplicate entry or only the portion i posted?

I only added the bit you posted, so maybe thats the problem. I will try duplicating an entire entry and replacing the relevent section with what you posted.

I duplicated the entry for ATMEGA328P, then replaced the relevant lines that you posted in avrdude.conf. Then, in boards.txt, I changed the following line:

atmega328.build.mcu=atmega328p

to

atmega328.build.mcu=m328au

and now when I try to upload, I get an error saying that the stk500 programmer is not responding.

I'm curious, where do you get the .build.mcu identifier from? At first I thought it was the "id" field of the chip you want from avrdude.conf, but when I search that file for atmega328p (the original identifier), it does not match any 'id' field, only a 'desc' field.

When to says the stk500 programmer is not responding, it means your Arduino that you have configured as an ISP. Did you load the ArduinoISP sketch on it, before changing the upload.using line? Did you add the capacitor to disable the auto reset on the Uno?

Yes, the Arduino I am using has the ArduinoISP sketch loaded onto it. I am not using the Uno - I am using a Duemilanove clone from NKC Electronics (product page). Do I still need an auto-reset capacitor?

I have been attempting to follow the official instructions here: http://arduino.cc/en/Tutorial/ArduinoToBreadboard

hmm,
haven't tried via the arduino itself as an isp for this edit.
only AVR ISP mkII and the Pocket Programmer from Spark Fun

i will try when i get home this evening

Any luck? I need to program these chips within the next couple of days :S

@h4t

yes, i was able to use the Arduino itself as an ISP.

here is the complete entry in my boards file

sparky.name=Sparky
sparky.upload.protocol=stk500
sparky.upload.maximum_size=32256
sparky.upload.speed=115200
sparky.bootloader.low_fuses=0xff
sparky.bootloader.high_fuses=0xde
sparky.bootloader.extended_fuses=0x05
sparky.bootloader.path=optiboot
sparky.bootloader.file=optiboot_atmega328.hex
sparky.bootloader.unlock_bits=0x3F
sparky.bootloader.lock_bits=0x0F
sparky.build.mcu=m328au
sparky.build.f_cpu=16000000L
sparky.build.core=arduino

notes

  1. using an Arduino Uno with the Opti Boot bootloader.
  2. successfully able to bootload the ATMEGA328-AU selecting the board above from the boards list
  3. after the success of the bootloader, when i attempt to upload a sketch i get 'm328au' is not a recognized device
  4. knowing the bootloader was successful but upload sketch failed i was able to upload a sketch by changing the board to simply Arduino UNO (go figure)
  5. this was the same on OSX Lion, Windows 7, Vista 64

hope that helps

  1. knowing the bootloader was successful but upload sketch failed i was able to upload a sketch by changing the board to simply Arduino UNO (go figure)

That makes sense to me. Once the bootloader is installed on the chip, it will report itself as a 328p chip to the IDE as the chip signature is coming from the code in the bootloader, not being read from the chip itself. Therefore the IDE must be told to use a Uno board, not the board you added stating it's a 328 chip, that was required just to allow the burn bootloader step, where the signature is being read directly from the chip. The bootloader is effectively lying to the IDE, but because the 328 and 328p are identical from a software aspect it is a innocent 'white lie'. :wink:

Lefty