Odd microcontroller behavior - Page 1
Forum section: electronics / beginners

author: rexxar
author_rank: Frequent Contributor
timestamp: April 07, 2014, 06:05:17 am
content: Hello all, I've got a problem that I'm rather puzzled by...I'm working on a project with an ATmega32u4 microcontroller, and it just stopped working. It won't do or respond to anything other than ICSP programming, which seems rather odd...At first I thought it was the 16MHz crystal, so I replaced that with an external source, still no. My code is set to turn it off under certain conditions, maybe it got confused? Did a chip erase, still nothing.I wrote a program that turns on and off all outputs, and I get preciously nothing on every single one. USB isn't working anymore either. Any ideas what's going on? I suppose ESD is the most likely culprit, though it was in a sealed enclosure when it died. It was open on the bench about an hour earlier, though.I'd just order in a couple more chips, but they're out of stock everywhere I've looked, and won't be back in til next month.

author: David_AVD
author_rank: Super Contributor
timestamp: April 07, 2014, 06:09:25 am
content: I assume the required decoupling capacitors are there?

author: Psi
author_rank: Super Contributor
timestamp: April 07, 2014, 07:22:05 am
content: So you can still flash code to the MCU ?Dump out the fuse bits and check if they match the defaults (or what you set them too)It's not uncommon to get corruptions causing random flash/fuse memory writes, especially if you are running from unstable power with the brownout detector switched offAlso confirm the RESET line is high. If it was stuck low for some reason then programming would still work but it would never run code.

author: Skimask
author_rank: Super Contributor
timestamp: April 07, 2014, 01:34:43 pm
content: Quote from: rexxar on April 07, 2014, 06:05:17 amHuh?http://www.findchips.com/search/atmega32u4

author: rexxar
author_rank: Frequent Contributor
timestamp: April 07, 2014, 03:05:15 pm
content: Quote from: Skimask on April 07, 2014, 01:34:43 pmHuh. I guess Newark got some stock in before the others. I swear they were out last time I checked.Quote from: David_AVD on April 07, 2014, 06:09:25 amYup. There's probably not enough bypassing (this is my first go with a uC), but it's worked well enough so far. I'll add some and try again later.Quote from: Psi on April 07, 2014, 07:22:05 amFuse bits are getting set correctly, and they are sticking. I'm running from a lithium cell, so it's a pretty stable supply, and brownout detection is enabled.RESET is also behaving correctly.

author: David_AVD
author_rank: Super Contributor
timestamp: April 07, 2014, 09:04:12 pm
content: Quote from: rexxar on April 07, 2014, 03:05:15 pmAre you sure the brownout detector is set at a suitable level for the battery voltage? I'm not sure if it's settable like PICs are, but thought it worth mentioning.Also, with a battery supply, you should probably have a small electro cap across it to lower the impedance.

author: rexxar
author_rank: Frequent Contributor
timestamp: April 07, 2014, 10:58:52 pm
content: Quote from: David_AVD on April 07, 2014, 09:04:12 pmI put 47u across the battery and another 2u or so of bypassing, and it's still not working.Brownout detection is set at 2.6v, and the battery is 3.7V. I just disabled it to see what would happen, and nothing's changed.It seems sort of odd to me that all the outputs would be dead, there's five separate ports. I assume that means the drivers are physically separate between ports? It'd be interesting to see JTAG debugging could turn the pins on, but I don't have a JTAG programmer.

author: HackedFridgeMagnet
author_rank: Super Contributor
timestamp: April 07, 2014, 11:45:25 pm
content: QuoteWhere is code? Why turning off oscillator?

author: rexxar
author_rank: Frequent Contributor
timestamp: April 08, 2014, 12:16:59 am
content: Quote from: HackedFridgeMagnet on April 07, 2014, 11:45:25 pmI meant that it was putting the uC into powerdown mode. I had just changed how the code decided when to shut down, so I thought it might be turning itself off regardless of conditions...At any rate, that code isn't even on there right now.

author: David_AVD
author_rank: Super Contributor
timestamp: April 08, 2014, 12:21:38 am
content: By "code is set to turn off" do you mean sleep mode?Have you gone back to basics with some blinking LED code?

author: rexxar
author_rank: Frequent Contributor
timestamp: April 08, 2014, 01:01:50 am
content: Quote from: David_AVD on April 08, 2014, 12:21:38 amYes. I was using the power-down mode, and coming back with an interrupt tied to a button. (Sorry my first post was unclear, it was late..)QuoteYup. All the IO pins just sit at ground no matter what I do.

author: TerminalJack505
author_rank: Super Contributor
timestamp: April 08, 2014, 01:11:44 am
content: By running the MCU at 16MHz with just 3.7V you are overclocking the part. The minimum voltage for 16MHz operation is 4.5V.You might try adjusting one of those two parameters and see if the problem goes away.

author: rexxar
author_rank: Frequent Contributor
timestamp: April 08, 2014, 03:05:48 am
content: Quote from: TerminalJack505 on April 08, 2014, 01:11:44 amIt's worked fine for the last month or moreIt's powered from 5V during programming anyway, but I set it to use the internal 8MHz oscillator with no change.

author: David_AVD
author_rank: Super Contributor
timestamp: April 08, 2014, 03:12:39 am
content: Maybe time for a picture and schematic?

author: rexxar
author_rank: Frequent Contributor
timestamp: April 13, 2014, 03:56:21 am
content: Oops, forgot to reply to this thread. I ordered in a new uC and it worksI must've killed the first one with ESD or something, who knows?Naturally I killed the second one by programming the fuse bits wrongNow I need to build up a high voltage programmer to recover it.