avrdude: Yikes!  Invalid device signature - Is My 328P Dead?? - Page 1
Forum section: electronics / general

author: paul_g_787
author_rank: Frequent Contributor
timestamp: March 31, 2021, 06:56:49 pm
content: 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 youThis is the bad ChipCode:avrdude -C/snap/arduino/50/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -P/dev/ttyUSB0 -b19200 -U lfuse:r:-:i -vavrdude: Version 6.3-20190619Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/Copyright (c) 2007-2014 Joerg WunschSystem 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, skippingUsing Port : /dev/ttyUSB0Using Programmer : stk500v1Overriding Baud Rate : 19200AVR Part : ATmega328PChip Erase delay : 9000 usPAGEL : PD7BS2 : PC2RESET disposition : dedicatedRETRY pulse : SCKserial program mode : yesparallel program mode : yesTimeout : 200StabDelay : 100CmdexeDelay : 25SyncLoops : 32ByteDelay : 0PollIndex : 3PollValue : 0x53Memory Detail :Block Poll Page PolledMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xffflash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xfflfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00Programmer Type : STK500Description : Atmel STK500 Version 1.x firmwareHardware Version: 2Firmware Version: 1.18Topcard : UnknownVtarget : 0.0 VVaref : 0.0 VOscillator : OffSCK period : 0.1 usavrdude: AVR device initialized and ready to accept instructionsReading | ################################################## | 100% 0.04savrdude: Device signature = 0x000000 (retrying)Reading | ################################################## | 100% 0.05savrdude: Device signature = 0x000000 (retrying)Reading | ################################################## | 100% 0.04savrdude: Device signature = 0x000000avrdude: Yikes! Invalid device signature.Double check connections and try again, or use -F to overridethis check.avrdude done. Thank you.I tried adding -FCode:avrdude -C/snap/arduino/50/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -P/dev/ttyUSB0 -b19200 -U lfuse:r:-:i -v -Favrdude: Version 6.3-20190619Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/Copyright (c) 2007-2014 Joerg WunschSystem 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, skippingUsing Port : /dev/ttyUSB0Using Programmer : stk500v1Overriding Baud Rate : 19200AVR Part : ATmega328PChip Erase delay : 9000 usPAGEL : PD7BS2 : PC2RESET disposition : dedicatedRETRY pulse : SCKserial program mode : yesparallel program mode : yesTimeout : 200StabDelay : 100CmdexeDelay : 25SyncLoops : 32ByteDelay : 0PollIndex : 3PollValue : 0x53Memory Detail :Block Poll Page PolledMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xffflash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xfflfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00Programmer Type : STK500Description : Atmel STK500 Version 1.x firmwareHardware Version: 2Firmware Version: 1.18Topcard : UnknownVtarget : 0.0 VVaref : 0.0 VOscillator : OffSCK period : 0.1 usavrdude: AVR device initialized and ready to accept instructionsReading | ################################################## | 100% 0.04savrdude: Device signature = 0x000000 (retrying)Reading | ################################################## | 100% 0.05savrdude: Device signature = 0x000000 (retrying)Reading | ################################################## | 100% 0.04savrdude: Device signature = 0x000000avrdude: Yikes! Invalid device signature.avrdude: Expected signature for ATmega328P is 1E 95 0Favrdude: safemode: lfuse reads as 0avrdude: safemode: hfuse reads as 0avrdude: safemode: efuse reads as 0avrdude: reading lfuse memory:Reading | ################################################## | 100% 0.02savrdude: writing output file "<stdout>":0100000000FF:00000001FFavrdude: safemode: lfuse reads as 0avrdude: safemode: hfuse reads as 0avrdude: safemode: efuse reads as 0avrdude: 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 BootloaderCode:avrdude -C/snap/arduino/50/hardware/tools/avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -P/dev/ttyUSB0 -b19200 -U lfuse:r:-:i -vavrdude: Version 6.3-20190619Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/Copyright (c) 2007-2014 Joerg WunschSystem 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, skippingUsing Port : /dev/ttyUSB0Using Programmer : stk500v1Overriding Baud Rate : 19200AVR Part : ATmega328PChip Erase delay : 9000 usPAGEL : PD7BS2 : PC2RESET disposition : dedicatedRETRY pulse : SCKserial program mode : yesparallel program mode : yesTimeout : 200StabDelay : 100CmdexeDelay : 25SyncLoops : 32ByteDelay : 0PollIndex : 3PollValue : 0x53Memory Detail :Block Poll Page PolledMemory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xffflash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xfflfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00Programmer Type : STK500Description : Atmel STK500 Version 1.x firmwareHardware Version: 2Firmware Version: 1.18Topcard : UnknownVtarget : 0.0 VVaref : 0.0 VOscillator : OffSCK period : 0.1 usavrdude: AVR device initialized and ready to accept instructionsReading | ################################################## | 100% 0.04savrdude: Device signature = 0x1e950f (probably m328p)avrdude: safemode: lfuse reads as FFavrdude: safemode: hfuse reads as DEavrdude: safemode: efuse reads as FDavrdude: reading lfuse memory:Reading | ################################################## | 100% 0.02savrdude: writing output file "<stdout>":01000000FF00:00000001FFavrdude: safemode: lfuse reads as FFavrdude: safemode: hfuse reads as DEavrdude: safemode: efuse reads as FDavrdude: safemode: Fuses OK (E:FD, H:DE, L:FF)avrdude done. Thank you.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: March 31, 2021, 10:47:52 pm
content: 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

author: Syntax Error
author_rank: Frequent Contributor
timestamp: March 31, 2021, 11:56:21 pm
content: 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/

author: james_s
author_rank: Super Contributor
timestamp: April 01, 2021, 12:59:10 am
content: 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.

author: ledtester
author_rank: Super Contributor
timestamp: April 01, 2021, 01:14:49 am
content: This looks suspicious:QuoteI 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.

author: paul_g_787
author_rank: Frequent Contributor
timestamp: April 01, 2021, 01:46:11 pm
content: Quote from: T3sl4co1l on March 31, 2021, 10:47:52 pmI 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.

author: ajb
author_rank: Super Contributor
timestamp: April 01, 2021, 04:17:49 pm
content: 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.

author: paul_g_787
author_rank: Frequent Contributor
timestamp: April 03, 2021, 07:41:46 am
content: 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.0I might give building that a go and see what happens.