Description
u8_get_app_watchdog_time_sec()
returns the time [seconds] after which the watchdog will reset the device in case it does not get triggered by the application in time. [seconds] – default: 0 (off)
The bootloader will start (if set > 0) the watchdog right before is jumps into the application, meaning the watchdog is not active in bootloader mode.
Syntax
u8_get_app_watchdog_time_sec();
Parameters
none
Returns
uint8_t – the watchdog time in [seconds].
Example Code
This example shows how to read, set and store the ‘application watchdog time’ of the bootloader settings and how to trigger the watchdog.
void setup()
{
Serial.begin();
while (!Serial)
{
yield(); // wait for PC CAN2SER-monitor to open
}
Serial.println("Current bootloader settings:");
Serial.print(" - app. watchdog: ");
if(BOOTLOADER_SETTING.u8_get_app_watchdog_time_sec() != 0)
Serial.println( String( BOOTLOADER_SETTING.u8_get_app_watchdog_time_sec() ) + "sec");
else
Serial.println( String("off"));
delay(2000);
Serial.println("Modify the settings");
BOOTLOADER_SETTING.u8_set_app_watchdog_time_sec(8);
delay(2000);
Serial.println("Store the settings in flash");
uint8_t u8_ret = BOOTLOADER_SETTING.u8_store_bootloader_settings();
if(u8_ret != 0)
Serial.println("Error writing into flash");
Serial.println("DONE");
}
void loop ()
{
BOOTLOADER_SETTING.u8_trigger_wdog();
}
Notes and Warnings
Use the function u8_trigger_wdog() to trigger the watchdog regularly.
See also
u8_store_bootloader_settings()
u8_set_app_watchdog_time_sec()
u8_trigger_wdog()
SAMC21_CAN