Unable to program brand new '328P chips

Just taken delivery of two ATMEGA328P-PU chips, and I'm trying to program them.

avrdude: Yikes!  Invalid device signature.
         Double check connections and try again, or use -F to override
         this check.

Using ArduinoISP, host board is an UNO. Programming via home made ISP shield.

I know the shield / code / programmer etc works fine, as I can burn the bootloader to a '328P-PU lifted from another UNO board. Have Atmel changed the device IDs in brand new '328P chips or something?

The non-working chips are both from batch code 1218.

More digging:

Good chip:

avrdude -pm328p -C ~/arduino-1.0.1/hardware/tools/avrdude.conf -c avrisp -P /dev/ttyACM0 -b 19200

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.06s

avrdude: Device signature = 0x1e950f

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

Bad chip:

avrdude -pm328p -C ~/arduino-1.0.1/hardware/tools/avrdude.conf -c avrisp -P /dev/ttyACM0 -b 19200

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.06s

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.

Are these chips toast? Is there anything more I can do to test them?

Your 'bad' chips might have the wrong fuses.
In some cases you must use high-voltage programming to reach the chip again.
Or a fuse for an invalid clock options is selected.

To test a chip you could do this:
avrdude -p m328p -c avrisp -P /dev/ttyACM0 -vvv

avrdude: Version 5.11, compiled on Sep  7 2011 at 19:34:16
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/home/matt/arduino-1.0.1/hardware/tools/avrdude.conf"
         User configuration file is "/home/matt/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         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.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.06s

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'm not sure exactly what I am seeing there, but it looks to me like all the fuses are being read as 0x00. If that is right, then all the options are on, including SPI program downloading.

Your programmer seems okay (you knew that already).
But you don't have any communication with the 'bad' chip (you knew that also).

You don't know what the fuses are, since there is no communication.
You probably have a 'bricked' chip.

Unbricking is done by either supplying a clock signal to the clock input, or with high-voltage programming.

Krodal:
Your programmer seems okay (you knew that already).
But you don't have any communication with the 'bad' chip (you knew that also).

You don't know what the fuses are, since there is no communication.
You probably have a 'bricked' chip.

Unbricking is done by either supplying a clock signal to the clock input, or with high-voltage programming.

Well, these chips are brand new - arrived in the post this morning from Farnell. I am tempted to send them back for a replacement, but I don't want to do that if the next ones are the same.

I don't have a high voltage programmer, but a clock is possible - tell me more. I have a 16MHz crystal on the board already (my ISP shield also has an ADM232 chip and DB9 for sketch uploading), which I know works as I have uploaded the good ol' blinky sketch to a known good chip on this board, but if I need to generate an external clock then I can do that. What frequency? What pin? Does it need to be synchronous with the programming communication?

If they are new, they can not be bricked.
The ATmega328P-PU is the most common AVR chip there is. It will also work with lower voltages.

I have a oscillator of a few megaherz for this.
Or you could make a program, that just toggles a pin.
And use that signal for a clock for the 'bad' chip.

The datasheet says: "PB6 can be used as input to the inverting Oscillator amplifier and input to the internal clock operating circuit."
So you can feed the clock signal to PB6.

But then again: if they are new, they can not be bricked.
Is it possible that you programmed then, by placing it in your programmer ?
Can you try another programmer? or other USB-bus, or other version of avrdude ?

For now, it's a complete mystery for me.

Krodal:
If they are new, they can not be bricked.
The ATmega328P-PU is the most common AVR chip there is. It will also work with lower voltages.

I have a oscillator of a few megaherz for this.
Or you could make a program, that just toggles a pin.
And use that signal for a clock for the 'bad' chip.

The datasheet says: "PB6 can be used as input to the inverting Oscillator amplifier and input to the internal clock operating circuit."
So you can feed the clock signal to PB6.

