Watchdog Timer#

Introduction#

The Watchdog Timer is used to generate an interrupt upon a timeout and to perform a reset in the event of a system failure, which may result from an external event such as an Electrostatic Discharge (ESD) pulse or a software malfunction. The interrupt can also be used as a wakeup source for transitioning from SLEEP/STANDBY to ACTIVE states.

Features supported by the Watchdog Timer

  • Independent window watchdog timer.

  • Interrupt is generated before the system reset is applied, which can be used as a wakeup source.

  • Individually controllable power domain for low-power applications.

  • Able to operate when the CPU is in the SLEEP state during power-save applications.

  • Configurable timeout period.

  • Option to be clocked using either a low-power internal RC (32 KHz) or an external 32KHz XTAL.

Configuration#

The Watchdog Timer can be configured using several parameters:

  1. Initialize the Watchdog Timer:sl_si91x_watchdog_init_timer

  2. Set Watchdog Parameters: Configure interrupt time, system reset time, and window time using sl_si91x_watchdog_set_configuration

  • For more information on configuring available parameters, see the respective peripheral example readme document.

Usage#

  • To read time values, use the following APIs:

  1. Read System-Reset Time:sl_si91x_watchdog_get_system_reset_time

  2. Read Interrupt Time:sl_si91x_watchdog_get_interrupt_time

  3. Read Window Time:sl_si91x_watchdog_get_window_time

Modules#

watchdog_timer_clock_config_t

watchdog_timer_config_t

sl_watchdog_timer_version_t

Enumerations#

enum
TIME_DELAY_0
TIME_DELAY_1
TIME_DELAY_2
TIME_DELAY_3
TIME_DELAY_4
TIME_DELAY_5
TIME_DELAY_6
TIME_DELAY_7
TIME_DELAY_8
TIME_DELAY_9
TIME_DELAY_10
TIME_DELAY_11
TIME_DELAY_12
TIME_DELAY_13
TIME_DELAY_14
TIME_DELAY_15
TIME_DELAY_16
TIME_DELAY_17
TIME_DELAY_18
TIME_DELAY_19
TIME_DELAY_20
TIME_DELAY_21
TIME_DELAY_22
TIME_DELAY_23
TIME_DELAY_24
TIME_DELAY_25
TIME_DELAY_26
TIME_DELAY_27
TIME_DELAY_28
TIME_DELAY_29
TIME_DELAY_30
TIME_DELAY_31
TIME_DELAY_LAST
}

Enumeration to represent possible time delay values for WDT interrupt time and system reset time with a 32.768 KHz clock frequency.

Typedefs#

typedef void(*

Typedef for the function pointer of the callback function.

typedef FSM_CLK_T

Renaming high frequency fsm-clock type enum.

typedef AON_CLK_T

Renaming low frequency fsm-clock type enum.

Functions#

void

To initialize the Watchdog Timer.

sl_status_t
sl_si91x_watchdog_configure_clock(watchdog_timer_clock_config_t *timer_clk_config_ptr)

This API is no longer supported due to the restriction on peripheral drivers to configuring clocks.

sl_status_t
sl_si91x_watchdog_set_configuration(watchdog_timer_config_t *timer_config_ptr)

To configure Watchdog Timer parameters.

sl_status_t
sl_si91x_watchdog_register_timeout_callback(watchdog_timer_callback_t on_timeout_callback)

To register the Watchdog Timer timeout callback.

sl_status_t
sl_si91x_watchdog_set_interrupt_time(time_delays_t interrupt_time)

To set the Watchdog Timer interrupt time (Overflow or Restart time).

uint8_t

To read the configured Watchdog Timer interrupt time.

sl_status_t
sl_si91x_watchdog_set_system_reset_time(time_delays_t system_reset_time)

To set the Watchdog Timer system reset time duration.

uint8_t

To read the configured Watchdog Timer system reset time.

sl_status_t
sl_si91x_watchdog_set_window_time(time_delays_t window_time)

To set the Watchdog Timer window time value.

uint8_t

To read the configured Watchdog Timer window time.

boolean_t

To read the Watchdog Timer system reset status.

void

To de-initialize the Watchdog Timer.

void

To unregister the Watchdog Timer timeout callback.

To get the API version of the Watchdog timer.

__STATIC_INLINE void

To start and enable the Watchdog Timer.

__STATIC_INLINE void

To stop the Watchdog Timer by disabling it.

__STATIC_INLINE void

To restart (kick) an already running Watchdog Timer.

__STATIC_INLINE void

To enable the Watchdog Timer to reset the system on processor lockup.

__STATIC_INLINE void

To disable the Watchdog Timer from resetting the system on processor lockup.

Enumeration Documentation#

time_delays_t#

time_delays_t

Enumeration to represent possible time delay values for WDT interrupt time and system reset time with a 32.768 KHz clock frequency.

This enumeration defines the possible time delay values for the Watchdog Timer (WDT) interrupt and system reset times when using a 32.768 KHz clock frequency.

Enumerator
TIME_DELAY_0

Time delay for 1 clock pulse.

TIME_DELAY_1

Time delay for 2 clock pulses.

TIME_DELAY_2

Time delay for 4 clock pulses.

TIME_DELAY_3

Time delay for 8 clock pulses.

TIME_DELAY_4

Time delay for 16 clock pulses.

TIME_DELAY_5

Time delay for 32 clock pulses.

TIME_DELAY_6

Time delay for 64 clock pulses.

TIME_DELAY_7

Time delay for 128 clock pulses.

TIME_DELAY_8

Time delay for 256 clock pulses.

TIME_DELAY_9

Time delay for 512 clock pulses.

TIME_DELAY_10

Time delay for 1024 clock pulses.

TIME_DELAY_11

Time delay for 2048 clock pulses.

TIME_DELAY_12

Time delay for 4096 clock pulses.

TIME_DELAY_13

Time delay for 8192 clock pulses.

TIME_DELAY_14

Time delay for 16384 clock pulses.

TIME_DELAY_15

Time delay for 32768 clock pulses.

TIME_DELAY_16

Time delay for 65536 clock pulses.

TIME_DELAY_17

Time delay for 131072 clock pulses.

TIME_DELAY_18

Time delay for 262144 clock pulses.

TIME_DELAY_19

Time delay for 524288 clock pulses.

TIME_DELAY_20

Time delay for 1048576 clock pulses.

TIME_DELAY_21

Time delay for 2097152 clock pulses.

TIME_DELAY_22

Time delay for 4194304 clock pulses.

TIME_DELAY_23

Time delay for 8388608 clock pulses.

TIME_DELAY_24

Time delay for 16777216 clock pulses.

TIME_DELAY_25

Time delay for 33554432 clock pulses.

TIME_DELAY_26

Time delay for 67108864 clock pulses.

TIME_DELAY_27

Time delay for 134217728 clock pulses.

TIME_DELAY_28

Time delay for 268435456 clock pulses.

TIME_DELAY_29

Time delay for 536870912 clock pulses.

TIME_DELAY_30

Time delay for 1073741824 clock pulses.

TIME_DELAY_31

Time delay for 2147483648 clock pulses.

TIME_DELAY_LAST

Time delay value validation.


Definition at line 75 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_watchdog_timer.h

Typedef Documentation#

watchdog_timer_callback_t#

typedef void(* watchdog_timer_callback_t) (void) )(void)

Typedef for the function pointer of the callback function.


Definition at line 64 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_watchdog_timer.h

high_freq_fsm_clock_t#

typedef FSM_CLK_T high_freq_fsm_clock_t

Renaming high frequency fsm-clock type enum.


Definition at line 65 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_watchdog_timer.h

low_freq_fsm_clock_t#

typedef AON_CLK_T low_freq_fsm_clock_t

Renaming low frequency fsm-clock type enum.


Definition at line 66 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_watchdog_timer.h

Function Documentation#

sl_si91x_watchdog_init_timer#

void sl_si91x_watchdog_init_timer (void )

To initialize the Watchdog Timer.

Parameters
N/A

This API initializes the Watchdog Timer by enabling the peripheral power. It also unmasks the WDT interrupt.

Note

  • This function should be called before using any other Watchdog Timer functions.


Definition at line 162 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_watchdog_timer.h

sl_si91x_watchdog_configure_clock#

sl_status_t sl_si91x_watchdog_configure_clock (watchdog_timer_clock_config_t * timer_clk_config_ptr)

This API is no longer supported due to the restriction on peripheral drivers to configuring clocks.

Parameters
[in]timer_clk_config_ptr

Pointer to the timer clock configuration structure.

This API configures the Watchdog Timer's low frequency and BG-PMU clock sources.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - return ok to support backward compatibility.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 180 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_watchdog_timer.h

sl_si91x_watchdog_set_configuration#

sl_status_t sl_si91x_watchdog_set_configuration (watchdog_timer_config_t * timer_config_ptr)

To configure Watchdog Timer parameters.

Parameters
[in]timer_config_ptr

Pointer to the timer configuration structure watchdog_timer_config_t.

