Macros | Functions
WDT_A

Watchdog Timer with interval timer capabilities. More...

Macros

#define WDT_A_HARD_RESET   SYSCTL_HARD_RESET
 
#define WDT_A_SOFT_RESET   SYSCTL_SOFT_RESET
 
#define WDT_A_CLOCKSOURCE_SMCLK   (WDT_A_CTL_SSEL_0)
 
#define WDT_A_CLOCKSOURCE_ACLK   (WDT_A_CTL_SSEL_1)
 
#define WDT_A_CLOCKSOURCE_VLOCLK   (WDT_A_CTL_SSEL_2)
 
#define WDT_A_CLOCKSOURCE_XCLK   (WDT_A_CTL_SSEL_3)
 
#define WDT_A_CLOCKSOURCE_BCLK   (WDT_A_CTL_SSEL_4)
 
#define WDT_A_CLOCKDIVIDER_2G   (WDT_A_CTL_IS_0)
 
#define WDT_A_CLOCKDIVIDER_128M   (WDT_A_CTL_IS_1)
 
#define WDT_A_CLOCKDIVIDER_8192K   (WDT_A_CTL_IS_2)
 
#define WDT_A_CLOCKDIVIDER_512K   (WDT_A_CTL_IS_3)
 
#define WDT_A_CLOCKDIVIDER_32K   (WDT_A_CTL_IS_4)
 
#define WDT_A_CLOCKDIVIDER_8192   (WDT_A_CTL_IS_5)
 
#define WDT_A_CLOCKDIVIDER_512   (WDT_A_CTL_IS_6)
 
#define WDT_A_CLOCKDIVIDER_64   (WDT_A_CTL_IS_7)
 
#define WDT_A_CLOCKITERATIONS_2G   WDT_A_CLOCKDIVIDER_2G
 
#define WDT_A_CLOCKITERATIONS_128M   WDT_A_CLOCKDIVIDER_128M
 
#define WDT_A_CLOCKITERATIONS_8192K   WDT_A_CLOCKDIVIDER_8192K
 
#define WDT_A_CLOCKITERATIONS_512K   WDT_A_CLOCKDIVIDER_512K
 
#define WDT_A_CLOCKITERATIONS_32K   WDT_A_CLOCKDIVIDER_32K
 
#define WDT_A_CLOCKITERATIONS_8192   WDT_A_CLOCKDIVIDER_8192
 
#define WDT_A_CLOCKITERATIONS_512   WDT_A_CLOCKDIVIDER_512
 
#define WDT_A_CLOCKITERATIONS_64   WDT_A_CLOCKDIVIDER_64
 
#define WDT_A_holdTimerMultipleTimer(a)   WDT_A_holdTimer()
 
#define WDT_A_startTimerMultipleTimer(a)   WDT_A_startTimer()
 
#define WDT_A_resetTimerMultipleTimer(a)   WDT_A_clearTimer()
 
#define WDT_A_initWatchdogTimerMultipleTimer(a, b, c)   WDT_A_initWatchdogTimer(b,c)
 
#define WDT_A_initIntervalTimerMultipleTimer(a, b, c)   WDT_A_initIntervalTimer(b,c)
 
#define WDT_A_registerInterruptMultipleTimer(a, b)   WDT_A_registerInterrupt(b)
 
#define WDT_A_unregisterInterruptMultipleTimer(a)   WDT_A_unregisterInterrupt()
 
#define WDT_A_hold   WDT_A_holdTimerMultipleTimer
 
#define WDT_A_start   WDT_A_startTimerMultipleTimer
 
#define WDT_A_resetTimer   WDT_A_resetTimerMultipleTimer
 
#define WDT_A_watchdogTimerInit   WDT_A_initWatchdogTimerMultipleTimer
 
#define WDT_A_intervalTimerInit   WDT_A_initIntervalTimerMultipleTimer
 

Functions

void WDT_A_holdTimer (void)
 
