watchdog arduino due and reset software

hi, i have one arduino due, I can't use the watchdog. help me please.

tx

it's possible have one example and address for download the library for watchdog for arduino due tx.

best reagrds

post your code you're trying to use.

Hi,

exabple blink, but i whant put the watchdog.

help please with example por use watchdow with arduino due.

tx

After installing a recent version of the Arduino IDE (watchdog was added recently... 1.6.5 maybe?) you need two things to use the watchdog:

void watchdogSetup()
{
   watchdogEnable(34);
}

void setup()
{
}

void loop()
{
   watchdogReset();
}

So, the two things are a function called watchdogSetup that contains a call to watchdogEnable, and then calling watchdogReset in the main loop. watchdogEnable takes as a parameter the watchdog timeout in 1/256 of a second increments. So, a value of 34, as above, is 34/256 seconds or 133 milliseconds.

the parameter of watchdogEnable is in milliseconds

void watchdogEnable (uint32_t timeout)
{
       /* this assumes the slow clock is running at 32.768 kHz
          watchdog frequency is therefore 32768 / 128 = 256 Hz */
       timeout = timeout * 256 / 1000;
       if (timeout == 0)
               timeout = 1;
       else if (timeout > 0xFFF)
               timeout = 0xFFF;
       timeout = WDT_MR_WDRSTEN | WDT_MR_WDV(timeout) | WDT_MR_WDD(timeout);
       WDT_Enable (WDT, timeout);
}

Oh, thanks. I missed that. The watchdog is running with 1/256 timing like I said but I didn't realize that they switched the parameter to be in milliseconds and not actual watchdog ticks. I swear it used to be watchdog ticks but maybe not.