We need to use 1PPS (pulse-per second) in our standalone system which is based on arm processor, and has cameras input.

The 1PPS is implemented with GPIO which is injecting an interrupt (low to high) every 1 second.

The 1PPS is needed for a timetag of video captured frames.

I try to understand the motivation of using 1PPS in such a standalone cpu system:

Today cpu already have high resolution timer within its soc/processor, than what's the added value of using PPS in such system ?

  • 2
    \$\begingroup\$ resolution vs GPS accuracy \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Feb 15 at 23:50
  • 1
    \$\begingroup\$ Where is the PPS signal coming from? If it's from GPS or similar precision source, then see the answer from @SunnyskyguyEE75 \$\endgroup\$ – TimWescott Feb 16 at 0:59
  • 4
    \$\begingroup\$ You making the common mistake of confusing high resolution with high accuracy. \$\endgroup\$ – brhans Feb 16 at 2:59
  • \$\begingroup\$ the pps comes from gpio, I will add that now to the question, I am probably confusing something. I don't understand yet what. the system gets the 1pps from gpio, and there is no other system which also use the same 1pps. \$\endgroup\$ – ransh Feb 16 at 6:58
  • 2
    \$\begingroup\$ But what is driving the GPIO pin? What is the original source of the 1pps signal? An external alarm clock? A GPS receiver? A 555 circuit? Also, what are the requirements of the 1 pps signal? Accuracy? Drift? Allen deviation? \$\endgroup\$ – AnalogKid Feb 17 at 18:14

You will want to "discipline" the local timer with a PPS from an oscillator with better long term stability (I infer GPS from your questions tags). This can be done by measuring the "run away" (if using a 1GHz precision timer, does the PPS always occur after 1,000,000,000 ticks?) and tune the local timer to compensate this runaway.

The added value will be improved long term stability.

The GPS is not "better" than your local oscillator, nor is it the other way around, because the stability of oscillators is not a simple scalar value. It can be measured by plotting the Allan Deviation against integration time in a sigma-tau-diagram. Given two different oscillators, one might be more stable on the short term (crystal), the other on the long term. In this case, the lines will intersect in the diagram. The abscissa of the intersection gives the optimum time constant for such a control loop.

  • \$\begingroup\$ Given that the GPS signal is the average of dozens of atomic clocks, my guess is that it always is better than the local signal. \$\endgroup\$ – AnalogKid Feb 17 at 18:17
  • 2
    \$\begingroup\$ @AnalogKid The stability of the "signal in space" might be better than anything money can buy (as can be seen here), but if you look at the IQ constellation diagram of a receiver, you will see that you do not want to clock a processor from this. Way too much phase noise due to scintillation multipath and so on. \$\endgroup\$ – Andreas Feb 17 at 18:52
  • \$\begingroup\$ The GPS satellites are also compared with and corrected against terrestrial atomic clocks. Probably both of you know that already. \$\endgroup\$ – mkeith Feb 17 at 19:03
  • 2
    \$\begingroup\$ @mkeith Yes, I answered on this topic some time ago. \$\endgroup\$ – Andreas Feb 17 at 19:06
  • 2
    \$\begingroup\$ A - I agree with your phase noise comment, BUT - the signal is getting into uC (clock quality unknown) through a GPIO pin (hardware and software latency unknown), so I doubt that the phase noise is as important as the long term accuracy. 1 video frame is 10 - 20 ms; that's a loooooot of phase noise margin. \$\endgroup\$ – AnalogKid Feb 17 at 19:29

PPS is a name which is usually given to the output of a GPS module. PPS stands for "pulse per second."

Now I will talk about the PPS signal which comes from a GPS module. Because this pulse comes ultimately from the GPS system which has very accurate timekeeping, you can be very sure that it gives an accurate time stamp which will not drift in the long term.

Now let's talk about clocks used in microprocessors. A typical crystal oscillator may have a tolerance of 50 parts per million (50 ppm). Let's say it is a 1 MHz oscillator. If you set a timer to zero, and count clock pulses, you don't know if the true frequency of the clock is 1,000,000 Hz or 1,000,050 Hz or 999,950 Hz, because of the 50 ppm tolerance. So if you count out 1 million seconds worth of time (1 billion clock pulses) you may be off by as much as 50 seconds. One million seconds is about 11 days.

However, with PPS, assuming it is locked to the GPS network, after 1 million seconds, you will count exactly 1 million pulses, because the 1pps signal is extremely accurate (based on the whole multi-billion dollar GPS network).

It is also possible to basically calibrate the local oscillator against the PPS signal so that you can correct for the 50 ppm tolerance and obtain a clock that is both fast and accurate. But I think that gets a bit complicated. I am sure people have worked out all the details, and you can search for them if you are interested.

  • \$\begingroup\$ So using gpio as pps source (instead of gpio) seems to be pointless, or does it still have about the same advantage of long term as discussed with gps? \$\endgroup\$ – ransh Feb 18 at 15:10
  • \$\begingroup\$ It was not clear from the original question if a GPIO was the source. The only advantage to using it if it doesn't come from a GPS would be if there is already code written to support it. Why change it if it works? \$\endgroup\$ – mkeith Feb 18 at 17:29
  • \$\begingroup\$ Maybe the 1pps signal is also used to keep the system time. For example if this is a surveillance camera system that may be left running with little thought for many months, you don't want the system time to drift. A PPS signal can help keep the time accurate. You haven't actually told us that much about the system. So we are just guessing. Maybe the system is designed to run from an actual GPS PPS signal. \$\endgroup\$ – mkeith Feb 19 at 6:11
  • \$\begingroup\$ The PPS source is gpio, and the system is standalone at the moment (not connected to other servers) \$\endgroup\$ – ransh Feb 19 at 6:24

An observation: Since this is used to timestamp video frames. If we are talking standard video, that's 29.97 frames per second. Other speeds range from 24fps to 60fps. But at 29.97fps, you need a lot of drift before you have a one-frame error. That'a ~33ms/frame. Very few videos are longer than 2 hours, so long-term drift should not be an issue. It doesn't need a 1.0000000 PPS. Even if it is some sort of security video with long-term recording, very little would be lost by even a one-frame error. So I am unclear as to why issues of parts-per-million are even under consideration.


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.