void WDT_A_startTimer (void)
 
void WDT_A_clearTimer (void)
 
void WDT_A_initWatchdogTimer (uint_fast8_t clockSelect, uint_fast8_t clockDivider)
 
void WDT_A_initIntervalTimer (uint_fast8_t clockSelect, uint_fast8_t clockDivider)
 
void WDT_A_registerInterrupt (void(*intHandler)(void))
 
void WDT_A_unregisterInterrupt (void)
 
void WDT_A_setPasswordViolationReset (uint_fast8_t resetType)
 
void WDT_A_setTimeoutReset (uint_fast8_t resetType)
 

Detailed Description

Watchdog Timer with interval timer capabilities.


Module Operation


MSP432 includes a standard watchdog module that is identical to the WDT_A module of MSP430. By using DriverLib, the user can configure all aspects of the watchdog peripheral including using the watchdog in interval mode as well as watchdog mode.


Watchdog Mode


Once the module is initiated in watchdog mode, the timer will reset part if the count expires. The reset can be set as either a soft or hard reset. This use case is useful when the programmer wants to make sure that the code execution isn't perpetually stuck/locked in an unrecoverable state.

To configure the WDT module in watchdog mode, the WDT_initWatchdogTimer function is used such as follows:

/* Configuring WDT to timeout after 512k iterations of SMCLK, at 128k,
* this will roughly equal 4 seconds*/

This will set the watchdog timer to be sourced from SMCLK and have a duration of 512,000 SMCLK cycles. This means that once started, if the watchdog timer goes 512,000 iterations without being reset a reset will occur. To reset the counter (after using WDT_startTimer to start the timer), the user should use the WDT_resetTimer function.


Interval Mode


MSP432 Driverlib can also configure the WDT module to work in interval mode. This turns the WDT into an ordinary 16-bit down counter with interrupt support. This can be used if the user needs access to another low power counter, however has already used other resources. To configure the module in interval mode, use the WDT_initIntervalTimer function such as follows:

/* Configuring WDT in interval mode to trigger every 32K clock iterations.
* This comes out to roughly every 3.5 seconds */

This will configure the WDT module to be sourced from SMCLK and have a period of 32,000 cycles. In this example, we have previously configured SMCLK to be 64Khz making this timer's period be approximately half a second. After using the WDT_startTimer function to start the timer, the user can service interrupts from interval mode after enabling interrupts using the Interrupt_enableInterrupt function.


Setting Reset Type


The type of reset that occurs on watchdog timeout/password violation can be configured through the SysCtl module using the SysCtl_setWDTPasswordViolationResetType and SysCtl_setWDTTimeoutResetType APIs. These APIs will allow the user to change whether a soft or hard reset occurs on a watchdog timeout and password violation. For the user, the convenience functions WDT_setPasswordViolationReset and WDT_setTimeoutReset exist in the WDT APIs.


Programming Examples


The DriverLib package contains a variety of different code examples that demonstrate the usage of the WDT module. These code examples are accessible under the examples/ folder of the MSPWare release as well as through TI Resource Explorer if using Code Composer Studio. These code examples provide a comprehensive list of use cases as well as practical applications involving each module.

Below is a very brief code example showing how to configure the WDT module in interval mode:

/* Configuring WDT in interval mode to trigger every 32K clock iterations.
* This comes out to roughly every 3.5 seconds */

Macro Definition Documentation

#define WDT_A_HARD_RESET   SYSCTL_HARD_RESET
#define WDT_A_SOFT_RESET   SYSCTL_SOFT_RESET
#define WDT_A_CLOCKSOURCE_SMCLK   (WDT_A_CTL_SSEL_0)
#define WDT_A_CLOCKSOURCE_ACLK   (WDT_A_CTL_SSEL_1)
#define WDT_A_CLOCKSOURCE_VLOCLK   (WDT_A_CTL_SSEL_2)
#define WDT_A_CLOCKSOURCE_XCLK   (WDT_A_CTL_SSEL_3)
#define WDT_A_CLOCKSOURCE_BCLK   (WDT_A_CTL_SSEL_4)
#define WDT_A_CLOCKDIVIDER_2G   (WDT_A_CTL_IS_0)
#define WDT_A_CLOCKDIVIDER_128M   (WDT_A_CTL_IS_1)
#define WDT_A_CLOCKDIVIDER_8192K   (WDT_A_CTL_IS_2)
#define WDT_A_CLOCKDIVIDER_512K   (WDT_A_CTL_IS_3)
#define WDT_A_CLOCKDIVIDER_32K   (WDT_A_CTL_IS_4)
#define WDT_A_CLOCKDIVIDER_8192   (WDT_A_CTL_IS_5)
#define WDT_A_CLOCKDIVIDER_512   (WDT_A_CTL_IS_6)
#define WDT_A_CLOCKDIVIDER_64   (WDT_A_CTL_IS_7)
#define WDT_A_CLOCKITERATIONS_2G   WDT_A_CLOCKDIVIDER_2G
#define WDT_A_CLOCKITERATIONS_128M   WDT_A_CLOCKDIVIDER_128M
#define WDT_A_CLOCKITERATIONS_8192K   WDT_A_CLOCKDIVIDER_8192K
#define WDT_A_CLOCKITERATIONS_512K   WDT_A_CLOCKDIVIDER_512K
#define WDT_A_CLOCKITERATIONS_32K   WDT_A_CLOCKDIVIDER_32K
#define WDT_A_CLOCKITERATIONS_8192   WDT_A_CLOCKDIVIDER_8192
#define WDT_A_CLOCKITERATIONS_512   WDT_A_CLOCKDIVIDER_512
#define WDT_A_CLOCKITERATIONS_64   WDT_A_CLOCKDIVIDER_64
#define WDT_A_holdTimerMultipleTimer (   a)    WDT_A_holdTimer()
#define WDT_A_startTimerMultipleTimer (   a)    WDT_A_startTimer()
#define WDT_A_resetTimerMultipleTimer (   a)    WDT_A_clearTimer()
#define WDT_A_initWatchdogTimerMultipleTimer (   a,
  b,
 
)    WDT_A_initWatchdogTimer(b,c)
#define WDT_A_initIntervalTimerMultipleTimer (   a,
  b,
 
)    WDT_A_initIntervalTimer(b,c)
#define WDT_A_registerInterruptMultipleTimer (   a,
 
)    WDT_A_registerInterrupt(b)
#define WDT_A_unregisterInterruptMultipleTimer (   a)    WDT_A_unregisterInterrupt()
#define WDT_A_hold   WDT_A_holdTimerMultipleTimer
#define WDT_A_start   WDT_A_startTimerMultipleTimer
#define WDT_A_resetTimer   WDT_A_resetTimerMultipleTimer
#define WDT_A_watchdogTimerInit   WDT_A_initWatchdogTimerMultipleTimer
#define WDT_A_intervalTimerInit   WDT_A_initIntervalTimerMultipleTimer

Function Documentation

void WDT_A_holdTimer ( void  )

Holds the Watchdog Timer.

This function stops the watchdog timer from running. This way no interrupt or PUC is asserted.

Returns
None

Referenced by PCM_gotoLPM4().

void WDT_A_startTimer ( void  )

Starts the Watchdog Timer.

This function starts the watchdog timer functionality to start counting.

Returns
None
void WDT_A_clearTimer ( void  )

Clears the timer counter of the Watchdog Timer.

This function clears the watchdog timer count to 0x0000h. This function is used to "service the dog" when operating in watchdog mode.

Returns
None
void WDT_A_initWatchdogTimer ( uint_fast8_t  clockSelect,
uint_fast8_t  clockDivider 
)

Sets the clock source for the Watchdog Timer in watchdog mode.

