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.

MSP-EXP430FR2355: WDT_ISR can't use interrupt.

I try to start wdt by setting in watchdog mode, using 250 msec for generate an interrupt and go to WDT_ISR 

But the interrupt never generate.

Q: Can I make wdt interrupt by WDT ISR in watchdog mode?

     If yes, how can I use for it.

my some code:

int main(void)
{
    WDTCTL = WDTPW | WDTHOLD;                                                                                   // stop watchdog timer
   
    WDTCTL = WDTPW | WDTHOLD;                                                                                   // Stop watchdog timer
    SFRIFG1 &= ~WDTIFG;                                                                                                   // Clear WDT interrupt flag
    WDTCTL = WDTPW |  WDTTMSEL_0 | WDTCNTCL_1 | WDTIS_5 | WDTSSEL_1;      // Start WDT mode, interval timer of 213.33ms, ACLK source
    SFRIE1 |= WDTIE;                                                                                                            // Enable WDT interrupt

    for(;;){
        //coding
    }
}
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=WDT_VECTOR
__interrupt void WDT_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(WDT_VECTOR))) WDT_ISR (void)
#else
#error Compiler not supported!
#endif
{
    SFRIE1 |= ~WDTIE;                    // Disable WDT interrupt
}
  •    WDTCTL = WDTPW |  WDTTMSEL_0 | WDTCNTCL_1 | WDTIS_5 | WDTSSEL_1;      // Start WDT mode, interval timer of 213.33ms, ACLK source

    To get Interval Timer mode (timer interrupt, not reset) you need to set WDTTMSEL=1 [Ref User Guide (SLAU445I) Table 12-2]. Try instead:

       WDTCTL = WDTPW |  WDTTMSEL_1 | WDTCNTCL_1 | WDTIS_5 | WDTSSEL_1;      // Start WDT mode, interval timer of 213.33ms, ACLK source

    TI Example msp430fr235x_WDT_02.c does approximately what you want (just leave out the XT1 crystal startup):

    https://dev.ti.com/tirex/explore/node?node=AJIG7rj-t2Mxd3GB9fdtBg__IOGqZri__LATEST

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

    Unsolicited:

    >     SFRIE1 |= ~WDTIE;                    // Disable WDT interrupt

    This doesn't disable the WDT interrupt. Try instead:

    >     SFRIE1 &= ~WDTIE;                    // Disable WDT interrupt

  • I got it. Thank you very much.

**Attention** This is a public forum