The MCUXpresso SDK provides a peripheral driver for the Watchdog Timer module of MCUXpresso SDK devices.
Typical use case
Example use of WDT API. Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/wdt
| #define FSL_WDT_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
| void WDT_StartTimer |
( |
TIMERS_Type * |
base, |
|
|
uint32_t |
timeoutCount |
|
) |
| |
- Parameters
-
| base | wdt base pointer. |
| timeoutCount | the initial timeout count of the timer. The total timeout time is determined by (1 / timerCountingFreq_Hz) * timeoutCount.The maximum timeoutCount is 0x000FFFFF. |
| void WDT_StopTimer |
( |
TIMERS_Type * |
base | ) |
|
| static void WDT_SetInterruptThreshold |
( |
TIMERS_Type * |
base, |
|
|
uint32_t |
threshold |
|
) |
| |
|
inlinestatic |
The Watchdog timer includes a "timeout pre-emption" feature whereby the non-maskable interrupt output intreq_wdg_o is asserted high when the counter reaches the value specified in field WDOG_INT_THRESHOLD defined in register TIMERS_WDOG_TRIGGER_INT_REG.
- Parameters
-
| base | WDT peripheral base address |
| threshold | WDT triggerthreshold value. |
| static void WDT_SetTimeoutStatus |
( |
TIMERS_Type * |
base | ) |
|
|
inlinestatic |
| static void WDT_ClearTimeoutStatus |
( |
TIMERS_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
| base | timer base pointer. |
| timer | the specific timer to be stop. |
| static bool WDT_GetTimeoutStatus |
( |
TIMERS_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
- Return values
-
| true | is the timer timeout, false is the timeout still not timeout. |
| static uint32_t WDT_GetRemainCount |
( |
TIMERS_Type * |
base | ) |
|
|
inlinestatic |
| static void WDT_Feed |
( |
TIMERS_Type * |
base | ) |
|
|
inlinestatic |
This is a mandatory step, if this function isn't called after enabling the WDT, WDT will ignore timeout errors and will not generate a WDT interrupt or reset the chip.
- Parameters
-
| base | WDT peripheral base address |