-
Notifications
You must be signed in to change notification settings - Fork 73
Description
I use with arduino Nano and upload with usbasp (ICSP), which means it is not programmed with a bootloader
I think using other programmer that doesn't use the bootloader will also reproduce the problem.
Problem:
After a first wdt_timeout ,
the nano hangs with crazy resetting (I use with apa102 led, so I see them showing my setup indicator repeatingly) , and reset button doesn't help, I would need to re-program the nano to get it work.
Later I found that by adding a clear flag of {MCUSR = 0;} just under "setup()// which a line found in <avr/wdt.h>
and followed by a { Watchdog.disable();} can stop wdt_hanging after a wdt_reset. and program can run good again.
but {MCUSR = 0;} or {Watchdog.disable();}alone will not work, they are both needed and {MCUSR = 0;} should done first. I guess clearing the wdt reset flag (not sure if it is or not?) is very essential in this case.
please add this in your library, maybe like a Watchdog.begin() ?
because it is a simple fix for users using ICSP, other fixes are pretty complex and I can't handle.