(migrated from the Programming Questions forum...)
I'm running some Leonardo clones. One day as an experiment, on two of my boards, I enabled the watchdog timer with WDTO_15MS
. Big mistake.
Now, after I run the bootloader on those boards (but see PS below), my sketch goes into continual reset mode. This does not happen on the boards that were never programmed with WDTO_15MS
, even running the identical sketch.
I thought I could fix it by disabling the wdt as early as possible:
#include <avr/wdt.h>
...
void setup() {
g_mcusr = MCUSR;
MCUSR = 0;
wdt_disable();
...
}
... but that does not fix things.
Perhaps worth mentioning is that I cannot program the "broken" boards using the USB bootloader (see PS below). For those, I need to use an ISP programmer.
So perhaps the right question is: how do I really and truly disable the watchdog timer in these boards? I think I may need to raze memory altogether (and install a fresh bootloader). But I'm open to suggestions.
PS: More accurately, I believe the boards are going into continual reset mode after the USB reset command, not after loading the code.