Author Topic: avrdude: Yikes! Invalid device signature - Is My 328P Dead??  (Read 2067 times)

0 Members and 1 Guest are viewing this topic.

Offline paul_g_787Topic starter

  • Frequent Contributor
  • **
  • Posts: 489
  • Country: gb
avrdude: Yikes! Invalid device signature - Is My 328P Dead??
« on: March 31, 2021, 06:56:49 pm »
Hi. I am rather new to microcontrollers so hoping I can get some help here.

I have a few Atmel 328P-PU Microcontrollers which I have been programming using an Arduino Uno as ISP.

However one of the 328's suddenly will not accept any Sketches uploaded to it, I just get: avrdude: Yikes!  Invalid device signature.
It is only on the one chip I have this error. Other 328P's work fine!!

So I thought it could be a fuse set wrong? Although My knowledge on this is very limited and this is just a guess.

I tried to view the fuses using AVRDude but I still get the error. I tried adding -F but the fuses all return the value 0.
(See below outputs from AVRDude).

I should add that the 328P has a 16MHz external clock connected.

Has the chip just gone to electronics heaven or is this a software issue that can be resolved??

Can anyone shed some light on this please? Thank you  :-+

This is the bad Chip
Code: [Select]
avrdude -C/snap/arduino/50/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -P/dev/ttyUSB0 -b19200 -U lfuse:r:-:i -v

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/snap/arduino/50/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/home/paul/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : stk500v1
         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
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel STK500 Version 1.x firmware
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         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.04s

avrdude: Device signature = 0x000000 (retrying)

Reading | ################################################## | 100% 0.05s

avrdude: Device signature = 0x000000 (retrying)

Reading | ################################################## | 100% 0.04s

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.

I tried adding -F
Code: [Select]
avrdude -C/snap/arduino/50/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -P/dev/ttyUSB0 -b19200 -U lfuse:r:-:i -v -F

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/snap/arduino/50/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/home/paul/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : stk500v1
         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
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel STK500 Version 1.x firmware
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         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.04s

avrdude: Device signature = 0x000000 (retrying)

Reading | ################################################## | 100% 0.05s

avrdude: Device signature = 0x000000 (retrying)

Reading | ################################################## | 100% 0.04s

avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATmega328P is 1E 95 0F
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: reading lfuse memory:

Reading | ################################################## | 100% 0.02s

avrdude: writing output file "<stdout>"
:0100000000FF
:00000001FF

avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK (E:00, H:00, L:00)

avrdude done.  Thank you.

This is the output from a good 328P which has been flashed with the Arduino Uno Bootloader
Code: [Select]
avrdude -C/snap/arduino/50/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -P/dev/ttyUSB0 -b19200 -U lfuse:r:-:i -v

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/snap/arduino/50/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/home/paul/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : stk500v1
         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
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel STK500 Version 1.x firmware
         Hardware Version: 2
         Firmware Version: 1.18
         Topcard         : Unknown
         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.04s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DE
avrdude: safemode: efuse reads as FD
avrdude: reading lfuse memory:

Reading | ################################################## | 100% 0.02s

avrdude: writing output file "<stdout>"
:01000000FF00
:00000001FF

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DE
avrdude: safemode: efuse reads as FD
avrdude: safemode: Fuses OK (E:FD, H:DE, L:FF)

avrdude done.  Thank you.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21681
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: avrdude: Yikes! Invalid device signature - Is My 328P Dead??
« Reply #1 on: March 31, 2021, 10:47:52 pm »
Well, it's not just wrong, but it's dead: all zeroes.  A hint it may be a physical error.  Is the programmer making connection?  Was the port disabled in FUSES?  You may need to use a different port e.g. JTAG vs. ISP, or if completely locked, HV erase.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline Syntax Error

  • Frequent Contributor
  • **
  • Posts: 584
  • Country: gb
Re: avrdude: Yikes! Invalid device signature - Is My 328P Dead??
« Reply #2 on: March 31, 2021, 11:56:21 pm »
Tricky. AVRDUDE is good when it connects but, an Invalid device signature does not necessarily mean the 328 has gone to Silicon Heaven.
How are you flashing the 328; direct over SPI ( mosi, miso, sck ) or using the bootloader over serial ( tx rx )? Check the physical continuity.
A common issue is you may be fused with the wrong clock settings; a default internal clock of 1MHz may be running. Try reducing the baud rate to -b9600 in your string and see if that connects.