Parameters
clockSelectis the clock source that the watchdog timer will use. Valid values are
  • WDT_A_CLOCKSOURCE_SMCLK [Default]
  • WDT_A_CLOCKSOURCE_ACLK
  • WDT_A_CLOCKSOURCE_VLOCLK
  • WDT_A_CLOCKSOURCE_BCLK
clockIterationsis the number of clock iterations for a watchdog timeout. Valid values are
  • WDT_A_CLOCKITERATIONS_2G [Default]
  • WDT_A_CLOCKITERATIONS_128M
  • WDT_A_CLOCKITERATIONS_8192K
  • WDT_A_CLOCKITERATIONS_512K
  • WDT_A_CLOCKITERATIONS_32K
  • WDT_A_CLOCKITERATIONS_8192
  • WDT_A_CLOCKITERATIONS_512
  • WDT_A_CLOCKITERATIONS_64

This function sets the watchdog timer in watchdog mode, which will cause a PUC when the timer overflows. When in the mode, a PUC can be avoided with a call to WDT_A_resetTimer() before the timer runs out.

Returns
None
void WDT_A_initIntervalTimer ( uint_fast8_t  clockSelect,
uint_fast8_t  clockDivider 
)

Sets the clock source for the Watchdog Timer in timer interval mode.

Parameters
clockSelectis the clock source that the watchdog timer will use. Valid values are
  • WDT_A_CLOCKSOURCE_SMCLK [Default]
  • WDT_A_CLOCKSOURCE_ACLK
  • WDT_A_CLOCKSOURCE_VLOCLK
  • WDT_A_CLOCKSOURCE_BCLK
clockIterationsis the number of clock iterations for a watchdog interval. Valid values are
  • WDT_A_CLOCKITERATIONS_2G [Default]
  • WDT_A_CLOCKITERATIONS_128M
  • WDT_A_CLOCKITERATIONS_8192K
  • WDT_A_CLOCKITERATIONS_512K
  • WDT_A_CLOCKITERATIONS_32K
  • WDT_A_CLOCKITERATIONS_8192
  • WDT_A_CLOCKITERATIONS_512
  • WDT_A_CLOCKITERATIONS_64

This function sets the watchdog timer as timer interval mode, which will assert an interrupt without causing a PUC.

Returns
None
void WDT_A_registerInterrupt ( void(*)(void)  intHandler)

Registers an interrupt handler for the watchdog interrupt.

Parameters
intHandleris a pointer to the function to be called when the watchdog interrupt occurs.
Returns
None.

References INT_WDT_A, Interrupt_enableInterrupt(), and Interrupt_registerInterrupt().

void WDT_A_unregisterInterrupt ( void  )

Unregisters the interrupt handler for the watchdog.

This function unregisters the handler to be called when a watchdog interrupt occurs. This function also masks off the interrupt in the interrupt controller so that the interrupt handler no longer is called.

See also
Interrupt_registerInterrupt() for important information about registering interrupt handlers.
Returns
None.

References INT_WDT_A, Interrupt_disableInterrupt(), and Interrupt_unregisterInterrupt().

void WDT_A_setPasswordViolationReset ( uint_fast8_t  resetType)

Sets the type of RESET that happens when a watchdog password violation occurs.

Parameters
resetTypeThe type of reset to set

The resetType parameter must be only one of the following values:

  • WDT_A_HARD_RESET
  • WDT_A_SOFT_RESET
Returns
None.

References SysCtl_setWDTPasswordViolationResetType().

void WDT_A_setTimeoutReset ( uint_fast8_t  resetType)

Sets the type of RESET that happens when a watchdog timeout occurs.

Parameters
resetTypeThe type of reset to set

The resetType parameter must be only one of the following values:

  • WDT_A_HARD_RESET
  • WDT_A_SOFT_RESET
Returns
None.

References SysCtl_setWDTTimeoutResetType().


Copyright 2016, Texas Instruments Incorporated