WDOG - Watchdog#

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.

Modules#

WDOG_Init_TypeDef

Enumerations#

enum
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
wdogWarnDisable = 0
wdogWarnTime25pct = 1
wdogWarnTime50pct = 2
wdogWarnTime75pct = 3
}

Select Watchdog warning timeout period as percentage of timeout.

enum
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.

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.

SL_DEPRECATED_API_SDK_4_1 void
WDOG_Enable(bool enable)

Enable/disable the Watchdog timer.

SL_DEPRECATED_API_SDK_4_1 void
WDOG_Feed(void)

Feed the Watchdog.

SL_DEPRECATED_API_SDK_4_1 void
WDOG_Init(const WDOG_Init_TypeDef *init)

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

SL_DEPRECATED_API_SDK_4_1 void
WDOG_Lock(void)

Lock the Watchdog configuration.

SL_DEPRECATED_API_SDK_4_1 bool

Get enabled status of the Watchdog.

SL_DEPRECATED_API_SDK_4_1 bool

Get locked status of the Watchdog.

Macros#

#define

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 instance for deprecated functions.

#define

Suggested default configuration for WDOG initialization structure.

Enumeration Documentation#

WDOG_PeriodSel_TypeDef#

WDOG_PeriodSel_TypeDef

Watchdog clock selection.

Watchdog period selection.

Enumerator
wdogPeriod_9

9 clock periods

wdogPeriod_17

17 clock periods

wdogPeriod_33

33 clock periods

wdogPeriod_65

65 clock periods

wdogPeriod_129

129 clock periods

wdogPeriod_257

257 clock periods

wdogPeriod_513

513 clock periods

wdogPeriod_1k

1025 clock periods

wdogPeriod_2k

2049 clock periods

wdogPeriod_4k

4097 clock periods

wdogPeriod_8k

8193 clock periods

wdogPeriod_16k

16385 clock periods

wdogPeriod_32k

32769 clock periods

wdogPeriod_64k

65537 clock periods

wdogPeriod_128k

131073 clock periods

wdogPeriod_256k

262145 clock periods


Definition at line 76 of file platform/emlib/inc/em_wdog.h

WDOG_WarnSel_TypeDef#

WDOG_WarnSel_TypeDef

Select Watchdog warning timeout period as percentage of timeout.

Enumerator
wdogWarnDisable

Watchdog warning period is disabled.

wdogWarnTime25pct

Watchdog warning period is 25% of the timeout.

wdogWarnTime50pct

Watchdog warning period is 50% of the timeout.

wdogWarnTime75pct

Watchdog warning period is 75% of the timeout.


Definition at line 98 of file platform/emlib/inc/em_wdog.h

WDOG_WinSel_TypeDef#

WDOG_WinSel_TypeDef

Select Watchdog illegal window limit.

Enumerator
wdogIllegalWindowDisable

Watchdog illegal window disabled.

wdogIllegalWindowTime12_5pct

Window timeout is 12.5% of the timeout.

wdogIllegalWindowTime25_0pct

Window timeout is 25% of the timeout.

wdogIllegalWindowTime37_5pct

Window timeout is 37.5% of the timeout.

wdogIllegalWindowTime50_0pct

Window timeout is 50% of the timeout.

wdogIllegalWindowTime62_5pct

Window timeout is 62.5% of the timeout.

wdogIllegalWindowTime75_0pct

Window timeout is 75% of the timeout.

wdogIllegalWindowTime87_5pct

Window timeout is 87.5% of the timeout.


Definition at line 109 of file platform/emlib/inc/em_wdog.h

Function Documentation#

WDOGn_Enable#

void WDOGn_Enable (WDOG_TypeDef * wdog, bool enable)

Enable/disable the watchdog timer.

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.

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.


Definition at line 75 of file platform/emlib/src/em_wdog.c

WDOGn_Feed#

void WDOGn_Feed (WDOG_TypeDef * wdog)

Feed WDOG.

Parameters
[in]wdog

A pointer to the WDOG peripheral register block.

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.


Definition at line 141 of file platform/emlib/src/em_wdog.c

WDOGn_Init#

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

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

Parameters
[in]wdog

Pointer to the WDOG peripheral register block.

