WDOG - Watchdog

Description

Watchdog (WDOG) Peripheral API.

This module contains functions to control the WDOG peripheral of Silicon Labs 32-bit MCUs and SoCs. The WDOG resets the system in case of a fault condition.

Data Structures

struct WDOG_Init_TypeDef
Watchdog initialization structure.

Functions

void WDOGn_Enable (WDOG_TypeDef *wdog, bool enable)
Enable/disable the watchdog timer.
void WDOGn_Feed (WDOG_TypeDef *wdog)
Feed WDOG.
void WDOGn_Init (WDOG_TypeDef *wdog, const WDOG_Init_TypeDef *init)
Initialize WDOG (assuming the WDOG configuration has not been locked).
void WDOGn_Lock (WDOG_TypeDef *wdog)
Lock the WDOG configuration.
void WDOGn_SyncWait (WDOG_TypeDef *wdog)
Wait for the WDOG to complete all synchronization of register changes and commands.
void WDOGn_Unlock (WDOG_TypeDef *wdog)
Unlock the WDOG configuration.
void WDOGn_IntClear (WDOG_TypeDef *wdog, uint32_t flags)
Clear one or more pending WDOG interrupts.
void WDOGn_IntDisable (WDOG_TypeDef *wdog, uint32_t flags)
Disable one or more WDOG interrupts.
void WDOGn_IntEnable (WDOG_TypeDef *wdog, uint32_t flags)
Enable one or more WDOG interrupts.
uint32_t WDOGn_IntGet (WDOG_TypeDef *wdog)
Get pending WDOG interrupt flags.
uint32_t WDOGn_IntGetEnabled (WDOG_TypeDef *wdog)
Get enabled and pending WDOG interrupt flags.
void WDOGn_IntSet (WDOG_TypeDef *wdog, uint32_t flags)
Set one or more pending WDOG interrupts from SW.
bool WDOGn_IsEnabled (WDOG_TypeDef *wdog)
Get enabled status of the watchdog.
bool WDOGn_IsLocked (WDOG_TypeDef *wdog)
Get locked status of the watchdog.
void WDOG_Enable (bool enable)
Enable/disable the watchdog timer.
void WDOG_Feed (void)
Feed the watchdog.
void WDOG_Init (const WDOG_Init_TypeDef *init)
Initialize watchdog (assuming the watchdog configuration has not been locked).
void WDOG_Lock (void)
Lock the watchdog configuration.
bool WDOG_IsEnabled (void)
Get enabled status of the watchdog.
bool WDOG_IsLocked (void)
Get locked status of the watchdog.

Macros

#define WDOG_SYNC_TIMEOUT 30000
In some scenarioes when the watchdog is disabled the synchronization register might be set and not be cleared until the watchdog is enabled again.
#define DEFAULT_WDOG WDOG0
Default WDOG instance for deprecated functions.
#define WDOG_INIT_DEFAULT
Suggested default configuration for WDOG initialization structure.

Enumerations

enum WDOG_PeriodSel_TypeDef {
wdogPeriod_9 = 0x0,
wdogPeriod_17 = 0x1,
wdogPeriod_33 = 0x2,
wdogPeriod_65 = 0x3,
wdogPeriod_129 = 0x4,
wdogPeriod_257 = 0x5,
wdogPeriod_513 = 0x6,
wdogPeriod_1k = 0x7,
wdogPeriod_2k = 0x8,
wdogPeriod_4k = 0x9,
wdogPeriod_8k = 0xA,
wdogPeriod_16k = 0xB,
wdogPeriod_32k = 0xC,
wdogPeriod_64k = 0xD,
wdogPeriod_128k = 0xE,
wdogPeriod_256k = 0xF
}
Watchdog clock selection.
enum WDOG_WarnSel_TypeDef {
wdogWarnDisable = 0,
wdogWarnTime25pct = 1,
wdogWarnTime50pct = 2,
wdogWarnTime75pct = 3
}
Select watchdog warning timeout period as percentage of timeout.
enum WDOG_WinSel_TypeDef {
wdogIllegalWindowDisable = 0,
wdogIllegalWindowTime12_5pct = 1,
wdogIllegalWindowTime25_0pct = 2,
wdogIllegalWindowTime37_5pct = 3,
wdogIllegalWindowTime50_0pct = 4,
wdogIllegalWindowTime62_5pct = 5,
wdogIllegalWindowTime75_0pct = 6,
wdogIllegalWindowTime87_5pct = 7
}
Select watchdog illegal window limit.

Function Documentation

WDOGn_Enable()

void WDOGn_Enable ( WDOG_TypeDef * wdog,
bool enable
)

Enable/disable the watchdog timer.

Note
This function modifies the WDOG CTRL register which requires synchronization into the low-frequency domain. If this register is modified before a previous update to the same register has completed, this function will stall until the previous synchronization has completed.
Parameters
[in] wdog A pointer to the WDOG peripheral register block.
[in] enable True to enable Watchdog, false to disable. Watchdog cannot be disabled if it's been locked.

WDOGn_Feed()

void WDOGn_Feed ( WDOG_TypeDef * wdog )

Feed WDOG.

When WDOG is activated, it must be fed (i.e., clearing the counter) before it reaches the defined timeout period. Otherwise, WDOG will generate a reset.

Note
Note that WDOG is an asynchronous peripheral and when calling the WDOGn_Feed() function the hardware starts the process of clearing the counter. This process takes some time before it completes depending on the selected oscillator (up to 4 peripheral clock cycles). When using the ULFRCO for instance as the oscillator the watchdog runs on a 1 kHz clock and a watchdog clear operation might take up to 4 ms.

If the device enters EM2 or EM3 while a command is in progress then that command will be aborted. An application can use WDOGn_SyncWait() to wait for a command to complete.

Parameters
[in] wdog A pointer to the WDOG peripheral register block.

WDOGn_Init()

void WDOGn_Init ( WDOG_TypeDef * wdog,
const WDOG_Init_TypeDef * init
)

Initialize WDOG (assuming the WDOG configuration has not been locked).

Note
This function modifies the WDOG CTRL register which requires synchronization into the low-frequency domain. If this register is modified before a previous update to the same register has completed, this function will stall until the previous synchronization has completed.