Here's a weird problem.
I noticed one device that was resetting spuriously, and I traced it to the watchdog. The odd part is that it's timing out far too fast compared to the settings. I tested it:
|WDT Setting||Actual Time measured|
wdt_reset(); PINONC(0); while(1);
I measured the pin with a scope to measure how long a reset took, and recorded the values above. This is an ATMEGA328. It's consistently timing out at 3/16 of what I tell it to.
This is a very strange problem. I've only noticed it on one chip, so the only reason I can come up with is a faulty 128k oscillator, or some stuck bits internally in its counter or comparator. Is there any other explanation? Does this really happen? Seems unbelievable but I can't think of anything else.