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.

MSP432 and high speed input capture counter

Greetings all!

I'm using the MSP432 launchpad, along with a GPS module (witha 1PPS output) and a 10MHz VCXO oscillator to make a GPS-disciplined 10MHz oscillator.  

I'm using the 1PPS GPS input as the interrupt source, and I would like to use another MSP432 pin to count the number of 10Mhz pulses between PPS pulses (ideally, the count should be 10,000,000 - if not, then I can use the voltage control pin on the 10MHz oscillator to fine-tune the frequency as needed).  I would *think* that I need to use Timer32 and NOT a 16-bit timer, as I need 32 bits to hold the number 10,000,000.

My question is: on the MSP432, is there a method/sample code, showing how to use the input capture to count pulses - and how to start/stop counting pulses based on another external interrupt pin (the PPS pulse in my case)?

Sincerely,

Rick

  • Hi Richard,

    Timer32 is a simple counter without input capture capability or an option to change the clock source to an external one.
    You could use it to count the number of internal clock cycles between PPS pulses, if you connect the PPS to a GPIO interrupt and just read the number of cycles between events. However, you can't use the 10Mhz input to source this clock and it wouldn't be practical to connect the 10Mhz clock to a GPIO interrupt and count every event.

    I believe that a good option could be to use Timer_A. You can select the clock source of Timer_A to be an external pin (known as TAxCLK, check TAxCTL.TASSEL) and you can feed the 10Mhz clock to this pin. In this way, the timer will increment automatically on every 10Mhz pulse.
    Then you can connect the PPS pin to a timer input (i.e. TAx.y). You'll get a TAxCCTLy.CCIFG interrupt on every one of these events and you can just check the number of 10Mhz pulses in between events.
    Now, as you mention, the timer is 16-bits, so you'll get an overflow after 65536 pulses, however you can use the overflow event (TAxCTL.TAIFG) to keep a count of these events. That will happen every ~6.5ms.

    I don't know any code example to do exactly this, but a good starting point could be the DriverLib examples (included in CCS and also available here www.ti.com/.../MSPDRIVERLIB). These examples include:
    - timer_a_continuous_vlo_period_capture uses input capture to check the number of SMCLK cycles between VLO pulses.
    - timer_a_continuous_overflow_interrupt shows how to enable the timer overflow interrupt


    Regards,
    Luis R

**Attention** This is a public forum