javos65 / WDTZero

Allows to use the WatchDog functionality for Arduino Zero, MKRZero and MKR1000 only
15 stars 12 forks source link

Function to Disable WatchDog until Re-Enabled with Another Function #15

Open bibletech55 opened 1 year ago

bibletech55 commented 1 year ago

Hello there!

I'm working on a microcontroller project using the TinyZero, a derivative of the Arduino Zero, and I want it to be able to sleep for an extended period of time. My current design for low power uses the standard Arduino Low Power library, which allows the board to sleep and save power. I cannot run code during this sleep state, only after the board wakes up. But I also wish to use the SAMD21's built-in Watchdog timer for it's assistance in reliability and resetting the board if unforeseen errors arise. My problem is that when the board sleeps with Low Power, the WatchDog timer will eventually reset the board, as I cannot use clear() to feed the watchdog, and it thus thinks the board froze and resets it, bringing it out of sleep mode (the Watchdog is not put to sleep with the rest of the board). One solution would be disabling the Watchdog timer before setting the board to sleep, but I've checked the example and source code here on GitHub and I cannot find a function to disable a previously-established Watchdog. Would it be possible to add a function that, when called, disables the Watchdog such that it won't reset the board until re-enabled by a separate function? This would greatly enhance compatibility and utility of the library.

Thank you, Isaac White