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.

MSP430fr5969 timer external capture problem

Other Parts Discussed in Thread: MSP430WARE, MSP430FR5969

Hello,

I am using MSP430fr5969 EVM board and trying to capture signal at P1.1. which is connected to a switch. I want to use timer's capture capability to do that. I configured the timer and the capture registers ( TA0CCTL2 ) as shown below in the code, but no interrupt is generated and nothing captured to the register (TA0CCR2) When I press the button which is connected to P1.1, and also the timer seems to work fine. Can you please review my code help me?. I used MSP430ware 3.6. I want to generate when the signal at P1.1 goes low and capture the timer when this happens. 

void main(void)

{

       //Stop WDT

    WDT_A_hold(WDT_A_BASE);

       CS_setDCOFreq(CS_DCORSEL_0,CS_DCOFSEL_4);

       CS_initClockSignal(CS_SMCLK,CS_DCOCLK_SELECT,CS_CLOCK_DIVIDER_1);

       CS_initClockSignal(CS_MCLK,CS_DCOCLK_SELECT,CS_CLOCK_DIVIDER_1);

      

 

 

    //Set P1.0 to output direction

    GPIO_setAsOutputPin(GPIO_PORT_P1,GPIO_PIN0);

  GPIO_setAsPeripheralModuleFunctionOutputPin(GPIO_PORT_P1,GPIO_PIN1,GPIO_PRIMARY_MODULE_FUNCTION); //P1.1 is used as input capture pinTA0.2    

    GPIO_setAsInputPinWithPullUpResistor(GPIO_PORT_P1,GPIO_PIN1);

 

    /*

     * Disable the GPIO power-on default high-impedance mode to activate

     * previously configured port settings

     */

    PMM_unlockLPM5();

 

 

    //Start timer in continuous mode sourced by SMCLK

    Timer_A_initContinuousModeParam initContParam = {0};

    initContParam.clockSource = TIMER_A_CLOCKSOURCE_SMCLK;

    initContParam.clockSourceDivider = TIMER_A_CLOCKSOURCE_DIVIDER_1;

    initContParam.timerInterruptEnable_TAIE = TIMER_A_TAIE_INTERRUPT_DISABLE;

    initContParam.timerClear = TIMER_A_DO_CLEAR;

    initContParam.startTimer = false;

 

    Timer_A_initContinuousMode(TIMER_A0_BASE, &initContParam);

 

    //Initiaze compare mode

    Timer_A_clearCaptureCompareInterrupt(TIMER_A0_BASE, TIMER_A_CAPTURECOMPARE_REGISTER_0);

 

    Timer_A_initCaptureModeParam initCapParam = {0};

    initCapParam.captureInputSelect = TIMER_A_CAPTURE_INPUTSELECT_CCIxA;

    initCapParam.captureInterruptEnable= TIMER_A_CAPTURECOMPARE_INTERRUPT_DISABLE;

    initCapParam.captureMode = TIMER_A_CAPTUREMODE_FALLING_EDGE;

    initCapParam.captureOutputMode = TIMER_A_OUTPUTMODE_OUTBITVALUE;

    initCapParam.captureRegister = TIMER_A_CAPTURECOMPARE_REGISTER_2;

    initCapParam.synchronizeCaptureSource = TIMER_A_CAPTURE_SYNCHRONOUS;

 

    Timer_A_initCaptureMode(TIMER_A0_BASE, &initCapParam);

    Timer_A_enableCaptureCompareInterrupt ( TIMER_A0_BASE,TIMER_A_CAPTURECOMPARE_REGISTER_2  );

    Timer_A_startCounter(TIMER_A0_BASE,TIMER_A_CONTINUOUS_MODE);

 

    //Enter LPM0, enable interrupts

    __bis_SR_register(LPM0_bits + GIE);

 

    //For debugger

    __no_operation();

}

 

//******************************************************************************

//

//This is the TIMER0_A3 interrupt vector service routine.

//

//******************************************************************************

#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)

#pragma vector=TIMER0_A1_VECTOR

__interrupt

#elif defined(__GNUC__)

__attribute__((interrupt(TIMER0_A1_VECTOR )))

#endif

void CCR2_ISR(void)

{

  

    //Toggle P1.0

    GPIO_toggleOutputOnPin(

        GPIO_PORT_P1,

        GPIO_PIN0

        );

 

}

 

**Attention** This is a public forum