ATMEGA328P-AU Stopped working after power cycling - Page 1
Forum section: electronics / general

author: Mad Professor
author_rank: Regular Contributor
timestamp: July 05, 2015, 09:43:31 am
content: 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.

author: Psi
author_rank: Super Contributor
timestamp: July 05, 2015, 09:57:49 am
content: Check the GND connections

author: sleemanj
author_rank: Super Contributor
timestamp: July 05, 2015, 10:06:38 am
content: Quote from: Mad Professor on July 05, 2015, 09:43:31 amFirst 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.

author: nitro2k01
author_rank: Frequent Contributor
timestamp: July 05, 2015, 10:14:49 am
content: 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.

author: Mad Professor
author_rank: Regular Contributor
timestamp: July 05, 2015, 10:37:54 am
content: 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 aLM2937500-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.

author: SL4P
author_rank: Super Contributor
timestamp: July 05, 2015, 10:48:19 am
content: When you power cycled, did you take down the connected devices first - orafterthe 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.

author: nitro2k01
author_rank: Frequent Contributor
timestamp: July 05, 2015, 11:16:10 am
content: 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 m328pYou 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.

author: Mad Professor
author_rank: Regular Contributor
timestamp: July 05, 2015, 01:37:05 pm
content: 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 myArduino UNO R3, and myArduno NanoWhen 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 getrunning the following commands from the "C:\Program Files (x86)\Arduino" folderCode:hardware\tools\avr\bin\avrdude.exe -C hardware\tools\avr\etc\avrdude.conf -c stk500v1 -p m328p -P COM5hardware\tools\avr\bin\avrdude.exe -C hardware\tools\avr\etc\avrdude.conf -c avrisp -p m328p -P COM5QuoteI am thinking that it looks more likely that the chip is damaged, and I will have to replace it.

author: sleemanj
author_rank: Super Contributor
timestamp: July 05, 2015, 01:53:17 pm
content: 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 :-)

author: Mad Professor
author_rank: Regular Contributor
timestamp: July 05, 2015, 02:44:11 pm
content: 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.

author: nitro2k01
author_rank: Frequent Contributor
timestamp: July 05, 2015, 03:12:43 pm
content: 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 workingjustby 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.

author: linux-works
author_rank: Super Contributor
timestamp: July 05, 2015, 04:01:09 pm
content: 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.