DUE Watchdog usage

bobcousins:

gogol:
So I think, that the new weak function should be named WDT_Initialze(), to avoid confusion.

Are there any readers here, which work on the that layer of libraries?

I don't, but I think that would be a very useful patch! I'd like to use the watchdog in some code I am doing.

I guess to get it included requires a git pull request and some polite badgering on the Arduino dev list. :slight_smile:

I found the answer here: Reset the Arduino Due board using the watchdog - #3 by system - Arduino Due - Arduino Forum

You have first to edit the variants.cpp file in the Arduino core and comment the line "WDT_disable(WDT);" inside the init function.

Then, you are able to set the WDT again (which can be set only once) using:

#define __WDP_MS 2048 // edit this number accordingly
WDT_Enable ( WDT, 0x2000 | __WDP_MS | ( __WDP_MS << 16 ) );

and the you can call

WDT_Restart( WDT );

somewhere in the loop() function to avoid reboot.