Hello everyone, I want to have the 1000ms watchdog for my application, sourced from ACLK, so I have started it with this: WDTCTL = WDT_ARST_1000; And then in my main processing loop, I update it as often as possible with WDTCTL = WDTPW + WDTCNTCL; However, in the debug session when I read the WDTCTL register, it does not retain the settings it previously had with the WDT_ARST_1000. Does updating the counter reset it? Should I be doing a WDTCTL = WDTPW + WDTCNTCL + WDT_ARST_1000; ? Thanks for clearning this up for me, Bob E.

Does updating the watchdog reset its settings?
Started by ●November 28, 2003
Reply by ●November 28, 20032003-11-28
On Fri, Nov 28, 2003 at 04:12:03AM -0000, achillea88 wrote: > Does updating the counter reset it? Should I be doing a > > WDTCTL = WDTPW + WDTCNTCL + WDT_ARST_1000; ? Yes. Every time you write to the WDTCTL register you must supply the "password". -- Clyde Stubbs | HI-TECH Software Email: clyde@clyd... | Phone Fax WWW: http://www.htsoft.com/ | USA: (408) 490 2885 (408) 490 2885 PGP: finger clyde@clyd... | AUS: +61 7 3552 7777 +61 7 3552 7778 --- HI-TECH C: compiling the real world.
Reply by ●November 28, 20032003-11-28
Sorry, I may have phrased my question incorrectly. My query is: to reset the counter and stop the watchdog from sending a PUC, I need to set the WDTCNTCL bit. WDTCTL = WDTPW + WDTCNTCL ; My question is if I must send the WDT_ARST_1000 as well when I reset the counter to stop the PUC event ( in order to configure it for 1000ms watchdog sourced from ACLK, i.e.) WDTCTL = WDTPW + WDTCNTCL + WDT_ARST_1000; Thanks, Bob E. --- In msp430@msp4..., Clyde Stubbs <clyde@h...> wrote: > On Fri, Nov 28, 2003 at 04:12:03AM -0000, achillea88 wrote: > > Does updating the counter reset it? Should I be doing a > > > > WDTCTL = WDTPW + WDTCNTCL + WDT_ARST_1000; ? > > Yes. Every time you write to the WDTCTL register you must supply > the "password". > > > > -- > Clyde Stubbs | HI-TECH Software > Email: clyde@h... | Phone Fax > WWW: http://www.htsoft.com/ | USA: (408) 490 2885 (408) 490 2885 > PGP: finger clyde@h... | AUS: +61 7 3552 7777 +61 7 3552 7778 > -------------------------------- ------- > HI-TECH C: compiling the real world.
Reply by ●November 28, 20032003-11-28
Bob here;s what i do; In the main code I reset the wdog as often as possible by calling this macro: /* ______ MACROS ______________________________________________________________ */ // service the watchdog timer and clear it. #define WDOG() (WDTCTL = (WDTCTL & 0xFF) + WDTPW + WDTCNTCL) // used to periodicly reset WDT #ifdef __RELEASE__ // initialize the watchdog timer #define WDTSTART WDTCTL = WDT_ARST_250 // WDT runs on ACLK (Xt1) #else #define WDTSTART #endif // hold watchdog timer //#define WDTCTL_STOP WDTCTL = (WDTCTL & WDTHOLD) + WDTPW + WDTCNTCL #define WDTCTL_STOP WDTCTL = WDTPW+WDTHOLD #define OS_ENTER_CRITICAL() { _DINT(); WDTCTL_STOP; } #define OS_EXIT_CRITICAL() { _EINT(); WDOG(); } /* ______ MAIN PROGRAMM _____________________________________________________ */ void main(void) { WDTCTL_STOP(); // stop watchdog timer // setup rest of the cpu #ifdef __RELEASE__ WDSTART(); #endif _EINT(); for (;;){ swap(); } } Hope this helps. I have an other question though, In my program I do most of my stuff in an int (timerB0) this also include writing to flash, but for some reason this is where my program goes wrong. Here how I do it: Enter TimerBVector(){ // enter int OS_ENTER_CRITICAL() Do code here // exit int OS_EXIT_CRITICAL() } Problem now is that the msp will reset it self, probably since I doing something wrong with the WDOG, could anyone help me on the road here? thanks Martijn. _____ From: achillea88 [mailto:achillea88@achi...] Sent: vrijdag 28 november 2003 6:42 To: msp430@msp4... Subject: [msp430] Re: Does updating the watchdog reset its settings? Sorry, I may have phrased my question incorrectly. My query is: to reset the counter and stop the watchdog from sending a PUC, I need to set the WDTCNTCL bit. WDTCTL = WDTPW + WDTCNTCL ; My question is if I must send the WDT_ARST_1000 as well when I reset the counter to stop the PUC event ( in order to configure it for 1000ms watchdog sourced from ACLK, i.e.) WDTCTL = WDTPW + WDTCNTCL + WDT_ARST_1000; Thanks, Bob E. --- In msp430@msp4..., Clyde Stubbs <clyde@h...> wrote: > On Fri, Nov 28, 2003 at 04:12:03AM -0000, achillea88 wrote: > > Does updating the counter reset it? Should I be doing a > > > > WDTCTL = WDTPW + WDTCNTCL + WDT_ARST_1000; ? > > Yes. Every time you write to the WDTCTL register you must supply > the "password". > > > > -- > Clyde Stubbs | HI-TECH Software > Email: clyde@h... | Phone Fax > WWW: http://www.htsoft.com/ | USA: (408) 490 2885 (408) 490 2885 > PGP: finger clyde@h... | AUS: +61 7 3552 7777 +61 7 3552 7778 > -------------------------------- ------- > HI-TECH C: compiling the real world. Yahoo! Groups Sponsor <http://rd.yahoo.com/SIGcsjacbe/M%9395.3614674.4902533.1261774/D=egroupweb/S05005378:HM/EXP70084504/A24963/R=0/*http:/hits.411web.com/cgi-bin/autoredir?campU6&lineid614674egroupweb&pos=HM> <http://us.adserver.yahoo.com/l?M%9395.3614674.4902533.1261774/D=egroupmail/S=:HM/A24963/randy2592476> . ">http://docs.yahoo.com/info/terms/> .
Reply by ●November 28, 20032003-11-28
Hi Martijn, Why do you use (WDTCTCL & OxFF) in WDOG()? I have never seen that before. About the wathcdog settings: I have almost identical macros setup to setup and reset the watchdog, but when I view the contents of WDTCTL in the IAR debugger after clearing the watchdog, it seems as if the bits I enabled for the settings are no longer set. In terms of your problem with the device resetting, I dont really see a problem? Have you isolated the problem to the watch dog portion of the code in the interrupt? Bob E. --- In msp430@msp4..., "Martijn Broens" <martijn@a...> wrote: > Bob here;s what i do; > > In the main code I reset the wdog as often as possible by calling this macro: > /* ______ MACROS ______________________________________________________________ */ > // service the watchdog timer and clear it. > #define WDOG() (WDTCTL = (WDTCTL & 0xFF) + WDTPW + WDTCNTCL) // used to periodicly reset WDT > > #ifdef __RELEASE__ > // initialize the watchdog timer > #define WDTSTART WDTCTL WDT_ARST_250 // WDT runs on ACLK (Xt1) > #else > #define WDTSTART > #endif > > // hold watchdog timer > //#define WDTCTL_STOP WDTCTL = (WDTCTL & WDTHOLD) + WDTPW + WDTCNTCL > #define WDTCTL_STOP WDTCTL = WDTPW+WDTHOLD > > #define OS_ENTER_CRITICAL() { _DINT(); WDTCTL_STOP; } > #define OS_EXIT_CRITICAL() { _EINT(); WDOG(); } > > /* ______ MAIN PROGRAMM _____________________________________________________ */ > void main(void) > { > WDTCTL_STOP(); // stop watchdog timer > // setup rest of the cpu > > #ifdef __RELEASE__ > WDSTART(); > #endif > > _EINT(); > > for (;;){ > swap(); > } > } > > Hope this helps. > > I have an other question though, > In my program I do most of my stuff in an int (timerB0) this also include writing to flash, but for some reason this is where my program goes wrong. > Here how I do it: > Enter TimerBVector(){ > // enter int > OS_ENTER_CRITICAL() > Do code here > > // exit int > OS_EXIT_CRITICAL() > } > Problem now is that the msp will reset it self, probably since I doing something wrong with the WDOG, could anyone help me on the road here? > > > thanks Martijn. > _____
Reply by ●November 28, 20032003-11-28
You shouldn't use read-modify-write instructions on the WDT. You're reading w/o the key....... -- Kris ----- Original Message ----- From: "achillea88" <achillea88@achi...> To: <msp430@msp4...> Sent: Saturday, November 29, 2003 3:56 AM Subject: [msp430] Re: Does updating the watchdog reset its settings?
Reply by ●November 28, 20032003-11-28
--- In msp430@msp4..., "achillea88" <achillea88@y...> wrote: > And then in my main processing loop, I update it as often as possible > with > > WDTCTL = WDTPW + WDTCNTCL; This is how the various Salvo MSP430 libraries reset the watchdog timer from within OSSched(): WDTCTL = (WDTCTL & 0x00FF) | WDTPW | WDTCNTCL Note that this preserves the watchdog's configuration, so it's applicable to however the user has configured / initialized the watchog. Also note that for this sort of thing to work correctly, the code must compile down to the following sequence (or something functionally identical): MOV &288,R12 AND #255,R12 BIS #23048,R12 MOV R12,&288 to ensure that the WDTCTL (it's at &288) is written only once, with the password in place. Check your compiler's output to ensure that it's happening this way. --Andrew Kalman aek ... at ... pumpkininc ... dot ... com
Reply by ●November 28, 20032003-11-28
--- In msp430@msp4..., "Martijn Broens" <martijn@a...> wrote: > I have an other question though, > In my program I do most of my stuff in an int (timerB0) this also include writing to flash, but for some reason this is where my program goes wrong. > Here how I do it: > Enter TimerBVector(){ > // enter int > OS_ENTER_CRITICAL() > Do code here > > // exit int > OS_EXIT_CRITICAL() > } > Problem now is that the msp will reset it self, probably since I doing something wrong with the WDOG, could anyone help me on the road here? Well, for starters, I would advise against blindly re-enabling interrupts at the end of an MSP430 ISR -- the Salvo RTOS avoids doing this, and you can probably do that, too (I presume you're running an RTOS) with the proper configuration. Remember, the RETI that the compiler automatically places at the end of the ISR will automatically restore global interrupts to what they were prior to entering the ISR ... so OS_EXIT_CRITICAL() only ensures that you might get interrupted at the end of your ISR -- not such a good idea in most cases. Perhaps you are running out of stack? --Andrew Kalman aek ... at ... pumpkininc ... dot ... com
