1237 views|0 replies

6555

Posts

0

Resources
The OP
 

MSP430F5538A watchdog [Copy link]

1、watchdogtimer(WDT_A)

Watchdog timer?

Watchdog Timer 32-bit timer, can be used as a watchdog or as an interval timer.

Before you watch, ask yourself a few questions

a. Does the watchdog depend on the clock configuration?

b. How long does it take to feed the dog, software feeding dog (timer)? How to configure the time length?

c. What is the difference between watchdog restart, software restart and hardware restart?

The main function of the watchdog timer module is to execute a system restart when a software problem occurs; if the watchdog is not fed within the specified time, the system will be reset.

If the watchdog function is not required in the application, the watchdog module can be configured as an interval timer and generate interrupts at specified intervals.

Watchdog timer module features:

8 software-selectable time intervals

Watchdog Mode

Interval Mode

Password protected access to the watchdog timer control registers

Selectable clock source

Stop using to save electricity

Clock fail-safe feature

Note: Watchdog timer is activated at power-up

After PUC (power-on clear reset signal), the WDT_A module is automatically configured in watchdog mode, using SMCLK as the clock source and a reset interval of ~32ms; so the user must set or stop the WDT_A module before the initial reset interval times out;

Msp430f5438a.cmd(c:\ti\ccsv5\ccs_base\msp430\include)

WDTCTL=0x015C;

/*!when0thewatchdogtimerandinterruptisusedandaninvalidpassword
*isusedtoresetthepart,when1thewatchdogexpiringwillcausethemicro
*toresetandifACLKgoesawayVLOCLKwillbeused.
*/
#defineUSE_FAILSAFE_WATCHDOG(1)

#defineWDTPW(0x5A00)

#defineWDTCNTCL(0x0008)/*WDT-TimerClear*/

#defineWDTSSEL__ACLK(1*0x0020u)/*WDT-TimerClockSourceSelect:ACLK*/

#defineWDTIS_3(3*0x0001u)/*WDT-TimerIntervalSelect:/512k*/

voidResetWatchdog(void)
{
/*setwatchdogfor16secondtimeout
*writepassword,selectaclk,WDTIS_3meansdivideby512*1024=16s;
*WDTIS_2:4mins

*AnywriteoperationtoWDTCTLmustbeawordoperationwith05Ah(WDTPW)intheupperbyte

Watchdogtimerintervalselect.Thesebitsselectthewatchdogtimerintervalto
settheWDTIFGflagand/orgenerateaPUC.
000b=Watchdogclocksource/(2^31)(18h:12m:16sat32.768kHz)
001b=Watchdogclocksource/(2^27)(01h:08m:16sat32.768kHz)
010b=Watchdogclocksource/(2^23)(00h:04m:16sat32.768kHz)
011b=Watchdogclocksource/(2^19)(00h:00m:16sat32.768kHz)
100b=Watchdogclocksource/(2^15)(1sat32.768kHz)
101b=Watchdogclocksource/(2^13)(250msat32.768kHz)
110b=Watchdogclocksource/(2^9)(15.625msat32.768kHz)
111b=Watchdogclocksource/(2^6)(1.95msat32.768kHz)

2^19/(32.768KHZ)=512*1024/32768=16s

*/
#ifUSE_FAILSAFE_WATCHDOG
/* watchdog function *

WDTPW password 0x5a00

WDTCNTCL: count clear

Clock source and timeout interval: ACLK, 3 (that is, 16s)

*/
WDTCTL=WDTPW+WDTCNTCL+WDTSSEL__ACLK+WDTIS_3;

/* Interrupt Enable Register Interrupt enable register, */
SFRIE1 &= ~WDTIE; /* disable watchdog timer interrupt */


#else
/* interval timer interval timer */
WDTCTL = WDTPW + WDTCNTCL + WDTSSEL__ACLK + WDTIS_3 + WDTTMSEL;

/* enable watchdog timer interrupt */
SFRIE1 |= WDTIE;

#endif
}

In the idle thread, void ResetWatchdog(void) will be called, and the time-consuming tasks need to feed the watchdog appropriately.

This post is from Microcontroller MCU
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list