Pages: [1] 2 3 4   Go Down
Author Topic: Unable to program brand new '328P chips  (Read 4386 times)
0 Members and 1 Guest are viewing this topic.
UK
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3969
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
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.
« Last Edit: June 16, 2012, 07:55:41 am by majenko » Logged

Why not visit my eBay shop? http://stores.ebay.co.uk/Majenko-Technologies
Replacement for the Arduino IDE: UECIDE - Proper serial terminal, graphing facilities, plugins, overhauled internals.
Java isn't bad in itself, but it has enabled morons to write programs.

UK
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3969
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

More digging:

Good chip:
Code:
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:

Code:
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?

« Last Edit: June 16, 2012, 07:58:15 am by majenko » Logged

Why not visit my eBay shop? http://stores.ebay.co.uk/Majenko-Technologies
Replacement for the Arduino IDE: UECIDE - Proper serial terminal, graphing facilities, plugins, overhauled internals.
Java isn't bad in itself, but it has enabled morons to write programs.

Offline Offline
Edison Member
*
Karma: 9
Posts: 1010
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

UK
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3969
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
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.
Logged

Why not visit my eBay shop? http://stores.ebay.co.uk/Majenko-Technologies
Replacement for the Arduino IDE: UECIDE - Proper serial terminal, graphing facilities, plugins, overhauled internals.
Java isn't bad in itself, but it has enabled morons to write programs.

Offline Offline
Edison Member
*
Karma: 9
Posts: 1010
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

UK
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3969
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Why not visit my eBay shop? http://stores.ebay.co.uk/Majenko-Technologies
Replacement for the Arduino IDE: UECIDE - Proper serial terminal, graphing facilities, plugins, overhauled internals.
Java isn't bad in itself, but it has enabled morons to write programs.

Offline Offline
Edison Member
*
Karma: 9
Posts: 1010
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

UK
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3969
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Why not visit my eBay shop? http://stores.ebay.co.uk/Majenko-Technologies
Replacement for the Arduino IDE: UECIDE - Proper serial terminal, graphing facilities, plugins, overhauled internals.
Java isn't bad in itself, but it has enabled morons to write programs.

Offline Offline
Edison Member
*
Karma: 9
Posts: 1010
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.

Quote
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...
Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 71
Posts: 3510
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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  smiley-confuse

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?
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

UK
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3969
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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  smiley-confuse
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.

Quote
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.

Quote
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.
Logged

Why not visit my eBay shop? http://stores.ebay.co.uk/Majenko-Technologies
Replacement for the Arduino IDE: UECIDE - Proper serial terminal, graphing facilities, plugins, overhauled internals.
Java isn't bad in itself, but it has enabled morons to write programs.

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You could test the signatures with my sketch described here:

http://www.gammon.com.au/forum/?id=11633

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:

http://www.gammon.com.au/forum/?id=11637

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.
Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 71
Posts: 3510
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Don't know much about HV programmers, but did stumble across this recently, might be worth having a look:
http://mightyohm.com/blog/products/

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

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

UK
Offline Offline
Faraday Member
**
Karma: 92
Posts: 3969
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Why not visit my eBay shop? http://stores.ebay.co.uk/Majenko-Technologies
Replacement for the Arduino IDE: UECIDE - Proper serial terminal, graphing facilities, plugins, overhauled internals.
Java isn't bad in itself, but it has enabled morons to write programs.

Switzerland
Offline Offline
Sr. Member
****
Karma: 6
Posts: 375
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

Pages: [1] 2 3 4   Go Up
Jump to: