Error in watchdog timer reset function in build 1.10.00.18 of 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;
    }

  • In reply to Chester Gillon:

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

    _____________________________________
    Before posting bug reports or ask for help, do at least quick scan over this article. It applies to any kind of problem reporting. On any forum. And/or look here.
    If you cannot discuss your problem in the public, feel free to start a private conversation: click on my name and then 'start conversation'. But please do so only if you really cannot do it in a public thread, as I usually read all threads. And I prefer to answer where others can profit from it (or contribute to it) too.

  • In reply to Chester Gillon:

    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

    ---------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.
    ---------------------------------------------------------------------------------------------------------

  • In reply to Kasthuri Annamalai:

    This been fixed in MSP430ware 1.20.00.16.