DUE Watchdog usage

Hey Bob,

I did find out I needed to use the board manager to install Due support. I'm searching my drive for the files right now.

Kopples, I take a look at your suggestions.

Thanks,
-j

Ok found the files. Sheesh. That's an obscure location.

C:\Users\DUC\AppData\Roaming\Arduino15\packages\arduino\hardware\sam\1.6.3\variants\arduino_due_x

Now to get the WDT up and working.

Cheers,
-j

Hey Bob,

I made the file changes and additions as per your pull. As far as using it in setup() and loop(), what needs to be done?

Thanks,
-j

Here is one of the test cases I used which should illustrate it's use:

// Due Watchdog test case
// - enable the watchdog and demonstrate that wdt_reset() prevents timeout

void watchdogSetup(void)
{
  watchdogEnable(1000);
}

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.println ("start");
}

void loop() {
  // put your main code here, to run repeatedly:

  // this should not cause a watchdog timeout
  while (1){
    delay (100);
    Serial.println(millis());
    watchdogReset();
  }
  
}

Thank you sir. I'll give it a try.
-j

It works great. I tried a couple scenarios to force a system reset and to operate properly with the watchdog running in the background.

Thanks,
-j

koppels

I followed your instructions in Watchdog DUE - Arduino Due - Arduino Forum and your code to test the watchdog function works fine.

Can you supply code how to use to use regulary

Thanks

I was trying to use the great data in this thread but found at my 1.6.7 level the WDT_disable() call is no longer in the arduino_due_x\variant.cpp file.
What seems to have happened is the introduction of watchdog.cpp and watchdog.h in arduino\hardware\sam\1.6.7\cores\arduino directory.

Within the watchdog.cpp there is a watchdogSetup() defined so that it has a weak reference to a WDT_disable(WDT); call. This stops the watchdog timer interupting sketches that dont use it.
So if you want to use the watchdog timer at this level, enable it by putting the following in your sketch.

void watchdogSetup(void) { }

This function can be empty as shown and creates a strong reference thus overiding the WDT_disable(WDT).

Then you should be able to use the "watchdog.h" or "wdt.h" calls.