Why the watchdog at Arduino works wrong?

gbaker:
Interesting. I just discovered this thread while trying to figure out why the watchdog doesn't appear to work on either of my boards (Mega2560 and Nano). I essentially wrote the exact same sketch as a test, and both my sketch and the one posted here have the exact same behavior: the watchdog times out as expected, but then the yellow led starts blinking very rapidly (10 Hz or so) and that's it...stuck.

I'm guessing that the bootrom doesn't like the watchdog reset. If I remove and re-apply power then the whole thing starts over again (works the first time, but gets stuck after watchdog reset).

You are correct, some bootloaders handle WDT interrupts correctly and others do not because they don't diable the WDT interrupts and their wait time for checking on new upload request can exceed the WDT time out value. There are people who have 'corrected' this for meg boards and such, but so far I don't think they have become the official distribution with the IDE nor are new mega boards shipping with upgraded bootloaders. There is stuff in the forum on this subject if you check around.

At least that is my understand of the issue.

Lefty