This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F5524: Using watchdog timer within a while(1) loop

Part Number: MSP430F5524

I am having certain "defective" ICs with me which are unable to handle a clock speed of 16MHz. The code stops running after a while and I am unable to pause the program in the debugger giving me the error message

I thus want to reset the code when it stops running. Given that my code is already within a while(1), how do I use the watchdog timer to accomplish this? Is something on these lines possible - setting/resetting a variable/register as the first instruction in the while loop failing which the code should get reset? 

When the code stops running, the code seems to be still entering the ISR. So, if I can reset the code from within the ISR, it might well serve my cause.

Thanks and Regards

Abhishek

 

  • The canonical way to use the WDT is to, within your "home loop" in main, reset the WDT each time around -- top or bottom, doesn't matter much.

    You can use the same code to start and to reset the WDT. (You don't have to, but the other ways are extra bother for no benefit.) There is a collection of macros for various WDT uses in legacy.h, e.g.:

    > WDTCTL = WDT_ARST_1000; // one second per ACLK

    The trick is always to judge the right watchdog period -- too short, and it triggers when you don't want it to. 

  • Hi Bruce, 

    Thanks for your response. I haven't been able to look into this yet. I will do it when I get the time and get back to you.

    Thanks and Regards

    Abhishek