[in]init

The structure holding the WDOG configuration. A default setting WDOG_INIT_DEFAULT is available for initialization.

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.


Definition at line 203 of file platform/emlib/src/em_wdog.c

WDOGn_Lock#

void WDOGn_Lock (WDOG_TypeDef * wdog)

Lock the WDOG configuration.

Parameters
[in]wdog

A pointer to WDOG peripheral register block.

This prevents errors from overwriting the WDOG configuration, possibly disabling it. Only a reset can unlock the WDOG configuration once locked.

If the LFRCO or LFXO clocks are used to clock WDOG, consider using the option of inhibiting those clocks to be disabled. See the WDOG_Enable() initialization structure.

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.


Definition at line 298 of file platform/emlib/src/em_wdog.c

WDOGn_SyncWait#

void WDOGn_SyncWait (WDOG_TypeDef * wdog)

Wait for the WDOG to complete all synchronization of register changes and commands.

Parameters
[in]wdog

A pointer to WDOG peripheral register block.


Definition at line 321 of file platform/emlib/src/em_wdog.c

WDOGn_Unlock#

void WDOGn_Unlock (WDOG_TypeDef * wdog)

Unlock the WDOG configuration.

Parameters
[in]wdog

A pointer to WDOG peripheral register block.

Note that this function will have no effect on devices where a reset is the only way to unlock the watchdog.


Definition at line 345 of file platform/emlib/src/em_wdog.c

WDOGn_IntClear#

void WDOGn_IntClear (WDOG_TypeDef * wdog, uint32_t flags)

Clear one or more pending WDOG interrupts.

Parameters
[in]wdog

Pointer to the WDOG peripheral register block.

[in]flags

WDOG interrupt sources to clear. Use a set of interrupt flags OR-ed together to clear multiple interrupt sources.


Definition at line 292 of file platform/emlib/inc/em_wdog.h

WDOGn_IntDisable#

void WDOGn_IntDisable (WDOG_TypeDef * wdog, uint32_t flags)

Disable one or more WDOG interrupts.

Parameters
[in]wdog

Pointer to the WDOG peripheral register block.

[in]flags

WDOG interrupt sources to disable. Use a set of interrupt flags OR-ed together to disable multiple interrupt.


Definition at line 312 of file platform/emlib/inc/em_wdog.h

WDOGn_IntEnable#

void WDOGn_IntEnable (WDOG_TypeDef * wdog, uint32_t flags)

Enable one or more WDOG interrupts.

Parameters
[in]wdog

Pointer to the WDOG peripheral register block.

[in]flags

WDOG interrupt sources to enable. Use a set of interrupt flags OR-ed together to set multiple interrupt.

Note

  • Depending on the use, a pending interrupt may already be set prior to enabling the interrupt. To ignore a pending interrupt, consider using WDOG_IntClear() prior to enabling the interrupt.


Definition at line 337 of file platform/emlib/inc/em_wdog.h

WDOGn_IntGet#

uint32_t WDOGn_IntGet (WDOG_TypeDef * wdog)

Get pending WDOG interrupt flags.

Parameters
[in]wdog

Pointer to the WDOG peripheral register block.

Note

  • The event bits are not cleared by the use of this function.

Returns

  • Pending WDOG interrupt sources. Returns a set of interrupt flags OR-ed together for the interrupt sources set.


Definition at line 360 of file platform/emlib/inc/em_wdog.h

WDOGn_IntGetEnabled#

uint32_t WDOGn_IntGetEnabled (WDOG_TypeDef * wdog)

Get enabled and pending WDOG interrupt flags.

Parameters
[in]wdog

Pointer to the WDOG peripheral register block.

Useful for handling more interrupt sources in the same interrupt handler.

Returns

  • Pending and enabled WDOG interrupt sources. Returns a set of interrupt flags OR-ed together for the interrupt sources set.


Definition at line 379 of file platform/emlib/inc/em_wdog.h

WDOGn_IntSet#

void WDOGn_IntSet (WDOG_TypeDef * wdog, uint32_t flags)

Set one or more pending WDOG interrupts from SW.

Parameters
[in]wdog

Pointer to the WDOG peripheral register block.

[in]flags

