4
\$\begingroup\$

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.

Arduino to Arduino

\$\endgroup\$
  • \$\begingroup\$ Do you have a picture of your setup? The message basically says it is trying to read the device that needs to be programmed, but it doesn't receive data from it. It sometimes happens to me too when I accidentally pull Vcc off the chip. \$\endgroup\$ – jippie Apr 5 '13 at 5:50
  • \$\begingroup\$ What version IDE are you using and which version ArduinoISP? \$\endgroup\$ – jippie Apr 5 '13 at 16:50
  • \$\begingroup\$ Just added a picture. I'm using 1.0.4, with whatever edition of ArduinoISP that's bundled with it - 04m3 \$\endgroup\$ – cpf Apr 5 '13 at 17:30
  • \$\begingroup\$ Where proposed resistor or capacitor? \$\endgroup\$ – jippie Apr 5 '13 at 18:47
  • 1
    \$\begingroup\$ @cpf You might get interactive inputs from several experts or merely experienced folks on the Electronics StackExchange chat... May help in sorting out the issue. \$\endgroup\$ – Anindo Ghosh Apr 5 '13 at 19:09
3
\$\begingroup\$

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

\$\endgroup\$
1
\$\begingroup\$

For me it was the version of the arduino UNO that made a difference. I've tried with a more recent one and everything is fine now.

\$\endgroup\$
  • \$\begingroup\$ I don't have a new question. And for me it provides a good answer, as the board model seems to be important. \$\endgroup\$ – hachpai Sep 30 '15 at 14:57
0
\$\begingroup\$

Couple of other things that could be going wrong with it:

  • This person also had trouble with the reset line. A different sketch to program via Uno is recommended. Hopefully it's just the reset line on the Uno, but if it isn't...
  • That page reminded me that most bootloaders set the fuses on the target chips in such a way that they no longer function without the external crystal (plus the two small caps to ground from the lines to the crystal). So if you ever successfully started to upload, you have likely set your fuses for external crystal, which just means you'll have to aquire a 8/10/16/20 crystal plus some small caps to resuscitate your ATmegas. This does not apply to the ATmegas when they are in NG or Uno, but the NG is problematic anyway in that the RESET line is not easily accessible.
\$\endgroup\$
0
\$\begingroup\$

The line "avrdude: AVR device initialized and ready to accept instructions” actually demonstrates that at least your first SPI transaction completed successfully.

Something that could help diagnose the problem is the output log if you pass -v -v -v -v to avrdude. You could also pass the -t -F option to avrdude and poke around a bit (e.g. to see what the fuses read as). Don’t try any modifications when operating with -F, though.

\$\endgroup\$
0
\$\begingroup\$

The ATmega328 and the ATmega328P are not the same thing - they are actually slightly different, so if you're using the wrong one it'll fail the signature check.

When you call avrdude, change the target-chip type to match the actual chip type you're using. :)

\$\endgroup\$
  • 2
    \$\begingroup\$ That is true, but clearly not the issue here, as the signature is reading back 0, rather than the signature of the wrong part. \$\endgroup\$ – Chris Stratton Oct 24 '13 at 14:41
0
\$\begingroup\$

I had the same issue when using Arduino ISP to reburn Arduino bootloader into a Nano board (also m328p). However, there was another application in it (AmForth). Although avrdude complained about invalid signature 0x000000, the chip was working normally (I just wanted to reflash it back to Arduino).

There was no possibility to get through with Arduino ISP. Luckily I had a USBasp in my drawer and with this programmer everything worked normally, absolutely no problem.

What puzzles me is that USBasp itself is based on AVR chip, so I don't know exactly what is wrong with the Arduino sketch. Perhaps the overhead in Wiring in the Arduino ISP breaks the timing, while in USBasp there is a normal program written in assembler and hence no overhead and unnecessary time delays.

The basic precondition of success is that fuses are not blown wrong (i.e. no external clock settings).

\$\endgroup\$
  • 4
    \$\begingroup\$ This whole discussion should be occurring on Arduino.SE, but unfortunately, this question is far too old to migrate now. \$\endgroup\$ – Dave Tweed Sep 21 '15 at 14:17
0
\$\begingroup\$

Okay. if you are getting a signature verification error, you need to the signature of 328p in avrdude.conf file and fool the arduino IDE so that it uploads the bootloader onto the barebones 328p.

Try doing the connections given(look at the last picture with external oscillator and caps) on the ArduinoISP page

I'll edit the answer with pictures later.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.