How did I kill my AVR(s)?

Just polling the brain trust... I know y'all aren't psychic. Here's what happened.

I was doing some testing when I started to get unusual behavior from it. Like, I would push a button to change modes and the mode change would happen, then suddenly un-happen. Or a button wouldn't work, then suddenly it would. Then my Arduino started hanging up--just totally not responding at all. No serial IO. No response to button presses. Nothing. After a reset, the Arduino would run for 5-20 seconds, then hang.

The first thing I did was disconnect my Boarduino from my project board. No change.

So I pulled the (suspected bad) chip out of my Boarduino and put the (known-good) chip from my Uno into the Boarduino. I also switched computers from my laptop to my desktop, because my Uno was in a different room. I kept getting sync errors when trying to upload to the Boarduino, so I moved the "good" chip back to the Uno and uploaded the code to it, then moved it back to the Boarduino and the laptop. Surprise, surprise... same thing kept happening. Moved the "good" (not anymore) chip back to the Uno and the desktop... same thing kept happening. Now I have two dead AVRs.

To sum up:

  • Bad chip in Boarduino with FTDI cable on laptop.
  • Put good chip in Boarduino with FTDI cable on laptop, get sync errors.
  • Put bad chip in Uno with USB cable on desktop, freeze/hang occurs.
  • Put good chip back in Uno with USB cable on desktop, upload code successfully.
  • Put good chip back in Boarduino with FTDI cable on laptop, freeze/hang occurs.
  • Connect good (not-anymore?) chip to desktop with USB, freeze/hang continues to occur.

Also, while I was working on the project, before I noticed that the AVR was messed up, I had an LED burn out for no apparent reason. To be fair, I was welding about 3 feet from the board. Welding by itself shouldn't produce enough RF emissions to fry a board, but you never know. Anyway, I'm telling you all that because there were already signs that something screwy might be happening, and it's not like I was sitting at a desk with a nice anti-static mat and all. However, the Arduino was almost certainly NOT directly affected by the welding arc. It was in a plastic (not metal) project box, sitting on top of the welder, not touching the welding table at all.

What I'm wondering is if anybody has any insight into where the failure is. For example, could I have messed up the Boarduino in such a way that inserting an AVR into it fries the AVR? Is that even possible? Or is it my FTDI cable maybe? Or, heck, is it my laptop? All three of those are common to the failed chip(s).

Anyway, maybe the answer is that there is no answer except trial and error. I have some more AVRs on the way, as well as another Boarduino. I hate to play trial-and-error with the AVRs, at $5 a pop, if anybody has any better advice for me.

Hello,

I would check two things: Supply voltage and RAM. Check if your supply voltage is stable and below 5.5V. Perhaps you need some capacitors (100nF ceramic) close to the chip to stabilize the voltage.

The other possibility is that your sketch needs too much RAM. This is a problem the arduino IDE won’t tell you. For a check you can upload the blink example and see if it runs. Then your hardware should be ok.

When you’re running out of RAM you can free some space by having the strings that don’t change in the flash ROM. Instead of println("Hello World");makeprintln(F("Hello World")); This way the string isn’t loaded into the RAM and you save 11 bytes of RAM space.

Elektrix