This API configures the Watchdog Timer parameters, including interrupt time (WDT restart time), system reset time, and window time (lower time stamp for WDT restart, if necessary). The interrupt time should be greater than the window time; otherwise, the API will return an error.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Success, timer parameters configured properly.

    • SL_STATUS_INVALID_PARAMETER - Timer configuration structure members have invalid values.

    • SL_STATUS_NULL_POINTER - The parameter is a null pointer.

    • SL_STATUS_INVALID_CONFIGURATION - Timer configuration structure member 'interrupt_time' is less than or equal to 'window_time'. It should be greater than the window time of the timer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 203 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_watchdog_timer.h

sl_si91x_watchdog_register_timeout_callback#

sl_status_t sl_si91x_watchdog_register_timeout_callback (watchdog_timer_callback_t on_timeout_callback)

To register the Watchdog Timer timeout callback.

Parameters
[in]on_timeout_callback

Function pointer to the callback function to be called when the timer timeout interrupt occurs.

This API registers a callback function to be called when the Watchdog Timer timeout interrupt occurs. Registering the callback also enables its interrupts. Before registering a new callback, the user must unregister any previously registered callback using the sl_si91x_watchdog_unregister_timeout_callback function.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Successfully registered the timer timeout callback.

    • SL_STATUS_BUSY - The callback is already registered; the user must unregister the previous callback before registering again.

    • SL_STATUS_NULL_POINTER - The callback function pointer parameter is a null pointer.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 222 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_watchdog_timer.h

sl_si91x_watchdog_set_interrupt_time#

sl_status_t sl_si91x_watchdog_set_interrupt_time (time_delays_t interrupt_time)

To set the Watchdog Timer interrupt time (Overflow or Restart time).

Parameters
[in]interrupt_time

Timer timeout interrupt duration, represented as time_delays_t. Number of clock pulses = 2^(interrupt_time).

This API sets the Watchdog Timer interrupt time, also referred to as the upper time-stamp for WDT restart. The maximum value for the interrupt time is 31.

  • Number of clock pulses for timer timeout = 2^(interrupt_time)

Note

  • The 'interrupt_time' value should be greater than the window time.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Successfully set the Watchdog Timer timeout value.

    • SL_STATUS_INVALID_PARAMETER - The 'interrupt_time' parameter has an invalid value.

    • SL_STATUS_INVALID_CONFIGURATION - The 'interrupt_time' value is less than the window time.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 248 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_watchdog_timer.h

sl_si91x_watchdog_get_interrupt_time#

uint8_t sl_si91x_watchdog_get_interrupt_time (void )

To read the configured Watchdog Timer interrupt time.

Parameters
N/A

This API returns the interrupt time configured for the Watchdog Timer in terms of the power of two.

Returns


Definition at line 261 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_watchdog_timer.h

sl_si91x_watchdog_set_system_reset_time#

sl_status_t sl_si91x_watchdog_set_system_reset_time (time_delays_t system_reset_time)

To set the Watchdog Timer system reset time duration.

Parameters
[in]system_reset_time

Timer system reset duration, represented as time_delays_t. Number of clock pulses = 2^(system_reset_time).

This API sets the duration for the Watchdog Timer system reset. The number of clock pulses for the system reset time is calculated as 2^(system_reset_time). The maximum value for system_reset_time is 31. This value should be greater than the timer window time.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Successfully set the Watchdog Timer system reset time value.

    • SL_STATUS_INVALID_PARAMETER - The 'system_reset_time' parameter has an invalid value.

    • SL_STATUS_INVALID_CONFIGURATION - The 'system_reset_time' value is less than the window time.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 282 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_watchdog_timer.h

sl_si91x_watchdog_get_system_reset_time#

uint8_t sl_si91x_watchdog_get_system_reset_time (void )

To read the configured Watchdog Timer system reset time.

Parameters
N/A

This API returns the system reset time configured for the Watchdog Timer in terms of the power of two.

Returns

  • uint8_t The configured system reset time value, see time_delays_t.


Definition at line 295 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_watchdog_timer.h

sl_si91x_watchdog_set_window_time#

sl_status_t sl_si91x_watchdog_set_window_time (time_delays_t window_time)

To set the Watchdog Timer window time value.

Parameters
[in]window_time

Timer window time, represented as time_delays_t. Number of clock pulses = 2^(window_time).

This API sets the window time value for the Watchdog Timer. By setting this value, the timer becomes a window Watchdog Timer. If this value is zero, it acts as a regular WDT. It is also referred to as the lower time-stamp for WDT restart. The maximum value is 15.

  • Number of clock pulses for window time = 2^(window_time).

  • This value should be less than the timer interrupt time and system reset time.

Returns

  • sl_status_t Status code indicating the result:

    • SL_STATUS_OK - Successfully set the Watchdog Timer window time value.

    • SL_STATUS_INVALID_PARAMETER - The 'window_time' parameter has an invalid value.

    • SL_STATUS_INVALID_CONFIGURATION - The 'window_time' value is greater than the interrupt time or system reset time.

