OCDEN Fuse (minor rant)
2011-10-13 by Phillip Vogel
I've been scratching my head for a while, trying to figure out why a Mega644PA was drawing something over 1.6mA while in SLEEP_MODE_PWR_DOWN. I had all the fuses set, all the peripherals disabled, all the ports set to draw the least current. The chip looked like it was going to sleep - it obediently sat and waited for a pin-change interrupt, and then continued execution when I pressed the appropriate button. But this was something like 1000 times the expected current. I tried shorting the crystal to ground, just to see what would happen, and the current went down a bit. This indicated to me that, even though it was supposed to be stopped, the clock was actually running. WTF? Then, I reconnected the JTAGICE MKII (for the hundredth time today), and this time I exited debug mode before disconnecting it. That fixed the problem and the chip now sleeps at sub-2uA consumption. So, it appears that activation the JTAG debugger also activates the OCDEN fuse, and unless you exit debug mode methodically, OCDEN remains programmed (and the clock continues to run in all sleep modes). Now that I'm aware of this, I can live with it. But, WHERE IN THE DOCUMENTATION AM I WARNED ABOUT THIS? I really don't recall seeing it anywhere. But I'm feeling MUCH better now that I know my battery won't die after a couple of days of idle time... [Non-text portions of this message have been removed]