But then again: if they are new, they can not be bricked.
Is it possible that you programmed then, by placing it in your programmer ?
Can you try another programmer? or other USB-bus, or other version of avrdude ?

For now, it's a complete mystery for me.

The only way that they can have been programmed is if avrdude programmed them regardless of the mismatch of the device id.

The avrdude version I am running is the one bundled with the 1.0.1 IDE.

The only way that they can have been programmed is if avrdude programmed them regardless of the mismatch of the device id.

Not possible. Avrdude has enough checks.

The avrdude version I am running is the one bundled with the 1.0.1 IDE.

That's good, I can't find that there is a problem with it.

Mystery continues...

Stupid question, but I'll ask anyway. You're absolutely sure they are the correct chip? 328P-PU and not plain 328-PUs or something else? I usually have to put them under a magnifier. But you read the date code, so you probably also verified the part number :~

Exceedingly small chance that a new chip would be bricked, let alone two of them.

Your second post has me baffled. I assume that the only change between the "Good chip" part and the "Bad chip" part is that one chip has been exchanged for another?

Yep, verified the part number. I decided upon the p version instead of the non-p after a discussion in here. I have exceedingly good eyesight.

Exceedingly small chance that a new chip would be bricked, let alone two of them.

I know, that's why I'm so confused and not just RMA'ing them straight away.

Your second post has me baffled. I assume that the only change between the "Good chip" part and the "Bad chip" part is that one chip has been exchanged for another?

Yep. Remove ISP shield, remove bad chip, insert good chip, re-attach ISP shield, run avrdude command. I wish I had a high-voltage programmer, then I could really test them. If I were to invest in one, what would be my best bet? I don't have lots of cash, so cheap, but I want it to work. It would have to work in Linux too, so avrdude compatible would be best.

You could test the signatures with my sketch described here:

You just need to hook up a couple of wires (Gnd, +5V), add a couple of decoupling capacitors, and run the SPI wires as shown.

The chip might need a clock source, but I describe how supply one, using another Arduino, here:

I think the default for new chips is to run from the internal oscillator, but perhaps at 1 MHz and not 8 MHz.

You could try adding -B250 to the AVRdude command line to slow down communications.

Ahhh, so I figured. My eyes aren't nearly long enough any more :smiley:

Don't know much about HV programmers, but did stumble across this recently, might be worth having a look:

I'd like to try one of those chips, too bad you're not closer.

Hmmm... That has schematics. I might have a go at making one of those - seems simple enough.

Fresh ATmega328P chips have their fuses set to run the CPU at 1MHz, using the internal on-chip oscillator. And the SPI interface used for serial programming needs the SCK frequency to be less than F-CPU/4 = 250kHz.

I'm not sure ArduinoISP takes any notice of the avrdude -B flag, but it it runs the SPI clock at 16MHz/128 = 125kHz so that ought to be ok...

for program the chip you use terminal or arduino ide?
hi niko

nikone:
for program the chip you use terminal or arduino ide?
hi niko

Either. They both give the same result.

I have to use ie -B 1200 for programming new chip's fuses to the external crystal mode (they are set to 1MHz internal clock and therefore very slow programming clock), otherwise no luck.. (and not only the 328p, but all atmega chips I would say).. Only flash new fuses with that speed (I am using usbasp programmer), it takes few seconds. Do not use it with flash programming as it takes ages then :slight_smile:
p.

Ooooh... worth a try...

Hmmm... No go...

If I change the avrdude command's baud rate, then it can't communicate with the ArduinoISP sketch as that runs at 19200. If I change the ArduinoISP sketch to match, then it is exactly the same as before.

However, you might be on to something anyway. I will look at slowing down the ArduinoISP's communication with the chip if it's possible.


It's already running at Fosc/128, so that's the slowest it will go. Hmmm... tricky...

Is it possible to switch oscillators on the fly on an Atmel chip? If I could switch my running Arduino to a lower speed it might compensate. I don't want to brick this good chip by playing with fuses though.