[ the Arduino would run for 5-20 seconds, then hang.](http://the Arduino would run for 5-20 seconds, then hang.)

Any chance the chip is getting hot due to overload on the I/O? Once they overheat, sometimes they return to "normal" and sometimes really flaky things happen. I sent an ATtiny85 to chip-heaven last year in a puff-of-smoke. Now, I ALWAYS use a current-limited power supply and those little polyfuses on the breadboard. Loose Amps sink Chips.

Oh, you are paying way too much for the ATmega328P-PU. Your profile did not indicate your location, so perhaps you are including tariffs and such in your $5/ea figure. I purchase in 25 quantity and the loaded cost here in the U.S. is under $2/ea.

Today, Mouser and Newark/Farnell are selling 328P-PU in 25 qty for $1.98 U.S.D. Once in a blue-moon, Newark will have free shipping on orders of $50... that is the time to stock up. My last batch of 25 was $1.82 ea.

Ray

as elektrix suggests the #1 cause of flaky operation is software bugs. if you can still downoad then not likely the chip is killed. #1 cause of actual bricked avr is wrong fuse (clock or rstdsbl). using avrdude is specially dangerous there.

you dont mention current limiting so theres a small chance to fry cheapo chinese led that way w/o a resistor. however imo its not possible to burn out a chip by shorting a pin. to avoid flame wars etc i wont mention this again. imo the static thing is urban myth too. i agree with you nearby welding not likely to cause damage either but must admit not as experienced there. i do know this can scramble data transfers but permanent damage? probably not.

That would depend on the welder… Some use RF for the Arc. Long leads > 10cm are an issue as they can act as antenna’s…
The real issue is what the chip does with the received (If in fact this is the issue) RF it can re bias a lot of things including the power supplies. 100 nF caps are an absolute necessity and if this thing is to be used in a high RF field, welders or other powerful RF transmitters 100 pf + 1 nf + 100 nf and probably some ferrites similar to the clip on ferrites commonly used on cables. Cables instead of loose wires is a good idea too. The LED failure may be the key… to the whole thing as was pointed out already by john1993 LEDs even cheap Chinese LED’s will fail if there is no current limiting resistor. However If there was a low value (220 - 330 ohms) it might be easy enough to fry the Led because at that current level {5V - Vled (1.8V) = 3.2V / 220 ohms = .0145… 15 mA and I’ve seen cheap LED’s that were actually rejects that worked somewhat fail @ 20 mA so if this is the case then the welder is inducing RF or high power spikes when you strike the arc and the wiring is picking up that energy and connecting it to a LOT of diodes in the '328… possible frying the 328 in the real sense.
While I realize that the situation is unique… I do need one more answer… Were you welding both times when the chips failed?.
These are failures I have dealt with when combining microcontrollers and RF sources and the ferrite beads and bypassing with all 3 values especially the power supply wiring. A linear regulator keeps it’s output at a specified point BUT nothing is there to prevent that energy from the welder to raise the output voltage above the absolute limits of the processor.
Just some random thoughts…

Doc

Elektrix:
The other possibility is that your sketch needs too much RAM. This is a problem the arduino IDE won't tell you. For a check you can upload the blink example and see if it runs. Then your hardware should be ok.

This is a good tip. I hadn't thought to check that. My sketch had been running fine until that day, and I haven't made any changes that I can think of that would dramatically change its memory usage, but you never know.

Elektrix:
The other possibility is that your sketch needs too much RAM. This is a problem the arduino IDE won't tell you. For a check you can upload the blink example and see if it runs. Then your hardware should be ok.

Big ups to you, Elektrix. This seems to have been the issue. What was confusing the issue for me was that I remembered the program working fine the last time I was testing it, and I didn't remember making any changes. The code has been pretty much 99% done for a couple of weeks now, and I have been working hard on the hardware side. I forgot that one of the tweaks I made to the code in that time was to increase a lookup table's size. I didn't expect it to have any effect on the code, except to increase the precision of the lookup, but it was apparently enough to run me out of SRAM.

The reason I was getting "out of sync" errors on the chip is that the chip would power-cycle and then crash, so it wasn't running when the IDE tried to upload to it. I held down the reset button manually and released it on time to receive a clean upload and it was fine.

You know, even though your problem may be solved, I would definitely think twice about mixing the use of a welder near the arduino development (unless you are trying to control a welder with an arduino, of course). I tend to keep my welding activities out of doors, away from my computers, electronics, and shop space. If for nothing else, welding produces welding spatter of fine metal blobs and bits, and I don't want the producing a potential short in my computers or other electronics.

cr0sh:
(unless you are trying to control a welder with an arduino, of course).

NAILED IT! :smiley: :smiley: :smiley:

Fortunately, it's TIG welding, so there is minimal to zero spatter and etc...