Fuse value calculator: http://www.engbedded.com/fusecalc/
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: avrdude: Yikes! Invalid device signature - Is My 328P Dead??
« Reply #3 on: April 01, 2021, 12:59:10 am »
The first thing I'd try is supplying an external clock source. One of the serious design flaws in the 8 bit AVR series is relying on a clock in order for the part to be programmed. If you set it to use an external clock and don't have one connected it will appear dead as a doornail. It's really annoying when that happens with a surface mount IC that is mounted on a PCB, I've had a loose connection to the programmer corrupt those fuse settings.
 

Offline ledtester

  • Super Contributor
  • ***
  • Posts: 3036
  • Country: us
Re: avrdude: Yikes! Invalid device signature - Is My 328P Dead??
« Reply #4 on: April 01, 2021, 01:14:49 am »
This looks suspicious:

Quote
I should add that the 328P has a 16MHz external clock connected.
...
         SCK period      : 0.1 us

I think your SCK period needs to be greater than 4 times the clock period. Make the SCK period longer (even like 10 or 100 us) and see if that helps.
 

Offline paul_g_787Topic starter

  • Frequent Contributor
  • **
  • Posts: 489
  • Country: gb
Re: avrdude: Yikes! Invalid device signature - Is My 328P Dead??
« Reply #5 on: April 01, 2021, 01:46:11 pm »
Well, it's not just wrong, but it's dead: all zeroes.  A hint it may be a physical error.  Is the programmer making connection?  Was the port disabled in FUSES?  You may need to use a different port e.g. JTAG vs. ISP, or if completely locked, HV erase.

Tim

I seem to remember that at the time it stopped working, when I was just using an arduino and a breadboard, the chip was not making a good connection. Perhaps this is why the fuses are showing as all zeros? And maybe I need to just reset the fuses back to default again.

Now I use a home-made shield for arduino with a ZIF socket for programming my AVR chips, make a much better connection.

I did not know there was another way of programming these other than ISP.
« Last Edit: April 01, 2021, 02:50:32 pm by paul_g_787 »
 

Online ajb

  • Super Contributor
  • ***
  • Posts: 2603
  • Country: us
Re: avrdude: Yikes! Invalid device signature - Is My 328P Dead??
« Reply #6 on: April 01, 2021, 04:17:49 pm »
It's possible that a previous poor connection during programming caused the wrong command to be sent corrupting the fuse settings or something. IIRC there are some undocumented programming commands that can do things the normal commands can't, so who know what may have happened.  It's also possible that a poor connection on a power line caused something in the chip to be electrically damaged. Slowing down the programming speed as others have mentioned may be a good first step, if the clock fuses are set to provide a lower frequency the chip may just not be able to handle the programming speed the programmer is using.

If it's a fuse problem, your only option to recover the part may be to use the high voltage parallel programming mode.  This is normally used in situations where the reset input is disabled so it can be used as an extra GPIO, but can also be useful in recovering from bad fuse settings.  However, this requires special hardware to provide the higher voltage, so it's probably not worth getting into compared to just buying a new chip. 

Atmel used to sell a relatively low cost device called the AVR Dragon that could do basically all of the Atmel program/debug protocols (except maybe TPI and UPDI which are newer I think?), including the high voltage ones, but it was pretty unreliable and prone to blowing itself up, and has since been discontinued.  There's probably a few projects out there showing how to hack something together for HVPP if you felt like going to that much trouble.
 

Offline paul_g_787Topic starter

  • Frequent Contributor
  • **
  • Posts: 489
  • Country: gb
Re: avrdude: Yikes! Invalid device signature - Is My 328P Dead??
« Reply #7 on: April 03, 2021, 07:41:46 am »
This is perhaps either going to be a good learning experience or a waste of time. Either way I may as well give the HV programming a go for the fun of it.

I found this:
https://forum.arduino.cc/index.php?topic=577726.0

I might give building that a go and see what happens.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf