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.

MSP432P4111: Using external timer source on the MSP432

Part Number: MSP432P4111

I'm trying to use a timer as a pulse counter on the MSP432 using an external source on a GPIO pin (P7.4/PM_TA1.4/C0.5), but when I apply a square wave to the GPIO input the timer counter doesn't change.  Am I missing something?  The code is shown below:

GPIO_setAsInputPin(GPIO_PORT_P7, GPIO_PIN4);

Timer_A_params.clockSource = TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK;

Timer_A_params.clockSourceDivider = TIMER_A_CLOCKSOURCE_DIVIDER_1;

Timer_A_params.timerInterruptEnable_TAIE = TIMER_A_TAIE_INTERRUPT_DISABLE;

Timer_A_params.timerClear = TIMER_A_DO_CLEAR;

Timer_A_initContinuousMode(TIMER_A1_BASE, &Timer_A_params);

Timer_A_startCounter(TIMER_A1_BASE, TIMER_A_CONTINUOUS_MODE);

Unfortunately there are no examples that I've come across that use an external pin as a timer source, and the documentation I've found doesn't do a good job explaining how to set it up.

Thanks

 

  • The external clock for TA1 is TA1CLK, available on P7.2. From Data Sheet (SLASEA0) Table 6-69, you need to set it as input with PSEL1/0=0/1, using something like:

    > GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P7, GPIO_PIN_2, GPIO_PRIMARY_MODULE_FUNCTION); // P7.2 as TA1CLK

    If you're stuck with P7.4, it looks like you can use the port mapper to assign the TA1CLK function to P7.4. 

  • OK, I see the source of confusion, what I thought could be mapped as a clock input (P7.4) can be used as a PWM output, but only P7.2 can be used as a clock source input for TA1, unless I remap P7.4.  Luckily P7.2 is not being used in our design, so I will request to have it re-routed for use as a pulse counter input.

    Thanks

**Attention** This is a public forum