Arduino Forum

Using Arduino => Microcontrollers => Topic started by: majenko on Jun 16, 2012, 02:42 pm

Title: Unable to program brand new '328P chips
Post by: majenko on Jun 16, 2012, 02:42 pm
Just taken delivery of two ATMEGA328P-PU chips, and I'm trying to program them.

Code: [Select]

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.
Title: Re: Unable to program brand new '328P chips
Post by: majenko on Jun 16, 2012, 02:55 pm
More digging:

Good chip:
Code: [Select]

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: [Select]
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?

Title: Re: Unable to program brand new '328P chips
Post by: Krodal on Jun 16, 2012, 03:23 pm
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
Title: Re: Unable to program brand new '328P chips
Post by: majenko on Jun 16, 2012, 04:24 pm
Code: [Select]

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.
Title: Re: Unable to program brand new '328P chips
Post by: Krodal on Jun 16, 2012, 05:07 pm
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.
Title: Re: Unable to program brand new '328P chips
Post by: majenko on Jun 16, 2012, 05:13 pm

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?
Title: Re: Unable to program brand new '328P chips
Post by: Krodal on Jun 16, 2012, 06:54 pm
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.
Title: Re: Unable to program brand new '328P chips
Post by: majenko on Jun 16, 2012, 07:34 pm

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.
Title: Re: Unable to program brand new '328P chips
Post by: Krodal on Jun 16, 2012, 09:58 pm
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...
Title: Re: Unable to program brand new '328P chips
Post by: JChristensen on Jun 16, 2012, 11:21 pm
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?
Title: Re: Unable to program brand new '328P chips
Post by: majenko on Jun 16, 2012, 11:25 pm

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  :~

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.
Title: Re: Unable to program brand new '328P chips
Post by: nickgammon on Jun 16, 2012, 11:51 pm
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.
Title: Re: Unable to program brand new '328P chips
Post by: JChristensen on Jun 16, 2012, 11:52 pm
Ahhh, so I figured. My eyes aren't nearly long enough any more :D

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.
Title: Re: Unable to program brand new '328P chips
Post by: majenko on Jun 17, 2012, 12:22 am
Hmmm... That has schematics.  I might have a go at making one of those - seems simple enough.
Title: Re: Unable to program brand new '328P chips
Post by: tim7 on Jun 17, 2012, 12:37 am
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...
Title: Re: Unable to program brand new '328P chips
Post by: nikone on Jun 18, 2012, 10:44 am
for program the chip you use terminal or arduino ide?
hi niko
Title: Re: Unable to program brand new '328P chips
Post by: majenko on Jun 18, 2012, 10:46 am

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


Either.  They both give the same result.
Title: Re: Unable to program brand new '328P chips
Post by: pito on Jun 20, 2012, 12:16 am
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.
Title: Re: Unable to program brand new '328P chips
Post by: majenko on Jun 20, 2012, 12:45 am
Ooooh... worth a try...
Title: Re: Unable to program brand new '328P chips
Post by: majenko on Jun 20, 2012, 12:53 am
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.
Title: Re: Unable to program brand new '328P chips
Post by: nickgammon on Jun 20, 2012, 01:04 am
I programmed a "fresh" chip as described here:

http://www.gammon.com.au/forum/?id=11635
Title: Re: Unable to program brand new '328P chips
Post by: pito on Jun 20, 2012, 01:08 am
I do not know what speed the "-B1200" setting actually means (most probably the programming clock speed generated by the programmer in "bauds", this is not the speed of UART communication), but any higher speed does not work with my usbasp programmer with brand new chips (the chip is not recognised). After flashing the right fuses at that -B1200 speed, the chip gets recognised properly and I can flash him normally (I can confirm this procedure with atmega8, 32, 32L, 328p, 1284p).
You cannot switch the oscillators on the fly.. You may brick the chip when you deselect "Serial program downloading SPI" option - see the flags:

http://www.engbedded.com/fusecalc

PS: no warranty of any kind  :smiley-eek:
Title: Re: Unable to program brand new '328P chips
Post by: majenko on Jun 20, 2012, 01:16 am
Ah, I misread you.  I was using -b which is the serial comms baud rate.

-B is different:

Quote
-B <bitclock>              Specify JTAG/STK500v2 bit clock period (us).


It is ignored on the ArduinoISP sketch, as it just uses SPI at Fosc/128.

If only I could slow that down...  Well, I could replace all the SPI calls in the sketch with my own bit-banging routines I guess.
Title: Re: Unable to program brand new '328P chips
Post by: pito on Jun 20, 2012, 01:23 am
I see, you are using the arduino as the programmer for a new chip.. If the arduino is at 16MHz and SPI is /128 it could be too high (125KHz), sure. It would be better to go down to ~1kHz for the new chip fuses reflash.
Title: Re: Unable to program brand new '328P chips
Post by: majenko on Jun 20, 2012, 01:24 am
Hmmm... A job for tomorrow then... write a slow bit-banging SPI library.  Fun.
Title: Re: Unable to program brand new '328P chips
Post by: pito on Jun 20, 2012, 01:54 am
For example the usbasp programmer ($3.80 at ebay incl shipping costs) had a switch for "slow clock" setting specifically for programming chips set to a low fcpu (ie 1MHz). The newest driver has got the -Bxyz option for that, so I must not tackle the switch anymore..
Title: Re: Unable to program brand new '328P chips
Post by: majenko on Jun 20, 2012, 01:58 am
Well, I think I have a bit-banging SPI implementation now, but it still doesn't work - exactly the same results, just slower.

This is my bitbanging code - if you someone could just make sure that it is doing what I hope it is - it should be the equivalent to SPI mode CHPA=0 and CPOL=0:

Code: [Select]

#define SPI_DELAY 10

uint8_t spi_send(uint8_t b) {
  uint8_t reply;
  uint8_t outgoing;
  uint8_t bits;
  pinMode(MOSI,OUTPUT);
  pinMode(MISO,INPUT);
  pinMode(SCK,OUTPUT);
  digitalWrite(SCK,LOW);
  reply = 0;
  outgoing = b;
  for(bits=0; bits<8; bits++)
  {
    digitalWrite(MOSI,outgoing&0b10000000?HIGH:LOW);
    outgoing = outgoing << 1;
    delay(SPI_DELAY);
    digitalWrite(SCK,HIGH);
    reply = reply << 1;
    reply |= digitalRead(MISO)==HIGH ? 1 : 0;
    delay(SPI_DELAY);
    digitalWrite(SCK,LOW);
  }
  return reply;
}
Title: Re: Unable to program brand new '328P chips
Post by: nickgammon on Jun 20, 2012, 05:41 am
This is my bit-banged SPI code which works successfully programming various chips:

Code: [Select]

// bit banged SPI pins
const byte MSPIM_SCK = 4;  // port D bit 4
const byte MSPIM_SS  = 5;  // port D bit 5
const byte BB_MISO   = 6;  // port D bit 6
const byte BB_MOSI   = 7;  // port D bit 7

// for fast port access (Atmega328)
#define BB_MISO_PORT PIND
#define BB_MOSI_PORT PORTD
#define BB_SCK_PORT PORTD
const byte BB_SCK_BIT = 4;
const byte BB_MISO_BIT = 6;
const byte BB_MOSI_BIT = 7;

// control speed of programming
const byte BB_DELAY_MICROSECONDS = 4;

...


// Bit Banged SPI transfer
byte BB_SPITransfer (byte c)
{       
  byte bit;
   
  for (bit = 0; bit < 8; bit++)
    {
    // write MOSI on falling edge of previous clock
    if (c & 0x80)
        BB_MOSI_PORT |= _BV (BB_MOSI_BIT);
    else
        BB_MOSI_PORT &= ~_BV (BB_MOSI_BIT);
    c <<= 1;

    // read MISO
    c |= (BB_MISO_PORT & _BV (BB_MISO_BIT)) != 0;

   // clock high
    BB_SCK_PORT |= _BV (BB_SCK_BIT);

    // delay between rise and fall of clock
    delayMicroseconds (BB_DELAY_MICROSECONDS);

    // clock low
    BB_SCK_PORT &= ~_BV (BB_SCK_BIT);
    }
   
  return c;
  }  // end of BB_SPITransfer
Title: Re: Unable to program brand new '328P chips
Post by: majenko on Jun 20, 2012, 10:12 am
Nope, still no joy.

I see the SCK line clocking.  I see the MOSI line sending data.  There is nothing on the MISO line.  It's like the chip is just sat on a park bench somewhere whistling a happy tune all by itself ignoring everything that's going on around it.  In a world of its own.
Title: Re: Unable to program brand new '328P chips
Post by: pito on Jun 20, 2012, 11:18 am
Do you have:
1. Xtal connected to the brand new 328p?
2. Vcc connected?
3. double check wirings..
4. decoupling capacitors?
p.
Title: Re: Unable to program brand new '328P chips
Post by: majenko on Jun 20, 2012, 11:23 am

Do you have:
1. Xtal connected to the brand new 328p?

