I want to use a GPS module (with a PPS output) to ultimately generate a 5kHz timing signal that is phase-aligned with the PPS positive edge.

PPS-------MSP430-----DAC-------10MHz VCO-------Divider--------5kHz
             /\                            |
             |(count pulses in             |
             |between PPS edges            |
             |inside MCU)                  |       

Thus far, I can generate a stable 10MHz signal (10MHz VCO connected to an MSP430 Launchpad for control), and then I divide this 10MHz signal down to 5kHz using several 74LS90 chips.

  • This generates a very stable 5kHz timing signal, but the positive edge of the 5kHz signal, in the pulse of the period, is NOT aligned with the positive edge of the PPS.

  • How can I adjust the phase, so that the 5kHz and PPS edges are aligned?

----EDIT Thank you for your comments! Our timing error budget is 1 microsecond, so 100nanosec would be great.

I was under the impression that, IF we use a 10MHz oscillator, and control that to 10MHz with the loop, and THEN divide the result down to 5kHz, then "by default" the 5kHz would be very precise (controlling a 10MHz oscillator to within 1Hz, is 100 nanosec of timing accuracy). If I controlled the 5kHz output, and I'm off by 1Hz, then I'm off by 200 microsec (much bigger timing error). Am I correct in my thinking?

  • \$\begingroup\$ Exactly how much jitter is allowable on your 5 kHz wrt the 1 Hz master? If 100 nsec is OK you don't need a PLL. \$\endgroup\$ Sep 4 '15 at 14:29
  • \$\begingroup\$ You need to incorporate the output of the divider, in addition to or instead of the input, in the feedback loop to the MCU. \$\endgroup\$
    – Dave Tweed
    Sep 4 '15 at 14:46
  • 1
    \$\begingroup\$ If you used the MSP430's own counter/timers instead of the 7490 you could reset their state on detecting the PPS edge. \$\endgroup\$ Sep 4 '15 at 16:58
  • 1
    \$\begingroup\$ You can use directe digital synthesis techniques to generate your 5 kHz square wave. Implement some simple algorithm (for example a PID algorithm) that updates the frequency tuning word of your DDS every time you get a PPS edge. This is basically a digital phase lock loop. Let me know if you want me to expand on any of this. \$\endgroup\$
    – mkeith
    Sep 4 '15 at 17:40

Virtually every MCU ever made includes at least one timer/counter module, so it's kind of silly to use an external counter chain.

Just connect the VCXO output to the input of the timer module (or better yet, use the VCXO as the main MCU clock), and program it to generate your 5 kHz output.

In the firmware, you sample the value of the counter every time you get an intterupt from the GPS reference pulse. If the counter has a low value (assuming it's counting up, not down), it means it's running too fast and you need to slow it down. If it has a high value (i.e., near 2000), it means it's running too slow and needs to be speeded up. Adjust the DAC output accordingly.

Eventually, the rollover events of the counter will be synchronized with the GPS reference pulses.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.