WDT for long time deepSleep


I'm using a mkr1200 with LowPower.deepSleep(10*60*1000), so 10 minutes in deep sleep mode.

I wan't to implement a watchdog and I've seen in the WDTZero library that the SAMD21 has something called Early Warning Timer (EWT) that could fit, as it allows a soft WDT up to 16 minutes.

However, If I setup the WDTZero, it never waits 16 minutes, but seems to make the reset after about 16s (that is the max hard WDT).

Have somebody tried this?


Hi avelo,

By default 16 seconds is the WDT's maximum time before reset.

The early warning timer can activate an interrupt to take some form of action, either to prepare for, or to try to prevent a WDT microcontroller reset. It can occur at preset clock intervals from 8ms to 16s after the WDT timer has been cleared.

Hi MartinL,

Thanks for answer. The WDTZero library (example here) provides watchdog with both hardware (up to 16s) and software (up to 16m, using the Early Warning Timer) timers.

The example sets a WDT timer of 32s and works nicely, resetting if you don't clear the watchdog in 32s. The problem for me is that i am using the lowpower library and it seems to somehow interfere with the wdt, making the board to reset after 16s even when a longer wdt software timer was set

Hi avelo,

The SAMD21 datasheet assumes that the WDT is being clocked with a 1.024kHz generic clock, in order to generate the 8ms to 16s time-outs.

It’s possible to configure the WDT’s generic clock to run at a lower frequency, to get longer time-outs. However, the penalty you pay is longer register synchronization times. The register synchronization time for a 1.024kHz generic clock is approximately 6ms.