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.

MSP432P401R: TIMER A2 for period measurement (driverlib)

Part Number: MSP432P401R


Can i have example C code to initialize timer A2 to use a particular clock source (e.g ACLK, SMCLK) , since the data structure below does not include a clock source.

Timer_A_CaptureModeConfig captureModeConfig =
{
TIMER_A_CAPTURECOMPARE_REGISTER_4; // CC2 Register 4
TIMER_A_CAPTUREMODE_RISING_EDGE, //Rising Edge
TIMER_A_CAPTURE_INPUTSELECT_CCIxA, //CCIxA Input Select - Will use P6.7 which is TA2 CCR4 capture input CCI4A
TIMER_A_CAPTURE_SYNCHRONOUS, //Synchronized Capture
TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE, //Enable interrupt
TIMER_A_OUTPUTMODE_OUTBITVALUE //Output bit value
};

The only capture example in the driverlib examples in the sdk i have installed, is in the 'msp432p4_sdk_1_50_00_12' example folder.

The example file is "timer_a_continous_vlo_period_capture.c"  and the example just shows ACLK  output on P4.2 which is connected to P2.4

in order to use TA0.1 to count the ACLK periods. 

Thanks

  • Hello,

    I'm sure that we have an example available. Just to confirm, you need an example that captures an external signal (maybe from a clock) and then it returns the period of this signal.

    Best regards,

    David
  • I  finally figured it out. I just needed to configure the timer (i.e TA2) for the continuous mode, then at each rising edge, i can use the 'Timer_A_getCounterValue' to read the counter register value in my ISR.

    So this thread can be closed now.

    Thanks

**Attention** This is a public forum