Watchdog modes

Informative

How to switch the watchdog mode. Binding rules: CHI-WDG-MUST-05 in Wdg — Requirements; signatures in API Reference.

Switch mode

Std_ReturnType r = Wdg_SetMode(WDG_MODE_ALTERNATIVE);
/* E_OK: mode switched; E_NOT_OK: development error (e.g. unsupported mode) */

Wdg_SetMode transitions the watchdog from its current mode to the requested one, applies that mode’s hardware settings, and resets the timeout to the mode’s default. The three modes are:

  • WDG_MODE_OFF — disabled (where the hardware allows).

  • WDG_MODE_NORMAL — normal running.

  • WDG_MODE_ALTERNATIVE — e.g. a longer timeout for startup or standby.

Typical use

/* enter a standby phase that needs a longer timeout */
Wdg_SetMode(WDG_MODE_ALTERNATIVE);

/* ... standby work ... */

/* return to normal running */
Wdg_SetMode(WDG_MODE_NORMAL);

Note

An unsupported mode raises WDG_DEVERR_PARAM_MODE and returns E_NOT_OK. For the logical strategy, Wdg_SetMode first evaluates the previous timeout: if it has already expired, the mode is not changed (CHI-WDG-SHOULD-03). Remember to re-arm the upper layer’s timer for the new mode’s trigger interval if you use the logical strategy.