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.
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
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.
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 ?
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.
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.
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...
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
p.
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.