Jump to content

MSP432 and high speed interrupts

Recommended Posts

Greetings all!


I'm trying to make a 10MHz oscillator that is phase-coherent with a GPS PPS signal from a GPS receiver that I have.  I'm using the MSP432 launchpad to do this, but I'm not sure it has the speed to act as a 10MHz frequency counter.


The general setup is simple:   


GPS PPS---------------


-->VCO --> MSP432 launchpad --> DAC --

|                                                                 |



Every 1 PPS, the MSP432 will count the number of pulses it receives from the VCO.  If the pulses are more or less than 10,000,000, then adjust the VCO input voltage via the DAC.



1. I have two interrupts - one that triggers on the rising edge of the PPS pulse (so this interrupt will happen once a second), and a second that triggers on every rising edge of the VCO output (so this will trigger ~10,000,000 a second).  I think I'm allowed to use two separate interrupts at the same time - how can I set the PPS interrupt as a higher priority over the VCO interrupt?


Thank you for any help you can provide!


Link to post
Share on other sites

Use the VCO as an external timebase for the counter. Use the GPS PPS as a timer capture interrrupt.


The ISR for the timer capture interrupt will subtract the current capture from the previous to determine the VCO frequency. The DAC can then be adjusted using that value and a suitable control loop such as a PID.

Link to post
Share on other sites

Thank you again oPossum for your help!


I'm trying to read up on the MSP432 and its Timers, as it appears that Energia (my original programming IDE) does not have functions to use the individual timer functions that I need (for instance, using a Timer as a counter with an external input).


Don't mean to pester, but a follow-up question to you (I have also asked this in the e2e forums at TI.com):


When using the PPS trigger, let's say that I START counting on one PPS reception, then STOP counting on the next PPS reception, then START counting on the next... etc....  


--> Will the timer/counter that I use be able to start counting immediately on the PPS interrupt, so that I don't potentially miss a pulse or two due to interrupt latency?  

Link to post
Share on other sites



You just have do don't stop the timer, just reset the count.


PPS signal -> interrupt

store counter value

reset counter

do anything else

PPS signal -> interrupt

store counter value

reset counter


In fact it just depends on how you configure your timer : here just setup it to do not stop on interrupt. 

Link to post
Share on other sites

The most accurate results will be obtained if the counter is never stopped or reset. The time interval is calculated by subtracting the previous capture from the current capture when the capture interrupt occurs. Refer to (capture mode) and (external clock source) of slau356a.



void timer_capture_isr(void)
    static int16_t previous_capture;

    int16_t const timer_capture = (int16_t)TAxCCRn;

    int16_t const error = timer_capture - previous_capture + 27008;

    previous_capture = timer_capture;

    // do something with error
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...