Skip to content

<Nano> If using without bootloader, wdt_reset stucks #14

@Alan-NTHU

Description

@Alan-NTHU

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions