Skip to content

Watchdog

System watchdog functions.

Note: A Watchdog is a safeguard feature used to monitor the execution of programs or routines (tasks). It's specifically designed to detect and recover from anomalies like crashes or hanging tasks, ensuring that the system continues to function even when something goes wrong.

The system watchdog automatically checks for thread starvation or hung-up resources without the need for the implementor to write any extra functionality. It defaults to a 10 second timeout in which it gets implicitly fed by calling any function that waits on a thread for a definite amount of time. Only in cases where indefinite waits (osWaitForever) are required the implementor must explicitly call osWatchdogFeed() at least once every 10 seconds or suspend the watchdog beforehand.

Functions Overview

Name
osStatus_tosWatchdogFeed(void )
osStatus_tosWatchdogSuspendForThread(void )
osStatus_tosWatchdogResumeForThread(void )

Function Details

function osWatchdogFeed

cpp
osStatus_t osWatchdogFeed(
    void 
)

Return: staus code. osOK if the watchdog was successfully fed.

function osWatchdogSuspendForThread

cpp
osStatus_t osWatchdogSuspendForThread(
    void 
)

Return: staus code. osOK if the message was successfully suspended

Suspends the watchdog for the calling thread until it either gets resumed by a call to osWatchdogResumeForThread or any call to any function that suspends the thread for a definite time. Usually this function gets called before functions that wait indefinitely, e.g. reads from a UART.

function osWatchdogResumeForThread

cpp
osStatus_t osWatchdogResumeForThread(
    void 
)

Return: staus code. osOK if the watchdog was successfully resumed.

Resume the watchdog for a previously suspended thread.