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.

Error in watchdog timer reset function in build 1.10.00.18 of MSP430ware

Other Parts Discussed in Thread: MSP430WARE

The wdt.c has a WDT_resetTimer function:

//*****************************************************************************
//
//! Clears the timer counter of the Watchdog Timer.
//!
//! \param baseAddress is the base address of the WDT module.
//!
//! This function clears the watchdog timer to 0x0000h.
//!
//! \return None
//
//*****************************************************************************
void WDT_resetTimer (unsigned int baseAddress)


However, there is no function prototype for WDT_resetTimer in wdt.h

wdt.h contains the following prototype, for which there is no corresponding function in wdt.c

extern void WDT_clearCounter (unsigned int baseAddress);

Therefore, when using driverlib had to call WDT_resetTimer but that causes the compiler to generate a "function declared implicitly" warning.

Request that the driverlib be changed to provide the correct function prototype to remove the warning.

  • On further investigation found that the WDT_resetTimer function doesn't actually reset the watchdog timer counter. Instead, it writes zero to the WDTCTL_L register which has the effect of selecting a watchdog clock source of SMCLK with a watchdog timer interval of Watchdog clock source /2G

    WDT_resetTimer is:

    void WDT_resetTimer (unsigned int baseAddress)
    {
       //Set Counter Clear bit
       unsigned char newWDTStatus =
         ( HWREGB(baseAddress + OFS_WDTCTL_L) & WDTCNTCL );

       HWREG(baseAddress + OFS_WDTCTL) = WDTPW + newWDTStatus;
    }

    To actually reset the watchdog timer counter needs to be: 

    void WDT_resetTimer (unsigned int baseAddress)
    {
       //Set Counter Clear bit
       unsigned char newWDTStatus =
         ( HWREGB(baseAddress + OFS_WDTCTL_L) | WDTCNTCL );

       HWREG(baseAddress + OFS_WDTCTL) = WDTPW + newWDTStatus;
    }

  • Maybe that's why the function prototype was missing in teh header file: the function is buggy, so it wasn't "published". :)

  • Hi Chester,

    Thanks for pointing this out. This is indeed a bug. We will fix this in the next release. We will update E2E when this fix gets included in the next release.

    Thanks,
    Kasthuri

  • This been fixed in MSP430ware 1.20.00.16. 

**Attention** This is a public forum