Yes.

Quote

2. Vcc connected?

Yes.

Quote

3. double check wirings..

Yes.

Quote

4. decoupling capacitors?

Yes.

As I say, it works perfectly with a '328P taken off another UNO board.
Title: Re: Unable to program brand new '328P chips
Post by: pito on Jun 20, 2012, 11:55 am
..the black-box situation  ]:)
PS: any news with multi-uart for retro?
Title: Re: Unable to program brand new '328P chips
Post by: majenko on Jun 20, 2012, 11:59 am
Quote
..the black-box situation

If I rip all the pins off then I have one of those, yes :P

I haven't touched retro for a while - kind of got behind with it.  The multi-uart code I was working on didn't work too well - something strange with interrupts.  The last time I tried running Retro on my setup it wouldn't boot :(  I need to get back on it sometime - at the moment my Eurocard Computer is running the Max32 bootloader so it's kind of like a glorified Arduino :)
Title: Re: Unable to program brand new '328P chips
Post by: pito on Jun 20, 2012, 01:05 pm
.."I haven't touched retro for a while.." There is a lot of news (ie spi, ethernet..) so maybe you might try to boot it again and join us - a lot of challenges there  ;)
Title: Re: Unable to program brand new '328P chips
Post by: tim7 on Jun 20, 2012, 01:17 pm

I see, you are using the arduino as the programmer for a new chip.. If the arduino is at 16MHz and SPI is /128 it could be too high (125KHz), sure. It would be better to go down to ~1kHz for the new chip fuses reflash.


Factory-fresh chips should be running at 1MHz, so as long as the SPI clock is below 250kHz it ought to be ok.
You could always try using the clock pre-scaler, which can reduce the system clock by up to 256x.  eg:

Code: [Select]
  CLKPR = (1<<CLKPCE); // enable clock divider
  CLKPR = (1<<CLKPS0); // divide f_cpu by 2


There's always the possibility the new chips are genuinely dead for some reason.  A way of ruling out programming problems, albeit high-risk, would be to set the fuses of the working ATmega328p to their factory defaults and then try reprogramming it.  Something like this:

Code: [Select]
avrdude -c arduino -p atmega328p -P COM4 -b 19200 -e -u -U efuse:w:0xff:m
avrdude -c arduino -p atmega328p -P COM4 -b 19200 -e -u -U hfuse:w:0xd9:m
avrdude -c arduino -p atmega328p -P COM4 -b 19200 -e -u -U lfuse:w:0x62:m

(making sure to reset the clock-related fuses last)



Do you have:
1. Xtal connected to the brand new 328p?

Yes.


If the chip is using its internal clock, as it should be if it's brand new, there's no need to connect an external crystal.  OTOH, having a crystal there shouldn't disturb SPI communications.  Majenko, could you post a photo of your setup?
Title: Re: Unable to program brand new '328P chips
Post by: majenko on Jun 20, 2012, 01:33 pm
Quote
A way of ruling out programming problems, albeit high-risk, would be to set the fuses of the working ATmega328p to their factory defaults and then try reprogramming it.


No thanks :)

I don't want to brick a good chip.

Quote
You could always try using the clock pre-scaler


I'll give that a go.

Quote
could you post a photo of your setup?


Sure, here it is.  Decoupling caps and crystal load caps are all SMD on the reverse side.
Title: Re: Unable to program brand new '328P chips
Post by: tim7 on Jun 20, 2012, 02:28 pm
I'm not familiar with that PCB - I assume it does all the power routing.  The brown reset wire doesn't seem connected - is it connected on the underside of the PCB?  Anyway you already said that it works with a chip pulled out of an Uno, so it must be ok.

The only thing I can think of left to try is Nick Gammon's board-detector sketch  That would rule out any strange avrdude problems.  He also suggests some breadboard layouts for different clock configurations, in case your chips are configured to use an external clock for some strange reason.
http://www.gammon.com.au/forum/?id=11637 (http://www.gammon.com.au/forum/?id=11637)
Title: Re: Unable to program brand new '328P chips
Post by: majenko on Jun 20, 2012, 02:56 pm
Nice program :)

Yes, the brown wire is connected underneath the board.  I am very well acquainted with these boards, since I designed them.

The board detector program detects a known good chip fine.  With one of the new chips, it doesn't detect it at all.

Incidentally, the crystal is oscillating.

I am starting to lean towards these chips being DOA.
Title: Re: Unable to program brand new '328P chips
Post by: majenko on Jun 20, 2012, 07:50 pm
The only effect enabling the clock divider has is to halve the serial baud rate :(  Still not programming.

I will have to have a go at making one of those high voltage parallel programmer doohickeys and see if that can find the chip...
Title: Re: Unable to program brand new '328P chips
Post by: nickgammon on Jun 20, 2012, 10:51 pm

The board detector program detects a known good chip fine.  With one of the new chips, it doesn't detect it at all.


If my board detector is set up to detect a known good chip, and then you insert a "factory fresh" one and nothing happens, sounds like it might be dead. After all, I tested it on factory chips.

You could slow down the SPI in the board detector, but I haven't needed to do that yet.
Title: Re: Unable to program brand new '328P chips
Post by: majenko on Jun 23, 2012, 12:06 pm
Right.  The guys at Farnell have kindly sent me a couple of new '328P chips.  I'm about to see if they work.

I'll type as I do it so you can see exactly what I am doing.  I haven't even opened the envelope with the chips in.

Right, first things first, on goes my trusty wrist strap.  I'll put down the cat (put it on the floor that is, not take it to the vets), and stop rubbing my hair with this baloon, and grab me an Arduino.

Right, that's the Board Detector loaded, and the programming shield plugged in.  Now to open the envelope...

The antistatic packaging is good - a bag and a tube...

Slide one chip out of the tube on to my wooden desk, grasp it by both ends (not the legs) and slot this bad boy in.

Plug in Ardy, open the serial monitor...

Code: [Select]

Atmega chip detector.


Just to test, grab second Ardy, pop the chip, slip that in to the programming shield, and voila  - it works.

$^*("£()%
Title: Re: Unable to program brand new '328P chips
Post by: JChristensen on Jun 23, 2012, 02:04 pm
So those two chips were bad.  Wow.
Title: Re: Unable to program brand new '328P chips
Post by: majenko on Jun 23, 2012, 02:07 pm

So those two chips were bad.  Wow.


Well, no - the new ones don't work.

If they are bad, then the whole batch may be bad.

I am half-way through building a HV fuse re-writing shield.
Title: Re: Unable to program brand new '328P chips
Post by: JChristensen on Jun 23, 2012, 02:11 pm
Oh, I misunderstood.
Title: Re: Unable to program brand new '328P chips
Post by: majenko on Jun 23, 2012, 05:13 pm
Here's what happens if I try the fuse rescue HV programmer thingie mentioned earlier on in this thread:

Code: [Select]

Insert target AVR and press button.
[][][]
Existing fuse values:
LFUSE: 3F
HFUSE: 3F

Enter desired LFUSE hex value (ie. 0x62): FF
Enter desired HFUSE hex value (ie. 0xDF): DE
Burning fuses...
[][][][][]
Read LFUSE: 36
Read HFUSE: 15
Burn complete.

It is now safe to remove the target AVR.


And if I run it again, with the same chip, I get the exact same results.

...confused...?  I am.
Title: Re: Unable to program brand new '328P chips
Post by: JChristensen on Jun 23, 2012, 05:52 pm
Confused for sure, and frankly skeptical that there is an issue with the chips themselves. Sure would like to see them tried with a different programmer. Do you know anyone close by that might be able to help with that?
Title: Re: Unable to program brand new '328P chips
Post by: majenko on Jun 23, 2012, 07:59 pm
Alas not.  I would love to see it in someone else's programmer too.

Anyone UK-wise fancy volunteering to have a go?  I can post you one of these puppies...
Title: Re: Unable to program brand new '328P chips
Post by: majenko on Jun 23, 2012, 09:04 pm
Ha!

I have bootloader burnage!

You know what it was?

No, of course you don't, or you'd have told me already :P

It was the socket on the ISP shield.

I had used some headers before (like on the Arduino) so the chip was easier to insert and remove, so less chance of bent pins.  It turns out that if you use a pre-used chip, with the pins in a more vertical alignment (after having been used in a DIL socket) they make good contact.  If you use a brand new chip, with the pins splayed, as they are, they don't make good contact.

A proper DIL socket is now in its place, and it worked perfect first time.

Gah!

I'd rather have a ZIF socket, but I only have one, and that is part of a test jig for my LED boards.  Maybe I should invest in another...
Title: Re: Unable to program brand new '328P chips
Post by: JChristensen on Jun 23, 2012, 09:44 pm
Glad you figured it out, because it was starting to make me crazy! I have some ZIF sockets from Evil Mad Science, thought they had good prices, not sure what shipping to the UK would be, http://evilmadscience.com/component/content/article/270

They also have a nice looking ISP shield, http://evilmadscience.com/productsmenu/tinykitlist/253