Professional Documents
Culture Documents
****************************************
W D T M O D U L E
****************************************
****************************************
VERSION HISTORY
****************************************
INSTALL THE LIBRARY
****************************************
FUNCTIONS
Currently the library supports a part of the functions provided by the WDT
(WatchDog Timer) of the SAM3X8E. The WatchDog Timer is a timer that can reset
the microcontroller if the code becomes trapped in a deadlock. The user can
choose the interval in milliseconds between 1 and 16000.
To access the WDT clock you have to use the "wdt" object.
Its methods are the following:
wdt.enable(interval);
it sets the WDT to trigger after "interval" milliseconds if the user doesn't
reset the timer first. If interval is not passed, 16 is choosen by default.
wdt.disable();
it disables the WDT so that the WDT doesn't reset the MCU anymore
wdt.restart();
this MUST be put at the end of your code. It is needed to restart the WDT
counter
so that it cannot reset the MCU.
If the WDT counter reaches zero before the wdt.restart(), the MCU will be reset.
Page 1
WDT_MODULE
NOTE:
the WDT timer can only be set ONCE so after you had set it up, there's only
a reset to re-set it again.
If you think you won't use WDT in your sketch, put a wdt.disable() at the
very first position of setup() to disable the Watchdog timer (by default,
it resets after 16 seconds).
****************************************
IMPORTANT!
To use the Watchdog Timer module you have to edit the following file of the
Arduino core:
/arduino-1.5.x/hardware/arduino/sam/variants/arduino_due_x/variant.cpp
and comment the line #377 so that it will change from
WDT_Disable(WDT);
to
//WDT_Disable(WDT);
Keep in mind that after this modify, ALL of you sketches will have to disable
the
WDT first in order to avoid a system reset!
****************************************
LICENSE
****************************************
DOCUMENT REVISION
Page 2