RTC Watchdog
The Alarm2 of the RTC is connected to a Watchdog reset circuit which permits to reset the microcontroller of Waspmote when the Alarm2 is triggered.

Setting RTC Watchdog

The setWatchdog() function sets the RTC Watchdog to the specified time. The input parameter specifies the time in minutes (1-59) the Watchdog will wait to reset the Waspmote microcontroller.
When this function is called, the Alarm2 is set and no more functions need to be executed.
It returns nothing, but when the Alarm2 matches the time (minutes), the microcontroller will be reset.
Example of use:
1
{
2
RTC.setWatchdog(1);
3
}
Copied!

Unsetting RTC Watchdog

The unSetWatchdog() function disables the RTC Watchdog.
When this function is executed, the RTC Watchdog is disabled and the microcontroller will not be reset.
It returns nothing.
Example of use:
1
{
2
RTC.unSetWatchdog();
3
}
Copied!

Getting RTC Watchdog

The getWatchdog() function gets the RTC Watchdog time.
It returns a string containing time and date for the next RTC Watchdog reset.
Example of use:
1
{
2
USB.println(RTC.getWatchdog());
3
}
Copied!

Use of the RTC Watchdog

This RTC Watchdog has been implemented for reseting Waspmote if it gets stuck. That periodical reset avoids erratic behaviour.
This is highly recommended for applications that need to be very robust and can never stop working. This feature ensures that Waspmote will never stop working.
RTC Watchdog requires the Watchdog switch to be turned on correctly.
Figure: RTC Watchdog switch
An example of the use of RTC Watchdog: https://development.libelium.com​/rtc-10-set-watchdog/
What you need to do is to set the Watchdog in the setup and then on each loop disable and enable it again. If the code disables the Watchdog before it actuates, it means that everything went well and there was no need for a reset; then the code should activate the Watchdog again. So the user will have to adjust the reset time to be a bit longer than the normal time from loop to loop. If Waspmote gets stuck (detected because this timeout expired), Waspmote will be automatically reset when the time set in the RTC Watchdog matches the current time. The Watchdog corrects any erratic behaviour in minutes.