Go Down

Topic: Unable to program brand new '328P chips (Read 6000 times) previous topic - next topic

majenko


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.

pito

#31
Jun 20, 2012, 11:55 am Last Edit: Jun 20, 2012, 11:56 am by pito Reason: 1
..the black-box situation  ]:)
PS: any news with multi-uart for retro?

majenko

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

pito

.."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  ;)

tim7


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?

majenko

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.

tim7

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

majenko

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.

majenko

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

Nick Gammon


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.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

majenko

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.

$^*("£()%

Jack Christensen

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

majenko


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.

Jack Christensen

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

majenko

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.

Go Up