Live data from Hacker News

Time Card and PTP on a Raspberry Pi Compute Module 4

jeffgeerling.com

21–30 of 35 posts

Re: Time Card and PTP on a Raspberry Pi Compute Module 4

#21
post #2

Maybe a stupid question; if you're using GNSS as a time source, is it difficult to get reception? Do you have to put the receiver near a window or something? Or is it able to get signal even in cases where, for instance, my GPS watch would fail to get a lock?

It needs at least the same signal your GPS watch needs. The better signal you can get it, the better time solution it'll get, and the better holdover timing it'll keep. Here's why:

Imprecision in GPS (GNSS in general) solutions comes from a number of sources: Orbital errors in the satellite ephemerides, atmospheric distortions to the signal, multipath at the receiver antenna, and a bunch of minor stuff we're not gonna worry about. Those are the big three.

Orbital errors, you can't do anything about. Post-processing allows _position_ solutions to be corrected once the errors are known (a process that takes hours or days after the fact, to work back where the satellites must've actually been) in a process called Precise Point Solution, but that doesn't apply to [this kind of] timing.

Atmospheric errors you can kindof do something about. Signals from satellites lower to the horizon take a longer path through the atmosphere, so they tend to have wackier pseudoranges. Most timing-grade receivers have a default "elevation mask" of 15 or 20 degrees above the horizon, to simply not even bother with these crap signals, and derive timing only from what's left. (There are of course atmospheric models and corrections to apply, but these are applied to everything. Still, start with a cleaner signal and you'll end up with a cleaner result.) This means you need clear sky view to the middle of the sky, in order to raise the chances of an adequate number of satellites passing the elevation mask.

Multipath is huge. The reason survey-grade antennas have these enormous choke-ring structures around them is to eliminate multipath reflections off the surface of the ground below. Even cheap little antennas try to be more sensitive to signals from above than below, to limited success. (Especially if they're wrist-worn and thus not orientation-controlled. Ugh.) Any situation where the antenna is subject to multipath will have demonstrably worse precision as a result. So, most timing antennae are considerably elevated (gives the reflections an opportunity to fall apart), shielded (choke-ring mounts), or both. Cellular sites usually go with the elevation option since there's already a giant lightning-rod nearby, elevating the GPS antenna doesn't come with additional risk for the receiver.

Worse GPS reception means the receiver has a noisier signal to start with, and can't discipline its local oscillator as tightly. Even if you don't care about nanoseconds in the final application, you probably do care about _holdover performance_. And if your LO can be disciplined with nanosecond-accurate signals in the first place, it'll hold millisecond-accurate timing for days or weeks in a GPS outage. If the disciplining process is crap, the holdover will also be crap.

Re: Time Card and PTP on a Raspberry Pi Compute Module 4

#22

Is anyone using PTP and its requisite accuracy in production? If so, what's your use-case? Our central NTP servers are getting, per "ntpq -c kerninfo", sub-millisecond error: $ ntpq -c kerninfo associd=0 status=0615 leap_none, sync_ntp, 1 event, clock_sync, pll offset: -0.257641 pll frequency: 7.5157 maximum error: 0.165426 estimated error: 0.000422 […] That's talking to a couple of Stratum 1, and a bunch of S2, serv…

The most well known applications include:

* High-speed stock trading, where regulations often require precise timestamping.

* Cell phone networks, where adjacent towers have to hold their frequencies precisely, and synchronise their transmit and receive time windows to avoid interference.

* Certain types of distributed database [1]

At a broader level, guarantees/specifications about NTP accuracy are hard to find. If you google 'NTP accuracy' you'll find a very wide range of claims, from sub-millisecond to >1 second [2]

Indeed, a lot of the NTP userbase has timing requirements so lax they can 'smear' a leapsecond [3] over the course of 24 hours, tolerating a sustained error of hundreds of milliseconds. They've got good reasons for doing it - but it goes to show big errors are possible even under normal, correct operation.

Therefore, if you have an application that needs single-millisecond-level accuracy, you won't find an NTP product specification saying it's what you want.

[1] https://en.wikipedia.org/wiki/Spanner_(database)#Architectur... [2] http://www.ntp.org/ntpfaq/NTP-s-algo.htm#Q-ACCURATE-CLOCK [3] https://developers.google.com/time/smear

Re: Time Card and PTP on a Raspberry Pi Compute Module 4

#23

Is anyone using PTP and its requisite accuracy in production? If so, what's your use-case? Our central NTP servers are getting, per "ntpq -c kerninfo", sub-millisecond error: $ ntpq -c kerninfo associd=0 status=0615 leap_none, sync_ntp, 1 event, clock_sync, pll offset: -0.257641 pll frequency: 7.5157 maximum error: 0.165426 estimated error: 0.000422 […] That's talking to a couple of Stratum 1, and a bunch of S2, serv…

> If so, what's your use-case?

Certain regulations in the financial industry lead you towards using it.

For example, Europe's MiFID II requires some systems to time stamp with 1 µs increments and 100 µs accuracy. PTP is the most common way to sync systems that have this requirement.

Re: Time Card and PTP on a Raspberry Pi Compute Module 4

#24

Is anyone using PTP and its requisite accuracy in production? If so, what's your use-case? Our central NTP servers are getting, per "ntpq -c kerninfo", sub-millisecond error: $ ntpq -c kerninfo associd=0 status=0615 leap_none, sync_ntp, 1 event, clock_sync, pll offset: -0.257641 pll frequency: 7.5157 maximum error: 0.165426 estimated error: 0.000422 […] That's talking to a couple of Stratum 1, and a bunch of S2, serv…

> what's your use-case?

Camera triggering/time stamping of frames that requires sub-millisecond accuracy, between multiple devices.

Re: Time Card and PTP on a Raspberry Pi Compute Module 4

#25

Is anyone using PTP and its requisite accuracy in production? If so, what's your use-case? Our central NTP servers are getting, per "ntpq -c kerninfo", sub-millisecond error: $ ntpq -c kerninfo associd=0 status=0615 leap_none, sync_ntp, 1 event, clock_sync, pll offset: -0.257641 pll frequency: 7.5157 maximum error: 0.165426 estimated error: 0.000422 […] That's talking to a couple of Stratum 1, and a bunch of S2, serv…

>Is anyone using PTP and its requisite accuracy in production? If so, what's your use-case?

I've seen it used in projects for frame-accurate timing for IP video production (the use case was more TV studios than, say, Twitch streams)

Re: Time Card and PTP on a Raspberry Pi Compute Module 4

#26
post #2

Maybe a stupid question; if you're using GNSS as a time source, is it difficult to get reception? Do you have to put the receiver near a window or something? Or is it able to get signal even in cases where, for instance, my GPS watch would fail to get a lock?

It needs at least the same signal your GPS watch needs. The better signal you can get it, the better time solution it'll get, and the better holdover timing it'll keep. Here's why: Imprecision in GPS (GNSS in general) solutions comes from a number of sources: Orbital errors in the satellite ephemerides, atmospheric distortions to the signal, multipath at the receiver antenna, and a bunch of minor stuff we're not gonn…

Doubtful of the last paragraph: What kind of clock oscillator 'learns' to keep better time by being adjusted from a better source? A normal crystal doesn't have any memory effect AFAIK.

In a typical real life scenario where the GPS / antenna malfunctions, your server clock will just slowly.. drift.. I.e. the crystal runs a bit too fast or a bit too slow.

Re: Time Card and PTP on a Raspberry Pi Compute Module 4

#27

Is anyone using PTP and its requisite accuracy in production? If so, what's your use-case? Our central NTP servers are getting, per "ntpq -c kerninfo", sub-millisecond error: $ ntpq -c kerninfo associd=0 status=0615 leap_none, sync_ntp, 1 event, clock_sync, pll offset: -0.257641 pll frequency: 7.5157 maximum error: 0.165426 estimated error: 0.000422 […] That's talking to a couple of Stratum 1, and a bunch of S2, serv…

> If so, what's y̶o̶u̶r̶ a use-case?

CERN uses PTP on steroids for physics experiments: https://white-rabbit.web.cern.ch/

Re: Time Card and PTP on a Raspberry Pi Compute Module 4

#28

Is anyone using PTP and its requisite accuracy in production? If so, what's your use-case? Our central NTP servers are getting, per "ntpq -c kerninfo", sub-millisecond error: $ ntpq -c kerninfo associd=0 status=0615 leap_none, sync_ntp, 1 event, clock_sync, pll offset: -0.257641 pll frequency: 7.5157 maximum error: 0.165426 estimated error: 0.000422 […] That's talking to a couple of Stratum 1, and a bunch of S2, serv…

Any organization that requires nanosecond precision uses PTP. In my experience this usually includes financial exchanges that want to measure latency in trade routing.

Every telecom too. LTE and 5G requires PTP in general.

Re: Time Card and PTP on a Raspberry Pi Compute Module 4

#29
post #2

Maybe a stupid question; if you're using GNSS as a time source, is it difficult to get reception? Do you have to put the receiver near a window or something? Or is it able to get signal even in cases where, for instance, my GPS watch would fail to get a lock?

> is it difficult to get reception? Do you have to put the receiver near a window or something? The answer to that is "it depends". Windows are known to work, but not all windows are made equal. Which direction your window is facing and whether you are in an urban canyon can make significant difference. Some windows also have films or coatings. If you are working in tricky situations, then the quality of your antenna…

Or you could just have your own atomic clock. It is not uncommon, and not complicated as you might think[1].

Other methods for obtaining times are:

- GPS: Satellite receiver for the Global Positioning System

- GNS: Combined GPS/GLONASS/Galileo/BeiDou satellite receiver (L1 frequency band), can also be used for mobile applications

- GNS-UC: GPS and Galileo Satellite Receiver with Up Converter for Meinberg GPS Antenna/Converter

- PZF: DCF77 correlation receiver for middle europe

- MSF: Long wave receiver for Great Britain

- WWVB: Long wave receiver for the US time signal

- TCR: Time code receiver for IRIG A/B, AFNOR or IEEE1344 codes

- MRS: (GPS, PPS, 10MHz, NTP): Multi Reference Source - several reference source

[1]: https://www.muquans.com/

Re: Time Card and PTP on a Raspberry Pi Compute Module 4

#30

Is anyone using PTP and its requisite accuracy in production? If so, what's your use-case? Our central NTP servers are getting, per "ntpq -c kerninfo", sub-millisecond error: $ ntpq -c kerninfo associd=0 status=0615 leap_none, sync_ntp, 1 event, clock_sync, pll offset: -0.257641 pll frequency: 7.5157 maximum error: 0.165426 estimated error: 0.000422 […] That's talking to a couple of Stratum 1, and a bunch of S2, serv…

PTP is a great choice when you need your time-sync to leave the software domain, for instance, locking an external PLL for frequency and phase aligned clocks.

PTP enabled MAC's and PHY's usually have a dedicated hardware output for a PPS (pulse-per-second) or faster clock, generated directly from the hardware PTP counters.

In the video world, we get great results synchronizing software events with NTP, but whenever you jump to a physical interface (DisplayPort, HDMI, SDI, etc.), NTP-based clocks are far too jittery.

I've seen some work using the PTP hardware in the MAC with the NTP protocol, a sort of hybrid approach, but don't have any first hand experience.

Post reply on HN