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.

Watchdog unexpected interval

Other Parts Discussed in Thread: MSP430F5529, MSP-EXP430F5529LP

Hi everyone,

I am using the MSP430F5529 launchpad.
So I was playing a bit with the watchdog.
I was trying the lab4b from the workshop and was running into some weird timings.
So I loaded the example wdt_a_ex3_watchdogACLK and I was expecting the LED to toggle with 1s interval. It doesn't. It's about 3-4 seconds.

It's weird. Can anyone explain what could be going on? Can it be a previous configuration? I don't remember setting the ACLK with a /4 divider and I also did a power cycle. 


Here is the example so you don't need to check it out.

#include "driverlib.h"

void main(void)
{
    //Watchdog mode -> reset after expired time; WDT is clocked by ACLK
    //Set Watchdog Timer timeout 1s - SET BREAKPOINT HERE
    WDT_A_watchdogTimerInit(WDT_A_BASE,
                            WDT_A_CLOCKSOURCE_ACLK,
                            WDT_A_CLOCKDIVIDER_32K);

    WDT_A_start(WDT_A_BASE);

    //Set P1.0 to output direction
    GPIO_setAsOutputPin(
        GPIO_PORT_P1,
        GPIO_PIN0
        );

    //Toggle P1.0
    GPIO_toggleOutputOnPin(
        GPIO_PORT_P1,
        GPIO_PIN0
        );

    //Enter LPM3
    __bis_SR_register(LPM3_bits + GIE);
    //For debugger
    __no_operation();
}

  • Got a 32K crystal attached? If not or broken the VLO will kick in and is 1/3 the Hz. The x5xx series does have a calibrated internal 32K Clkref though.

  • Thanks for the reply.
    I forgot to add (doh), I am using the F5529 launchpad.
    I checked the crystal and visually it's fine (contacts there and in 1 piece).

    I also checked with UCS_getACLK(); and it returned 32768.
  • 1 question. The ACLK after starting up defaults to the external crystal 1, correct? Might it be that for some odd reason the XT1 pins are by default GPIO pins? It's weird since the example does not mind that at all and the UCS_getACLK() returns 32768.
  • I guess I have a broken MSP? :o

    I checked the registers. ACLK source is XT1. The division is 1.
    The API function also returns 32768.

    Tried to use the SMCLK for the Watchdog source. Changed the low power mode to 1 instead of 3 so it would work.
    Since the default is about 1Mhz I used for the watchdog interval WDT_A_CLOCKDIVIDER_8192K. Expected about 8 second delay.
    It worked correctly.

    If the VLO kicks for the ACLK in will it show in UCSCTL4->SELA?

    Edit:
    I tried to actually config source the ACLK with the VLO, tried some divisions and that way it works fine too :/ I really don't get it

  • Luis Afonso said:
    I guess I have a broken MSP? :o

    My MSP-EXP430F5529LP behaves the same way.

    The MSP430x5xx and MSP430x6xx Family User's Guide says:

    On devices that have XIN and XOUT shared with general-purpose I/O, XIN and XOUT pins are set to general-purpose I/Os and XT1 remains disabled until the I/O ports are configured for XT1 operation. If XIN and XOUT are not shared with general-purpose I/O, XT1 is enabled.

    On a MSP430F5529 XIN is shared with P5.4 and XOUT is shared with P5.5. With the example changed to the following, which initializes XT1, the LED then toggled approx every second:

    #include "driverlib.h"
    
    void main(void)
    {
        //Watchdog mode -> reset after expired time; WDT is clocked by ACLK
        //Set Watchdog Timer timeout 1s - SET BREAKPOINT HERE
        WDT_A_watchdogTimerInit(WDT_A_BASE,
                                WDT_A_CLOCKSOURCE_ACLK,
                                WDT_A_CLOCKDIVIDER_32K);
    
        WDT_A_start(WDT_A_BASE);
    
        //Set P1.0 to output direction
        GPIO_setAsOutputPin(
            GPIO_PORT_P1,
            GPIO_PIN0
            );
    
        //Toggle P1.0
        GPIO_toggleOutputOnPin(
            GPIO_PORT_P1,
            GPIO_PIN0
            );
    
        //Port select XT1
        GPIO_setAsPeripheralModuleFunctionInputPin(
            GPIO_PORT_P5,
            GPIO_PIN4 + GPIO_PIN5
            );
    
        //Initializes the XT1 crystal oscillator with no timeout
        //In case of failure, code hangs here.
        //For time-out instead of code hang use UCS_LFXT1StartWithTimeout()
        UCS_LFXT1Start(
            UCS_XT1_DRIVE0,
            UCS_XCAP_3
            );
    
        //Enter LPM3
        __bis_SR_register(LPM3_bits + GIE);
        //For debugger
        __no_operation();
    }
    

  • Hi chester,

    Thanks!

    Just one more thing. It seems that if the XT1 fails it's the REFO.
    In the workshop it says that and in the reference manual:
    If ACLK is sourced from XT1 in LF mode, an oscillator fault causes ACLK to be automatically switched to the REFO for its clock source (REFOCLK).

    I tried sourcing the watchdog timer with the REFO so I know it's working correctly.
    So why did the ACLK change to the VLO instead of the REFO?

    (many questions :p)
  • Luis Afonso said:
    If ACLK is sourced from XT1 in LF mode, an oscillator fault causes ACLK to be automatically switched to the REFO for its clock source (REFOCLK).

    That statement is in the 5.2.12 UCS Module Fail-Safe Operation section of the User's Guide. Section 5.2.12 also states:
    When using XT1 operation in LF mode as the reference source into the FLL (SELREF = {0}), a crystal fault automatically causes the FLL reference source, FLLREFCLK, to be sourced by the REFO.

    Whereas section 16.2.5 Clock Fail-Safe Feature says:

    The WDT_A provides a fail-safe clocking feature, ensuring the clock to the WDT_A cannot be disabled while in watchdog mode. This means that the low-power modes may be affected by the choice for the WDT_A clock.

    If SMCLK or ACLK fails as the WDT_A clock source, VLOCLK is automatically selected as the WDT_A clock source.

    I think this means that when XT1 (ACLK) is used as the source for the FLL and watchdog, that when a XT1 crystal fault occurs:

    - The watchdog uses VLOCLK as it's "fail-safe" clock source

    - The FLL uses REFO as it's "fail-safe" clock source

  • So I guess since the fault was with the watchdog working, instead of using the ACLK it used the VLO directly!

    Thank you very much Chester, very helpful :D
  • In the example it says it should work for the F5529. Maybe something to change in future releases?

**Attention** This is a public forum