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.

MSP430F5659: Timer A1 in capture mode -> CCIFG is never set but interrupt gets called, COV is set every two interrupts

Part Number: MSP430F5659

Hi,

I'm using TA1 in capture mode with external capture pins driven by a PWM signal at 32.768 kHz. The CCIFG of TA1CCR0 never gets set, but I still get in the timer interrupt. One interrupt out of two, COV gets set, as if I skipped reading TA1CCR0. Here's my code:

void main(void) {

  // TA1.0
  P3SEL |= BIT1;
  P3DIR&= ~BIT1;
 
  // TA1CLK
  P3SEL |= BIT0;  
  P3DIR &= ~BIT0;

  TA1CTL = TASSEL__TACLK | ID__1 | MC__STOP;
  TA1CCTL0 = CM1 | CM0 | CAP;

  TA1R = 0;
  TA1CCTL0 &= ~COV;
  TA1CCTL0 |= CCIE;
  TA1CTL |= MC__CONTINOUS;
}

#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) || defined(__CROSSWORKS__)
#pragma vector=TIMER1_A0_VECTOR
__interrupt void isr_timer1_a0(void)
#elif defined(__GNUC__) && (__MSP430__)
void __attribute__ ((interrupt(TIMER1_A0_VECTOR))) isr_timer1_a0(void)
#endif
{
  if (TA1CCTL0 & CCIFG) {
    if (!((P3IN & BIT1) == BIT1)) {
      /* Do something */
    } else {
      /* Do something else */
    }
  } else if (TA1CCTL0 & COV) {
    TA1CCTL0 &= ~COV;
    /* Do something */
  }
}

I put a breakpoint in the interrupt and the value of TA1CCR0 keeps increasing, but the CCIFG flag is never set. Am I missing something?

Thanks,

Fred

**Attention** This is a public forum