Both sides previous revisionPrevious revisionNext revision | Previous revision |
pps2sdp [2023/03/02 00:13] – [phc2sys] millerjs | pps2sdp [2024/11/14 02:30] (current) – external edit 127.0.0.1 |
---|
| |
====== PPS to SDP ====== | ====== PPS to SDP ====== |
There are a few effective ways to feed a PPS signal from a GNSS receiver (or other time source) into a computer. A few examples: on a system with a "standard" serial port, the DCD pin can be used very effectively, on many single board computers (e.g. Raspberry Pi et al) a GPIO pin can be used for PPS input. Purpose built hardware exists as well, network cards like the Solarflare SFN6322F have SMA connectors specifically for PPS in and out. In today's case, we're going to be looking at the Intel i210 ethernet controller. A humble PCIe gigabit network interface that just happens to have four software defined pins (thus, SDP) that can be used for hardware timestamping via IEEE1588 and IEEE 802.1AS. | There are a few effective ways to feed a PPS((pulse per second)) signal from a GNSS receiver, or other precision pulse source, into a computer. A few examples: systems with a "standard" serial port can use the DCD pin, and on many single board computers (Raspberry Pi et al) a GPIO pin can sometimes be used for PPS input. Purpose built hardware exists as well, network cards like the Solarflare SFN6322F have SMA connectors specifically for PPS in and out. In this article, we're going to be looking at the Intel i210 ethernet controller. A humble PCIe gigabit network interface from 2012 that was designed with four software defined pins (SDPs) that can be used for hardware timestamping via IEEE1588 and IEEE 802.1AS. |
| |
{{::i210-sdp-pins.png?259 |}}The i210 and its software defined pins are well supported by the LinuxPTP project, and a number of folks have already put together some documentation on using its SDPs as a way to get hardware timestamps from a GNSS receiver into software like chrony or NTPsec. | {{::i210-sdp-pins.png?259 |}}The i210 and its software defined pins are well supported by the LinuxPTP project, and a number of folks have already put together some documentation on using its SDPs as a way to get hardware timestamps from a GNSS receiver into software like chrony or NTPsec. |
* [[https://chrony.tuxfamily.org/examples.html#_server_using_reference_clock_on_nic|Chrony documentation - Server using reference clock on NIC]] | * [[https://chrony.tuxfamily.org/examples.html#_server_using_reference_clock_on_nic|Chrony documentation - Server using reference clock on NIC]] |
* [[https://docs.nvidia.com/networking/display/NVIDIA5TTechnologyUserManualv10/5T+Technology+(PTP,+SyncE,+and+more)+User+Manual|nvidia 5T user manual]] | * [[https://docs.nvidia.com/networking/display/NVIDIA5TTechnologyUserManualv10/5T+Technology+(PTP,+SyncE,+and+more)+User+Manual|nvidia 5T user manual]] |
| * [[https://febo.com/pipermail/time-nuts_lists.febo.com/2023-February/107321.html|This thread from the TimeNuts mailing list]] |
| * [[https://wiki.gentoo.org/wiki/Chrony_with_hardware_timestamping|This gentoo wiki page has some good stuff]] |
| |
===== Software ===== | ===== Software ===== |
event index 0 at 1677526115.935919744 | event index 0 at 1677526115.935919744 |
</code> | </code> |
| You may notice that there are only 5 seconds represented here - that's because in each timepulse there are two events, one for the rising edge, and then another for the falling edge, 100ms later. The i210 only reports both edges. |
==== ts2phc ==== | ==== ts2phc ==== |
Part of the [[https://linuxptp.nwtime.org/about/|LinuxPTP]] project, [[https://linuxptp.nwtime.org/documentation/ts2phc/|ts2phc]] is a tool that synchronizes time stamps coming over the SDP with the PHC. The following command can be used to sync the incoming timestamps with the PHC. The system clock must be roughly correct for this to work correctly. | Part of the [[https://linuxptp.nwtime.org/about/|LinuxPTP]] project, [[https://linuxptp.nwtime.org/documentation/ts2phc/|ts2phc]] is a tool that synchronizes time stamps coming over the SDP with the PHC. The following command can be used to sync the incoming timestamps with the PHC. The system clock must be roughly correct for this to work correctly. |
max_frequency 1000000 | max_frequency 1000000 |
step_threshold 0.05 | step_threshold 0.05 |
| leapfile /usr/share/zoneinfo/leap-seconds.list |
[/dev/ptp0] | [/dev/ptp0] |
ts2phc.channel 0 | ts2phc.channel 0 |
ts2phc[2226.309]: /dev/ptp0 offset 1804 s2 freq -8469 | ts2phc[2226.309]: /dev/ptp0 offset 1804 s2 freq -8469 |
</code> | </code> |
| (Note: in this instance, I've used ''-l 7'' for more verbose logging, which can be beneficial for diagnostic purposes.) |
==== phc2sys ==== | ==== phc2sys ==== |
Also a part of LinuxPTP, [[https://linuxptp.nwtime.org/documentation/phc2sys/|phc2sys]] is a utility included as part of the linuxptp project for syncing clocks - usually syncing PHC to SYS. This tool is run after ''ts2phc'' to align the PHC with the system clock. | Also a part of LinuxPTP, [[https://linuxptp.nwtime.org/documentation/phc2sys/|phc2sys]] is a utility included as part of the linuxptp project for syncing clocks - usually syncing PHC to SYS. This tool is run after ''ts2phc'' to align the PHC with the system clock. |