Boomerang Using Watchdog

From TinyOS Wiki
Jump to: navigation, search

It is easy to use the watchdog timer in the MSP430, and using it is fairly application specific, which are the primary reasons there is no explicit TinyOS component for it. Here are some tips:

  1. Read Chapter 10 "Watchdog Timer" in the MSP430 x1xx User's Guide from TI.
  2. MSPGCC defines some helper macros in common.h, which is indirectly included in all TinyOS MSP430 builds. You can find that header at /opt/msp430/msp430/include/msp430/common.h. Observe for instance "WDT_ARST_1000" which configures the watchdog timer to fire after about 1000ms based on a 32kHz ACLK.
  3. For a concrete example, see KrakenWatchdogM.nc in tinyos-1.x/contrib/nestfe/nesc/sensorboard/trio/. You need to check that out from the TinyOS CVS repository; a packaged TinyOS distribution such as Boomerang will not have it. For instance, the code is constructed so that this line of code is periodically called when things are working correctly:
    WDTCTL = WDT_ARST_1000;
    The pieces tested there are the Timer system (explicitly) and task execution (implicitly). If either of those catastrophically fail, the MCU resets within a few seconds.