For more information on status codes, see SL STATUS DOCUMENTATION.


Definition at line 320 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_watchdog_timer.h

sl_si91x_watchdog_get_window_time#

uint8_t sl_si91x_watchdog_get_window_time (void )

To read the configured Watchdog Timer window time.

Parameters
N/A

This API returns the set window time value (not the current count) in terms of the power of two.

Returns


Definition at line 333 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_watchdog_timer.h

sl_si91x_watchdog_get_timer_system_reset_status#

boolean_t sl_si91x_watchdog_get_timer_system_reset_status (void )

To read the Watchdog Timer system reset status.

Parameters
N/A

This API returns the system reset status of the Watchdog Timer. It returns true if the system was reset by the Watchdog Timer, and false if it was a power-on reset.

Returns

  • boolean_t Returns true if the Watchdog Timer reset the system, otherwise returns false.


Definition at line 343 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_watchdog_timer.h

sl_si91x_watchdog_deinit_timer#

void sl_si91x_watchdog_deinit_timer (void )

To de-initialize the Watchdog Timer.

Parameters
N/A

This API de-initializes the Watchdog Timer by masking interrupts, unregistering the callback, and disabling the timer.


Definition at line 355 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_watchdog_timer.h

sl_si91x_watchdog_unregister_timeout_callback#

void sl_si91x_watchdog_unregister_timeout_callback (void )

To unregister the Watchdog Timer timeout callback.

Parameters
N/A

This API unregisters the callback function for the Watchdog Timer timeout interrupt. It clears the callback function address and sets the callback variable to NULL.


Definition at line 379 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_watchdog_timer.h

sl_si91x_watchdog_get_version#

sl_watchdog_timer_version_t sl_si91x_watchdog_get_version (void )

To get the API version of the Watchdog timer.

Parameters
N/A

This API retrieves the version information of the Watchdog timer.

Returns


Definition at line 389 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_watchdog_timer.h

sl_si91x_watchdog_start_timer#

__STATIC_INLINE void sl_si91x_watchdog_start_timer (void )

To start and enable the Watchdog Timer.

Parameters
N/A

Once the Watchdog Timer (WDT) is started, the interrupt time will begin incrementing. When it reaches the set interrupt time value, the WDT will generate an interrupt, and the timer will load the system reset time value. Before it reaches this value, the WDT should be restarted (kicked) to avoid a system reset.


Definition at line 404 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_watchdog_timer.h

sl_si91x_watchdog_stop_timer#

__STATIC_INLINE void sl_si91x_watchdog_stop_timer (void )

To stop the Watchdog Timer by disabling it.

Parameters
N/A

This API stops an already running Watchdog Timer. It disables the timer by updating the 'WWD_TIMER_ENABLE' register bits. Specifically, it updates the 'wwd_timer_en' (23:16) bits of the timer enable register to 0xF0, thereby disabling the WDT timer.


Definition at line 419 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_watchdog_timer.h

sl_si91x_watchdog_restart_timer#

__STATIC_INLINE void sl_si91x_watchdog_restart_timer (void )

To restart (kick) an already running Watchdog Timer.

Parameters
N/A

This API sets the restart bit of the Watchdog Timer when it is already enabled. It should be used for an already started WDT timer, not for starting a stopped timer.


Definition at line 435 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_watchdog_timer.h

sl_si91x_watchdog_enable_system_reset_on_processor_lockup#

__STATIC_INLINE void sl_si91x_watchdog_enable_system_reset_on_processor_lockup (void )

To enable the Watchdog Timer to reset the system on processor lockup.

Parameters
N/A

This API enables the Watchdog Timer (WDT) to generate a system reset when the processor gets stuck or reaches a lockup state. It achieves this by setting the 'PROCESSOR_STUCK_RESET_EN' bit of the 'WWD_ARM_STUCK_EN' register of the WDT.


Definition at line 450 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_watchdog_timer.h

sl_si91x_watchdog_disable_system_reset_on_processor_lockup#

__STATIC_INLINE void sl_si91x_watchdog_disable_system_reset_on_processor_lockup (void )

To disable the Watchdog Timer from resetting the system on processor lockup.

Parameters
N/A

This API disables the Watchdog Timer (WDT) from generating a system reset when the processor gets stuck or reaches a lockup state. It achieves this by writing '0' to the 'PROCESSOR_STUCK_RESET_EN' bit of the 'WWD_ARM_STUCK_EN' register of the WDT.


Definition at line 466 of file components/device/silabs/si91x/mcu/drivers/unified_api/inc/sl_si91x_watchdog_timer.h