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.

CCS/MSP430F5438A: How to Disable the Timer Interrupt

Part Number: MSP430F5438A


Tool/software: Code Composer Studio

HI

I am trying to create a 1msec delay using timer in MSP430F5438A

It gets struck in ISR_TRAP Handler

Please suggest any code changes required

Here is my code

int main()

{


    TIMEREND=0;
    
  
   timer_delay();
     while(TIMEREND!=1);
 
     spi_read_write(); 
  

}

timer_delay()

{

 
     TA0CCR0 = 1600-1;
     TA0CCTL0 =  CCIE;                          // CCR0 interrupt enabled
     TA0CTL = TASSEL_2 + MC_1;         // SMCLK, uptmode
          __bis_SR_register( GIE);       // Enter LPM0, enable interrupts
 
 
}

// Timer A0 interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=TIMER0_A0_VECTOR
__interrupt void TIMER0_A0_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(TIMER1_A0_VECTOR))) TIMER1_A0_ISR (void)
#else
#error Compiler not supported!
#endif
{
    TIMEREND = 1;
  TA0CTL |=  MC_0; 
}

In debug mode when it comes to   spi_read_write(); it goes into trap handler and get struck. I am not getting what is the reason

I checked SR Register, CPUOFF is getting set to 1.

**Attention** This is a public forum