WDTC = 0x00000FFF; // very short timeout WDMOD = 0x03; // watchdog resets CPU WDFEED = 0xAA; // start watchdog WDFEED = 0x55;
* The WDT is running at reset with 16 seconds watchdog period (slow clock at 32.768 kHz) * and external reset generation enabled. The user must either disable it or * reprogram it to meet the application requires.
Hi,I'm new with Arduino due and your question is very interesting. I had a look of the mcu data sheet at chapter 17 (watchdog) and I tried to make it working. The first step is to avoid that the function init() inside the file variant.cpp (....\hardware\arduino\sam\variants\arduino_due_x) disable the watchdog by commenting the function WDT_disable(WDT) otherwise you'll not able to enable the watchdog later (the register REG_WDT_MR can be written only once) then in the setup() function inside the sketch I inserted the following instruction: REG_WDT_MR = 0x0fff2fff; In order to have the WDT activated. Now you can use the instruction to reset the WDT:REG_WDT_CR = 0xa5000001If you want to reset just avoid to execute the last instruction in the main() function and after 16seconds from the last call the WDT shall reset the mcu and the sketch start again.I hope my suggestion can be a good starting point.Kind Regards.P.s.: remember to remove the comments that you inserted in the variant.cpp file when you don't need the WDT inside your sketch.
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16