Bootloader failure wrong device signature

System: Mac IDE 0022 Programmer: USBasp Board: EMSL Diavolino with 328P avrdude 5.8cvs

I'm trying to upload a bootloader to a new virgin 328p. I've added the USBasp device to my programmers.txt file.

When I tell the IDE to burn the bootloader I get an error about device signature.

If I unplug the usbasp programmer from the computer then plug it back in and run avrdude -c usbasp -p m328p from a console window everything looks fine. Run the same command again and I get the device signature error. Unplug and repeat, same deal.

Here's the output on the console:

MacBook:arduino testing$ avrdude -c usbasp -p m328p

avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

MacBook:arduino testing$ avrdude -c usbasp -p m328p

avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x000102
avrdude: Expected signature for ATMEGA328P is 1E 95 0F
         Double check chip, or use -F to override this check.

avrdude done.  Thank you.

This is the same error I get from the Arduino IDE.

I'm still very new to the Arduino so I'm pretty much stumped. An hour or so of Googleing has not been any help.

Ideas??

What changes did you make to boards.txt? Which board did you select in the IDE?

Basically I copied the Duemilanove w/328 entry, renamed all the lines from atmega328 to atmega328p and changed the upload protocol to usbasp.

I then selected that board in the IDE prior to attempting a burn.

##############################################################

atmega328p.name=ATmega328 USBasp

atmega328p.upload.protocol=usbasp
atmega328p.upload.maximum_size=30720
atmega328p.upload.speed=57600

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

atmega328p.build.mcu=atmega328p
atmega328p.build.f_cpu=16000000L
atmega328p.build.core=arduino

##############################################################
avrdude -c usbasp -p m328p -v -v -v

...run it twice. We're after the fuse settings (first run) and an idea of when exactly the failure happens (second run).

Here’s the output from this on my linux box: (it gives the same error as on my Mac)

(This is the first run of the command. Second in next post as it’s too long for one post)

twmaster@Penguin:~$ sudo avrdude -c usbasp -p m328p -v -v -v
[sudo] password for twmaster: 

avrdude: Version 5.10, compiled on Jun 29 2010 at 21:09:48
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/home/twmaster/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/parport0
         Using Programmer              : usbasp
avrdude: seen device from vendor ->www.fischl.de<-
avrdude: seen product ->USBasp<-
         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     5     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 : usbasp
         Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude: safemode read 1, lfuse value: ff
avrdude: safemode read 2, lfuse value: ff
avrdude: safemode read 3, lfuse value: ff
avrdude: safemode: lfuse reads as FF
avrdude: safemode read 1, hfuse value: da
avrdude: safemode read 2, hfuse value: da
avrdude: safemode read 3, hfuse value: da
avrdude: safemode: hfuse reads as DA
avrdude: safemode read 1, efuse value: 5
avrdude: safemode read 2, efuse value: 5
avrdude: safemode read 3, efuse value: 5
avrdude: safemode: efuse reads as 5

avrdude: safemode read 1, lfuse value: ff
avrdude: safemode read 2, lfuse value: ff
avrdude: safemode read 3, lfuse value: ff
avrdude: safemode: lfuse reads as FF
avrdude: safemode read 1, hfuse value: da
avrdude: safemode read 2, hfuse value: da
avrdude: safemode read 3, hfuse value: da
avrdude: safemode: hfuse reads as DA
avrdude: safemode read 1, efuse value: 5
avrdude: safemode read 2, efuse value: 5
avrdude: safemode read 3, efuse value: 5
avrdude: safemode: efuse reads as 5
avrdude: safemode: Fuses OK

avrdude done.  Thank you.

Ok, second run of the program:

twmaster@Penguin:~$ sudo avrdude -c usbasp -p m328p -v -v -v

avrdude: Version 5.10, compiled on Jun 29 2010 at 21:09:48
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/home/twmaster/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/parport0
         Using Programmer              : usbasp
avrdude: seen device from vendor ->www.fischl.de<-
avrdude: seen product ->USBasp<-
         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     5     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 : usbasp
         Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x000102
avrdude: Expected signature for ATMEGA328P is 1E 95 0F
         Double check chip, or use -F to override this check.

avrdude done.  Thank you.

Do you have an 8+ MHz crystal connect to the target processor?

16MHZ on the target board. It's a Duemilanove clone.

Also, if this matters... The USBasp board I'm using has a mega8L onboard.

I wonder if some sort of reset is somehow causing avrdude to see the mega8 instead??

Good theory! Unfortunately, that isn’t the case…

avrdude: Device signature = 0x000102

For the ATmega8 the signature bytes are:

  1. 0x000: 0x1E (indicates manufactured by Atmel).
  2. 0x001: 0x93 (indicates 8KB Flash memory).
  3. 0x002: 0x07 (indicates ATmega8 device).

… 0x1E9307 != 0x000102

Maybe you have it backwards. Maybe the programmer is not being reset between runs. Maybe the “0x000102” is something leftover from the previous run. I assume the USBasp has some sort of serial-to-TTL converter on it. Normally, when an Arduino serial port is opened, DTR is fiddled to reset the board. Is this also true of a USBasp? Is it supposed to be reset by something like DTR?

How are you powering the target?

Sidebar: How did you get a processor with no markings?

Alrighty then....

The USBasp is from this design: http://www.fischl.de/usbasp/

It does not have any TTL to serial conversions on the thing. Some resistors and diodes connect from the USB to the AVR on the asp board.

No idea if it is supposed to be reset by twiddling anything via serial commands.

The USBasp and the Diavolino are powered off the USB port. Although there is a jumper to disable power to the target board.

And the 328 has markings. Look closer at the pic. And, yea, they are as hard to read in person as in the photo.

I should add that I now have a bootloader on the AVR. I used a Seeeduino as an ArduinoISP.

What a mystery...

avrdude: Device signature = 0x000102

That might be the key...

http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=74739&start=0

http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=52971&start=0

http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=167745

...seems to be a symptom of a hardware problem. Try powering the board independently from the programmer.

http://www.google.com/search?q=avrdude%3A+Device+signature+%3D+0x000102

One step forward, one step backwards... Wheeeeeee!

It appears I have solved the problem leading to the device signature error.

Miss wired 10 pin to 6 pin ISP cable. You all may strike me with a clue bat at will.

I've rewired and double checked. It now works every time on both my Linux workstation and MacBook. At least it works with the commands as above.

I really need to find an avrdude for utter morons tutorial.

I still cannot burn a boot loader from the IDE with this usbasp programmer on either system yet. And I seem to have somehow bricked my new 328P...

I'll pick up the fight tomorrow. It's late. I'm tired and grumpy.

Thanks for taking the time to help.