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.

MSP430FR2475: The GPIO ISR executes continuosly and MCU resets due to watchdog trigger

Part Number: MSP430FR2475

Tool/software:

Hello,
Below is my code snippet for GPIO interrupt. Timer interrupt is used for taking time ticks in the code. When interrupt is received, the interrupt gets detected and code works sometimes properly, but in majority of the cases the ISR function keeps on running and while loop does not execute which triggers watchdog and resets the MCU. Can you please suggest issues with this below code? Timer ISR executes at every 1 ms.
void GPIO_init(void)
{
      P1DIR &= ~BIT2;
       P1REN |= BIT2;
      P1DIR |= BIT3;
      P1OUT |= BIT3;

      // Enable interrupt on P1.2
       P1IE |= BIT2; // Enable interrupt on P1.2
      P1IES |= BIT2; // Interrupt on high-to-low transition (falling edge)
      P1IFG &= ~BIT2; // Clear any pending interrupt flags for P1.1
}
void initTimer(void)
{
      // config for TIMER0
       TA0CCR0 = 32; // for ms
       TA0CTL = TASSEL_1 | MC_1 | TACLR | TAIE; // ACLK, count mode, clear TAR, enable interrupt
      //__bis_SR_register(GIE); // Enter LPM0 w/ interrupts
}
void main(void)
{
        stop_watchdog(); // Stop watchdog timer

        SYSCFG2 |= USCIB0RMP; /* This is required to change the default I2C0 pins */
        SYSCFG3 |= USCIB1RMP; /* This is required to change the default I2C1 pins */

         initClockTo16MHz();
         initTimer();
         system_up = timer_tick;// system_up used to count dock-ON time

         start_watchdog();
         InitGPIO(); //Init GPIOs
          __bis_SR_register(GIE);
         while(1)
         {
               if(fault_type == 3) {
                     printf("fault type :: %d\r\n", fault_type);
                     fault_type = 0;
                }
              if(fault_type == 2) {
                    printf("fault type :: %d\r\n", fault_type);
                    fault_type = 0;
              }
              if(fault_type == 1) {
                    printf("fault type :: %d\r\n", fault_type);
                    fault_type = 0;
              }
              if(fault_type > 3) {
                    fault_type = 0;
                }
         }
}

// Port 1 interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(PORT1_VECT
OR))) Port_1 (void)
#else
#error Compiler not supported!
#endif
{
     if(P1IFG & MCU_GPIO_1_PIN)
     {

            P1IFG &= ~MCU_GPIO_1_PIN;
            fault_type++;
             printf("ISR %d\r\n", fault_type);
      }

}

// Timer0_A3 Interrupt Vector (TAIV) handler
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=TIMER0_A1_VECTOR
__interrupt void TIMER0_A1_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(TIMER0_A1_VECTOR))) TIMER0_A1_ISR (void)
#else
#error Compiler not supported!
#endif
{
      switch(__even_in_range(TA0IV,TA0IV_TAIFG))
      {
           case TA0IV_TAIFG: // overflow
                   timer_tick++;
                   TA0CCR0 = 32; // for milli-sec
                   break;
            case TA0IV_NONE: // No interrupt
                   break;
            case TA0IV_TACCR1: // CCR1 not used
                   break;
            case TA0IV_TACCR2: // CCR2 not used
                   break;
            default:
                   break;
       }
}

**Attention** This is a public forum