Author Topic: ATMEGA328P-AU Stopped working after power cycling  (Read 7213 times)

0 Members and 1 Guest are viewing this topic.

Offline Mad ProfessorTopic starter

  • Regular Contributor
  • *
  • Posts: 90
  • Country: gb
ATMEGA328P-AU Stopped working after power cycling
« on: July 05, 2015, 09:43:31 am »
Hi All.

I am looking for some help and advice with one of my projects that have stopped working.

In this project I am using a blank ATMEGA328P-AU from RS Components, and I burnt on the the arduino bootloader using an Arduino UNO R3.

The power source is a 8ah 12volt battery with a small solar panel for charging.

it has been running without fault for the last two weeks, but yesterday I disconnected it so that I could move it to a new location and since then it has failed to do anything.

Within the arduino code at power on I have it outputting the current parameters over serial, I am no longer getting any of this data over serial.
I also have power and indication led's, all the power are on, but once again none of the indication led's are working.

It seems that I have clearly spiked the ATMEGA328P-AU while disconnecting / reconnecting the power, so I am unsure if the chip is damaged, or if it has just been corrupted.

I have also tried re-burning the arduino bootloader, and this fails each time.

I do have a spare ATMEGA328P-AU so if push comes to shove I can replace the chip, but I would really like to see if the current chip can be recovered, and how to try and prevent this from happening again.

Can anyone please advice.

Thanks for your time.

Best Regards.
« Last Edit: July 05, 2015, 09:46:28 am by Mad Professor »
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: nz
Re: ATMEGA328P-AU Stopped working after power cycling
« Reply #1 on: July 05, 2015, 09:57:49 am »
Check the GND connections
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 3020
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
Re: ATMEGA328P-AU Stopped working after power cycling
« Reply #2 on: July 05, 2015, 10:06:38 am »

I have also tried re-burning the arduino bootloader, and this fails each time.



First check all your connections.

Checked that the RESET pin, when not being programmed, is HIGH, perhaps your pull-up is broken.

What clock source are you using?  If it's an external clock/crystal/oscillator and it's not working you can try injecting a clock into XTAL1 (see the Adafruit fork of ArduinoISP which outputs a clock on D9 for this purpose),  because if you've burnt the bootloader for an external clock/crystal/osc you need one from that point on to do it again [burning the bootloader sets the fuses].

Have you extracted the chip from your device and tried programming it externally (taking note of clock requirements set when you initially burnt the bootloader).

It may well be dead, but these are the simple things to try.

After that, for a one off, it's not worth your time, just put in another and look at your circuit to determine what might have caused it to die (inductive spike or reverse current from some other source of power... like a solar panel maybe) so you can try to stop it happening again.
~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 

Offline nitro2k01

  • Frequent Contributor
  • **
  • Posts: 843
  • Country: 00
Re: ATMEGA328P-AU Stopped working after power cycling
« Reply #3 on: July 05, 2015, 10:14:49 am »
Could you give more details about your circuit? I assume you have a voltage regulator. Atmega328 i a 5 V maximum device -- running the chip directly on 12 V would of course fry it. Or are you using an Arduino board to interface the chip? Other details about the circuit would also be helpful.
Whoa! How the hell did Dave know that Bob is my uncle? Amazing!
 

Offline Mad ProfessorTopic starter

  • Regular Contributor
  • *
  • Posts: 90
  • Country: gb
Re: ATMEGA328P-AU Stopped working after power cycling
« Reply #4 on: July 05, 2015, 10:37:54 am »
Thank you for your replies.

I can confirm that the voltages at the chip are as expected, as well as the reset pin is being pulled high as expected.

The circuit is using an external 16Mhz crystal.

I have not yet tried injecting an external clock from the Arduino UNO, but I will look up the details you have kindly provided.

I have not yet extracted the chip from the circuit as the ATMEGA328P-AU is a TQFP and as such I would just replace the chip.

The ATMEGA328P-AU is being power from the 12volt battery via a LM2937 500-mA Low Dropout Regulator.

I don't have access to my main computer but here is the pcb design for an earlier version without the LM2937 Regulator.


Thanks again for your time.

Best Regards.
 

Offline SL4P

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
  • There's more value if you figure it out yourself!
Re: ATMEGA328P-AU Stopped working after power cycling
« Reply #5 on: July 05, 2015, 10:48:19 am »
When you power cycled, did you take down the connected devices first - or after the Arduino?
You may have accidentally drawn power from your connected devices, and/or applied reverse polarity to the CPU pins ?

A circuit or block diagram could help us see the possibilities.
Don't ask a question if you aren't willing to listen to the answer.
 

Offline nitro2k01

  • Frequent Contributor
  • **
  • Posts: 843
  • Country: 00
Re: ATMEGA328P-AU Stopped working after power cycling
« Reply #6 on: July 05, 2015, 11:16:10 am »
I will first share a little anecdote. I have one of those really cheap USBasp programmers that I bought for $3 on eBay on a sale. It's a bit crude, but had worked well up until building a new project, when it stopped recognizing the AVR on the board it was connected to. It turned out several of the programming connections had no continuity from end to end. After a lot of head scratching and continuity testing, it turned out that the ribbon cable connector that came with the programmer did not make contact with the pins on the programming header on my project board for whatever reason, I'm assuming poor tolerances. I still had continuity when I inserted a wire into the connector, so the problem was with the male-female connection, not in the crimp connection. I replaced it with another 10 way ribbon cable and everything worked again.

An oscilloscope would of course be useful for a lot of things here, if you have access to one. For example checking if the clock is oscillating in this case.

Mandatory double check: Are all the programming pins still in the same places on the new board?

What are you using for programming the chip? If you are using avrdude with an ISP programmer of some sort, try giving just the avrdude command with no programming (-U) switches just to see if the chip responds at all.
Eg: avrdude -c programmer_name -p m328p
You should see device signature and fuses ok. If even that fails to access the chip, try adding the flag -B 1 to set the bit clock (communication speed) really low to see if that makes a difference. If you can at least get that to work, we have something to work from. The working theory here is that the fuses somehow got set to the internal RC oscillator instead of the external one and that the chip is now running at whatever low speed the RC oscillator runs at, so the programmer's SPI speed is too fast for the chip and the programming fails completely.

I doubt that would be the case of the problem in this case, but one possibility is voltage overshoot on startup on the Vcc rail.
« Last Edit: July 05, 2015, 11:19:03 am by nitro2k01 »
Whoa! How the hell did Dave know that Bob is my uncle? Amazing!
 

Offline Mad ProfessorTopic starter

  • Regular Contributor
  • *
  • Posts: 90
  • Country: gb
Re: ATMEGA328P-AU Stopped working after power cycling
« Reply #7 on: July 05, 2015, 01:37:05 pm »
Thank you again for your replies.

The PCB is fitted into a sealed plastic housing, all the connections are made via a single multi way connector.

The only programmers I have access to are my Arduino UNO R3, and my Arduno Nano

When I built the PCB as said above I used a blank ATMEGA328P-AU, and programmed the chip with the Arduino bootloader via my Arduino UNO R3.
As said above I have tried re-burn the arduino bootloader but it fails to do anything.

I have now also tried the Adafruit fork of the ArduinoISP code and used it to feed an external clock to the ATMEGA328P-AU, this also fails to re-burn the arduino bootloader.

I have tried running the avrdude as said above but could not get anything to happen. I did get

running the following commands from the "C:\Program Files (x86)\Arduino" folder
Code: [Select]
hardware\tools\avr\bin\avrdude.exe -C hardware\tools\avr\etc\avrdude.conf -c stk500v1 -p m328p -P COM5

hardware\tools\avr\bin\avrdude.exe -C hardware\tools\avr\etc\avrdude.conf -c avrisp -p m328p -P COM5
Quote
avrdude.exe: stk500_recv(): programmer is not responding
avrdude.exe: stk500_getsync() attempt 1 of 10: not in sync: resp=0x03
avrdude.exe: stk500_getsync() attempt 2 of 10: not in sync: resp=0xe0
avrdude.exe: stk500_getsync() attempt 3 of 10: not in sync: resp=0xe0
avrdude.exe: stk500_getsync() attempt 4 of 10: not in sync: resp=0xe0
avrdude.exe: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude.exe: stk500_getsync() attempt 6 of 10: not in sync: resp=0xe0
avrdude.exe: stk500_getsync() attempt 7 of 10: not in sync: resp=0xe0
avrdude.exe: stk500_getsync() attempt 8 of 10: not in sync: resp=0xe0
avrdude.exe: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude.exe: stk500_getsync() attempt 10 of 10: not in sync: resp=0xe0

avrdude.exe done.  Thank you.

I am thinking that it looks more likely that the chip is damaged, and I will have to replace it.
 

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 3020
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
Re: ATMEGA328P-AU Stopped working after power cycling
« Reply #8 on: July 05, 2015, 01:53:17 pm »
A hot air station will remove the ic easy, then before you put another one in, double check the voltages present on the board, both to make sure your main reg is working and that if power is disconnected your panel, in full sun, isn't putting a voltage where you didn't expect it :-)
~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 

Offline Mad ProfessorTopic starter

  • Regular Contributor
  • *
  • Posts: 90
  • Country: gb
Re: ATMEGA328P-AU Stopped working after power cycling
« Reply #9 on: July 05, 2015, 02:44:11 pm »
Thanks again for your advice.

I decided to just removed the chip, test voltages, and replace the faulty ATMEGA328P-AU chip.

The new chip was blank, so I burnt the Arduino bootloader, and uploaded my arduino  sketch, and it's all back up and running like just before.

As we are not 100% why the chip failed, can anyone advice what I can add and or change on my pcb to try and stop this happening again.

Thanks again for your time.

Best Regards.
 

Offline nitro2k01

  • Frequent Contributor
  • **
  • Posts: 843
  • Country: 00
Re: ATMEGA328P-AU Stopped working after power cycling
« Reply #10 on: July 05, 2015, 03:12:43 pm »
The not in sync error with varying byte values usually indicates a baud rate problem (incorrect CPU speed, incorrect baud rate in the bootloader or incorrect baud rate used by the programmer.) If the chip was completely dead, you would instead likely see just 0x00 or just 0xff as response values.

Having desoldered the chip, you are now less likely to be able to find out what the problem was. I still think it's somewhat likely that you managed to program the fuse bits incorrectly so the chip was using the internal RC oscillator, or divided the clock by 8. IF this is the case, the good news is that this problem can really only happen through ISP programming, not using the bootloader to upload programs or by random electrical faults, which would instead fry single pins or the whole chip. If this is the case, a possible scenario is that you first uploaded a sketch, then changed the fuse value by accident. Then your program keeps running happily at the wrong speed and you don't notice until you try to reprogram it the next time. On the other hand, that doesn't explain why it stopped working just by cycling the power, if that is what happened.

If you'd like, you could mail me the faulty chip to me and I could try to do a postmortem.
Whoa! How the hell did Dave know that Bob is my uncle? Amazing!
 

Offline linux-works

  • Super Contributor
  • ***
  • Posts: 1993
  • Country: us
    • netstuff
Re: ATMEGA328P-AU Stopped working after power cycling
« Reply #11 on: July 05, 2015, 04:01:09 pm »
when I have a 328 chip that used to work and now stops and won't even take a new ftdi style download, its usually the bootloader that got trashed.  not sure why or how but it does happen (and its one reason why I never jumped on the teensy bandwagon; he does not release his bootloader code and so if you did get one of his chip and if the BL was corrupted later on, you could not bring the chip back to life no matter what you did).

but you say that you tried reloading the bootloader?  maybe that process did not work in-circuit?

or maybe you need high voltage programming, which is the final way to clear a chip and bring it back (which I have never done, myself).

over the use of maybe 50 328 chips I've used, 2 or 3 of them have failed and even the BL load would not work for them.  so, it does happen, somehow.


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf