So, apparantly this is a common error, which many people have fixed many different ways, none of which have worked for me.
I have two different Arduinos – an NG and an Uno, with an Atmega168 and 328 respectively. Both of these have the bootloader burnt onto them. I'm looking to burn the Arduino bootloader onto another 2 Atmega328 chips I purchased (from Digikey).
So, I set up the connections as given on the Arduino site, using the NG's 168 to program the new 328 that I put onto the Uno. It doesn't work, and running avrdude -C "path\to\avrdude.conf" -p atmega328p -b19200 -P COM5 -c avrisp -v -v -v
returns
avrdude: Version 5.11, compiled on Sep 2 2011 at 19:38:36
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "I:\Users\Collin\Documents\Arduino IDE\hardware\tools\avr
\etc\avrdude.conf"
Using Port : COM5
Using Programmer : avrisp
Overriding Baud Rate : 19200
AVR Part : ATMEGA328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : STK500
Description : Atmel AVR ISP
Hardware Version: 2
Firmware Version: 1.16
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.05s
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
Here's everything I've done. Each step resulted in the same error when running the aforementioned command.
- Thinking maybe it was an issue programming using the NG or the 168, I rearrange things so that I'm using the Uno – with a 328 – to program a 328 in the NG.
- I then try every permutation of board and chip.
- Thinking that maybe I had bricked one chip with all the shuffling, I tried a different (new) 328.
- Thinking maybe both had arrived DOA, I tried with my known-good 168 chip.
- Tried it with the known-good 328 ship.
- Thinking that I had just wasted an hour when one of the wires I was using was intermittent, but they all tested good, and swapping them out with others made no difference.
- Thinking maybe there was something wrong with one of my boards, I dropped a fresh 328 onto a breadboard and set it up as instructed, using the Uno+328 to program.
- Tried the same with the NG and 168 as ISP.
- Tried different programmer settings (
-c arduino
,avrisp
,stk500
) - Tried various settings of
-B ###
with avrdude - Tried lots of the above on a Mac and a PC
- Tried using an external 5V source
- Tried adafruit's fork of ArduinoISP
- Tried optiloader loaded onto either board – got non-descriptive error
0x0
- When programming with the Uno, pulled the reset pin high (165 ohms)
- When programming with the Uno, attached a 100uF capacitor between ground and reset
I know at least some connection is being made between the two chips as, when programming with the Uno against the NG, if I don't hold the Digital 10/Reset pin to pin 1 of the target chip, I get a stk500_disable(): protocol error, expect=0x14, resp=0x51
error. And yes, at the end of this both original chips are still working fine, so I don't think I've messed either up them up despite all of this.
Here's a picture of one of my setups – yes, the yellow wire is indeed to reset, not 3v3. Lower NG board is supposed to be programming the chip in the upper Uno.
Best Answer
The only thing that worked for me was to follow this tutorial: http://3g1l.com/blog-burn-bootloader-blank-atmega328atmega328p-arduino-uno
One very important note: Even though the tutorial concentrates on the minimal setup, for some chips (depending on the supplier) it works ONLY WHEN you add the external oscillator and the two 22pC.
The tutorial also shows a 10k resistor between reset and 5V rail. The missing components might make your setup(the one from your picture) work too. Many users stated in their comments that they got the exact same error as you until they added the oscillator: this might be it!!!
Hope it helps - I struggled for a day before finding this