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
Data Fields |
uint32_t | timeoutCounter |
| Timeout counter for WDT, should be between 0xFF ~ 0x7FFFFF, indicates timeoutValue
between (TWDCLK * 256 * 4) and (TWDCLK * 224 * 4), TWDCLK = 1/WDT_CLK. More...
|
|
bool | enableReset |
| WDT reset enable, when enable, WDT timeout causes a chip reset. More...
|
|
bool | enableWdog |
| Enables or disables WDT. More...
|
|
uint32_t wdt_config_t::timeoutCounter |
bool wdt_config_t::enableReset |
bool wdt_config_t::enableWdog |
Enumerator |
---|
kWDT_TimeoutFlag |
WDT timeout flag, set when WDT times out.
|
kWDT_InterruptFlag |
WDT interrupt flag, set in interrupt mode, indicates WDT interrupt due to WDT counter-underflow happens.
|
This function initializes the WDT configuration structure to default values. The default values are as follows.
* wdtConfig->timeoutValue = 0xFFFFU;
* wdtConfig->enableReset = true;
* wdtConfig->enableWdog = true;
*
- Parameters
-
config | Pointer to the WDT configuration structure. |
- See Also
- wdt_config_t
void WDT_Init |
( |
WDT_Type * |
base, |
|
|
const wdt_config_t * |
config |
|
) |
| |
This function initializes the WDT. When called, the WDT runs according to the configuration.
This is an example.
* config.timeoutValue = 0x7ffU;
*
- Parameters
-
base | WDT peripheral base address |
config | The configuration of WDT |
void WDT_Deinit |
( |
WDT_Type * |
base | ) |
|
This function shuts down the WDT.
static void WDT_Enable |
( |
WDT_Type * |
base | ) |
|
|
inlinestatic |
- Parameters
-
base | WDT peripheral base address |
static uint32_t WDT_GetStatusFlags |
( |
WDT_Type * |
base | ) |
|
|
inlinestatic |
This function gets all status flags.
This is an example for getting the Running Flag.
- Parameters
-
base | WDT peripheral base address |
- Returns
- State of the status flag: asserted (true) or not-asserted (false).
- See Also
- _wdt_flags
- true: a related status flag has been set.
- false: a related status flag is not set.
static void WDT_ClearStatusFlags |
( |
WDT_Type * |
base, |
|
|
uint32_t |
mask |
|
) |
| |
|
inlinestatic |
This function clears the WDT status flag.
This is an example for clearing the timeout (interrupt) flag.
- Parameters
-
base | WDT peripheral base address |
mask | The status flags to clear, only support clear kWDT_TimeoutFlag. |
static void WDT_SetTimeoutCounter |
( |
WDT_Type * |
base, |
|
|
uint32_t |
timeoutCount |
|
) |
| |
|
inlinestatic |
This function sets the timeout counter. The timeoutCount should be between 0xFF ~ 0x7FFFFF, writing values below 0xFF cause 0x0000 00FF to be loaded to the WDT timer counter. The minimum timeoutValue is (TWDCLK * 256 * 4) and the maximum value is (TWDCLK * 224 * 4), TWDCLK = 1/WDT_CLK.
- Parameters
-
base | WDT peripheral base address |
timeoutCount | WDT timeout counter; count of WDT clock tick. |
static void WDT_Feed |
( |
WDT_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 |
static uint32_t WDT_GetCurrentCount |
( |
WDT_Type * |
base | ) |
|
|
inlinestatic |
The value reported by this function is older than the actual one. Retrieving this value takes up to 6 watchdog clock cycles + 6 system clock cycles due to the lock and synchronization procedure.
- Parameters
-
base | WDT peripheral base address |
- Returns
- Current value of WDT