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.

MSP430FR68791: Time A interrupt lost?

Part Number: MSP430FR68791

I use timer TA0 to measure the pulse-width of two input signals (CCR1 and CCR2) with the capture mode (Clock is SMCLK divided by 4  (4 MHz) ).For test purpose, the two input signals have the same source (366 Hz).
The measurement result is 290 Hz.

In case I disable the second interrupt (e.g. for CCR2), then the measurement is correct.
It seems to me that interrupts might be lost.
I use the do/while loop in order to handle pending interrupts as long as interrupts are still pending.

Other reason for the wrong measurement might be wrong irq source detected and so wrong CCR counter used for the measurement.

////////////////////////////////////////////////////
// Interrupt service routine for tacho interrupt  //
// interrupt is triggered with rising edge of     //
// tacho pulse. With the rising edge the current   //
// counter value is captured and stored in CCR1/2  //
////////////////////////////////////////////////////
#pragma vector=TIMER0_A1_VECTOR
__interrupt void ISR_Timer_A( void )
{
    // for debugging static int count    = 0;
    static int lastCCR[2]  = { 0, 0 };

    Uint16   currentCCRx;
    Uint8    fanNr;
    
    uint16_t ccrNr = 0xFFFF;
        
    do
    {
        switch( __even_in_range( TA0IV, 0x0E ) )
        {
            case TA0IV_TACCR1:   /* TA0CCR1_CCIFG */
                currentCCRx = TA0CCR1;
                fanNr = 0;
                ccrNr = TIMER_A_CAPTURECOMPARE_REGISTER_1;
                break;

            case TA0IV_TACCR2:   /* TA0CCR2_CCIFG */
                currentCCRx = TA0CCR2;
                fanNr = 1;
                ccrNr = TIMER_A_CAPTURECOMPARE_REGISTER_2;
                break;

            default:
                ccrNr = 0xFFFF;
                break;
        }    

        // Timer_A_clearTimerInterrupt( TIMER_A0_BASE );
        if( ccrNr!=0xFFFF )
        {
            Uint16 ccrx    = currentCCRx - lastCCR[fanNr];
            lastCCR[fanNr] = currentCCRx;

            i2cIFMemoryMap.rawTacho[fanNr] = ccrx;
            addToTachoArray( fanNr, ccrx );

            Timer_A_clearCaptureCompareInterrupt( TIMER_A0_BASE, ccrNr );

            tachoIrqCount[fanNr]++;
        }
    }while( ccrNr!=0xFFFF );
}

**Attention** This is a public forum