MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
WWDT: Windowed Watchdog Timer Driver

Files

file  fsl_wwdt.h
 

Data Structures

struct  wwdt_config_t
 Describes WWDT configuration structure. More...
 

Enumerations

enum  _wwdt_status_flags_t {
  kWWDT_TimeoutFlag = WWDT_MOD_WDTOF_MASK,
  kWWDT_WarningFlag = WWDT_MOD_WDINT_MASK
}
 WWDT status flags. More...
 

Driver version

#define FSL_WWDT_DRIVER_VERSION   (MAKE_VERSION(2, 1, 4))
 Defines WWDT driver version 2.1.4. More...
 

Refresh sequence

#define WWDT_FIRST_WORD_OF_REFRESH   (0xAAU)
 First word of refresh sequence.
 
#define WWDT_SECOND_WORD_OF_REFRESH   (0x55U)
 Second word of refresh sequence.
 

WWDT Initialization and De-initialization

void WWDT_GetDefaultConfig (wwdt_config_t *config)
 Initializes WWDT configure structure. More...
 
void WWDT_Init (WWDT_Type *base, const wwdt_config_t *config)
 Initializes the WWDT. More...
 
void WWDT_Deinit (WWDT_Type *base)
 Shuts down the WWDT. More...
 

WWDT Functional Operation

static void WWDT_Enable (WWDT_Type *base)
 Enables the WWDT module. More...
 
static void WWDT_Disable (WWDT_Type *base)
 Disables the WWDT module. More...
 
static uint32_t WWDT_GetStatusFlags (WWDT_Type *base)
 Gets all WWDT status flags. More...
 
void WWDT_ClearStatusFlags (WWDT_Type *base, uint32_t mask)
 Clear WWDT flag. More...
 
static void WWDT_SetWarningValue (WWDT_Type *base, uint32_t warningValue)
 Set the WWDT warning value. More...
 
static void WWDT_SetTimeoutValue (WWDT_Type *base, uint32_t timeoutCount)
 Set the WWDT timeout value. More...
 
static void WWDT_SetWindowValue (WWDT_Type *base, uint32_t windowValue)
 Sets the WWDT window value. More...
 
void WWDT_Refresh (WWDT_Type *base)
 Refreshes the WWDT timer. More...
 

Detailed Description

The MCUXpresso SDK provides a peripheral driver for the Watchdog module (WDOG) of MCUXpresso SDK devices.

Function groups

Initialization and deinitialization

The function WWDT_Init() initializes the watchdog timer with specified configurations. The configurations include timeout value and whether to enable watchdog after init. The function WWDT_GetDefaultConfig() gets the default configurations.

The function WWDT_Deinit() disables the watchdog and the module clock.

Status

Provides functions to get and clear the WWDT status.

Interrupt

Provides functions to enable/disable WWDT interrupts and get current enabled interrupts.

Watch dog Refresh

The function WWDT_Refresh() feeds the WWDT.

Typical use case

Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/wwdt


Data Structure Documentation

struct wwdt_config_t

Data Fields

bool enableWwdt
 Enables or disables WWDT.
 
bool enableWatchdogReset
 true: Watchdog timeout will cause a chip reset false: Watchdog timeout will not cause a chip reset
 
bool enableWatchdogProtect
 true: Enable watchdog protect i.e timeout value can only be changed after counter is below warning & window values false: Disable watchdog protect; timeout value can be changed at any time
 
bool enableLockOscillator
 true: Disabling or powering down the watchdog oscillator is prevented Once set, this bit can only be cleared by a reset false: Do not lock oscillator
 
uint32_t windowValue
 Window value, set this to 0xFFFFFF if windowing is not in effect.
 
uint32_t timeoutValue
 Timeout value.
 
uint32_t warningValue
 Watchdog time counter value that will generate a warning interrupt. More...
 
uint32_t clockFreq_Hz
 Watchdog clock source frequency. More...
 

Field Documentation

uint32_t wwdt_config_t::warningValue

Set this to 0 for no warning

uint32_t wwdt_config_t::clockFreq_Hz

Macro Definition Documentation

#define FSL_WWDT_DRIVER_VERSION   (MAKE_VERSION(2, 1, 4))

Enumeration Type Documentation

This structure contains the WWDT status flags for use in the WWDT functions.

Enumerator
kWWDT_TimeoutFlag 

Time-out flag, set when the timer times out.

kWWDT_WarningFlag 

Warning interrupt flag, set when timer is below the value WDWARNINT.

Function Documentation

void WWDT_GetDefaultConfig ( wwdt_config_t config)

This function initializes the WWDT configure structure to default value. The default value are:

* config->enableWwdt = true;
* config->enableWatchdogReset = false;
* config->enableWatchdogProtect = false;
* config->enableLockOscillator = false;
* config->windowValue = 0xFFFFFFU;
* config->timeoutValue = 0xFFFFFFU;
* config->warningValue = 0;
*
Parameters
configPointer to WWDT config structure.
See Also
wwdt_config_t
void WWDT_Init ( WWDT_Type *  base,
const wwdt_config_t config 
)

This function initializes the WWDT. When called, the WWDT runs according to the configuration.

Example:

* wwdt_config_t config;
* config.timeoutValue = 0x7ffU;
* WWDT_Init(wwdt_base,&config);
*
Parameters
baseWWDT peripheral base address
configThe configuration of WWDT
void WWDT_Deinit ( WWDT_Type *  base)

This function shuts down the WWDT.

Parameters
baseWWDT peripheral base address
static void WWDT_Enable ( WWDT_Type *  base)
inlinestatic

This function write value into WWDT_MOD register to enable the WWDT, it is a write-once bit; once this bit is set to one and a watchdog feed is performed, the watchdog timer will run permanently.

Parameters
baseWWDT peripheral base address
static void WWDT_Disable ( WWDT_Type *  base)
inlinestatic

This function write value into WWDT_MOD register to disable the WWDT.

Parameters
baseWWDT peripheral base address
static uint32_t WWDT_GetStatusFlags ( WWDT_Type *  base)
inlinestatic

This function gets all status flags.

Example for getting Timeout Flag:

* uint32_t status;
* status = WWDT_GetStatusFlags(wwdt_base) & kWWDT_TimeoutFlag;
*
Parameters
baseWWDT peripheral base address
Returns
The status flags. This is the logical OR of members of the enumeration _wwdt_status_flags_t
void WWDT_ClearStatusFlags ( WWDT_Type *  base,
uint32_t  mask 
)

This function clears WWDT status flag.

Example for clearing warning flag:

Parameters
baseWWDT peripheral base address
maskThe status flags to clear. This is a logical OR of members of the enumeration _wwdt_status_flags_t
static void WWDT_SetWarningValue ( WWDT_Type *  base,
uint32_t  warningValue 
)
inlinestatic

The WDWARNINT register determines the watchdog timer counter value that will generate a watchdog interrupt. When the watchdog timer counter is no longer greater than the value defined by WARNINT, an interrupt will be generated after the subsequent WDCLK.

Parameters
baseWWDT peripheral base address
warningValueWWDT warning value.
static void WWDT_SetTimeoutValue ( WWDT_Type *  base,
uint32_t  timeoutCount 
)
inlinestatic

This function sets the timeout value. Every time a feed sequence occurs the value in the TC register is loaded into the Watchdog timer. Writing a value below 0xFF will cause 0xFF to be loaded into the TC register. Thus the minimum time-out interval is TWDCLK*256*4. If enableWatchdogProtect flag is true in wwdt_config_t config structure, any attempt to change the timeout value before the watchdog counter is below the warning and window values will cause a watchdog reset and set the WDTOF flag.

Parameters
baseWWDT peripheral base address
timeoutCountWWDT timeout value, count of WWDT clock tick.
static void WWDT_SetWindowValue ( WWDT_Type *  base,
uint32_t  windowValue 
)
inlinestatic

The WINDOW register determines the highest TV value allowed when a watchdog feed is performed. If a feed sequence occurs when timer value is greater than the value in WINDOW, a watchdog event will occur. To disable windowing, set windowValue to 0xFFFFFF (maximum possible timer value) so windowing is not in effect.

Parameters
baseWWDT peripheral base address
windowValueWWDT window value.
void WWDT_Refresh ( WWDT_Type *  base)

This function feeds the WWDT. This function should be called before WWDT timer is in timeout. Otherwise, a reset is asserted.

Parameters
baseWWDT peripheral base address