WDOG interrupt sources to set to pending. Use a set of interrupt flags (WDOG_IFS_nnn).


Definition at line 400 of file platform/emlib/inc/em_wdog.h

WDOGn_IsEnabled#

bool WDOGn_IsEnabled (WDOG_TypeDef * wdog)

Get enabled status of the Watchdog.

Parameters
[in]wdog

Pointer to the WDOG peripheral register block.

Returns

  • True if Watchdog is enabled.


Definition at line 420 of file platform/emlib/inc/em_wdog.h

WDOGn_IsLocked#

bool WDOGn_IsLocked (WDOG_TypeDef * wdog)

Get locked status of the Watchdog.

Parameters
[in]wdog

Pointer to the WDOG peripheral register block.

Returns

  • True if Watchdog is locked.


Definition at line 439 of file platform/emlib/inc/em_wdog.h

WDOG_Enable#

SL_DEPRECATED_API_SDK_4_1 void WDOG_Enable (bool enable)

Enable/disable the Watchdog timer.

Parameters
[in]enable

Set to true to enable Watchdog, false to disable. Watchdog cannot be disabled if Watchdog has been locked.


Definition at line 460 of file platform/emlib/inc/em_wdog.h

WDOG_Feed#

SL_DEPRECATED_API_SDK_4_1 void WDOG_Feed (void )

Feed the Watchdog.

Parameters
N/A

Definition at line 473 of file platform/emlib/inc/em_wdog.h

WDOG_Init#

SL_DEPRECATED_API_SDK_4_1 void WDOG_Init (const WDOG_Init_TypeDef * init)

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

Parameters
[in]init

Structure holding Watchdog configuration. A default setting WDOG_INIT_DEFAULT is available for initialization.


Definition at line 491 of file platform/emlib/inc/em_wdog.h

WDOG_Lock#

SL_DEPRECATED_API_SDK_4_1 void WDOG_Lock (void )

Lock the Watchdog configuration.

Parameters
N/A

Definition at line 504 of file platform/emlib/inc/em_wdog.h

WDOG_IsEnabled#

SL_DEPRECATED_API_SDK_4_1 bool WDOG_IsEnabled (void )

Get enabled status of the Watchdog.

Parameters
N/A

Returns

  • True if Watchdog is enabled.


Definition at line 520 of file platform/emlib/inc/em_wdog.h

WDOG_IsLocked#

SL_DEPRECATED_API_SDK_4_1 bool WDOG_IsLocked (void )

Get locked status of the Watchdog.

Parameters
N/A

Returns

  • True if Watchdog is locked.


Definition at line 536 of file platform/emlib/inc/em_wdog.h

Macro Definition Documentation#

WDOG_SYNC_TIMEOUT#

#define WDOG_SYNC_TIMEOUT
Value:
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.

This will happen when for instance some watchdog register is modified while the watchdog clock is disabled. In these scenarioes we need to make sure that the software does not wait forever.


Definition at line 52 of file platform/emlib/src/em_wdog.c

DEFAULT_WDOG#

#define DEFAULT_WDOG
Value:
WDOG0

Default WDOG instance for deprecated functions.


Definition at line 56 of file platform/emlib/inc/em_wdog.h

WDOG_INIT_DEFAULT#

#define WDOG_INIT_DEFAULT
Value:
{ \
true, /* Start Watchdog when initialization is done. */ \
false, /* WDOG is not counting during debug halt. */ \
false, /* The clear bit will clear the WDOG counter. */ \
false, /* WDOG is not counting when in EM2. */ \
false, /* WDOG is not counting when in EM3. */ \
false, /* EM4 can be entered. */ \
false, /* PRS Source 0 missing event will not trigger a WDOG reset. */ \
false, /* PRS Source 1 missing event will not trigger a WDOG reset. */ \
false, /* Do not lock WDOG configuration. */ \
wdogPeriod_256k, /* Set longest possible timeout period. */ \
wdogWarnDisable, /* Disable warning interrupt. */ \
wdogIllegalWindowDisable, /* Disable illegal window interrupt. */ \
false /* Do not disable reset. */ \
}

Suggested default configuration for WDOG initialization structure.


Definition at line 219 of file platform/emlib/inc/em_wdog.h