[time-nuts] Re: Network interface cards that support timestamping

John Miller john at millerjs.org
Tue Feb 14 00:50:16 UTC 2023


Hi Jürgen,
Finally getting around to sinking my teeth into doing i210 PPS stuff, so I am finally revisiting this. So, first off - thank you for the very informative post - lots of good information in here. I am very interested in seeing your design data for a mini PCIe board with pogo pins for the SDP interface, thank you for offering. I have an apu2e0 on order, and I plan to put a mini PCIe GNSS receiver in it - of course, the options for miniPCIe GNSS receivers are pretty bad, so I've designed my own and should get them in two weeks or so, but I am very interested in coupling one with your design for a very tidy solution that doesn't require soldering.

Compiling testptp with a static library worked, of course, and I'm a little bit disappointed in myself for not thinking of this - I'm pretty rusty at this, go figure. In any case, it seems to be working fine - most of the time. I can use it to list capabilities, list pin configuration, and set/get PTP time, no problem, and I can see that SDP0 is configured for "external time stamp". Sometimes when I try and run it to view timestamp events (e.g. ./testptp -e 10) I get a cryptic "device in use" type error but I'm not quite sure what is hanging it up.

In the following command:
> ts2phc -c eth3 -s generic -l 7 -f /etc/linuxptp/ts2phc.conf -m -q
i assume the contents of ts2phc.conf are the "[global] ... " that you posted below it, is that correct?

Thanks very much for all your info, this is very exciting!

Regards,
John


> On Feb 2, 2023, at 1:32 PM, Jürgen Appel via time-nuts <time-nuts at lists.febo.com> wrote:
> 
> Dear John,
> 
> On Wednesday, 1 February 2023 19:38:18 CET John Miller via time-nuts wrote:
> 
>> Hi Matt,
>> This is excellent information, thank you - after reading through all the
>> responses in the thread (wow, this is a wild topic!) and trawling around
>> online a bit, I think that using the SDP pins on the i210 to feed a PPS
>> signal into an x86 PC is what I want to do right now. 
> 
>> I have read Dan Drown's blog post on using the APU2 to achieve this, and
>> while it's more or less exactly what I want to replicate, for now, there
>> are a few gaps I need to fill in - and you may be able to help me do so. I
>> don't have a PC Engines APU2 board yet, but I suspect I'll order one once I
>> have the software side of things ironed out, because I really like their
>> form factor.
> 
> I'm currently testing an APU6b4 unit and made a small adaptor PCB that gets 
> clicked into the Mini-PCIE slot and touches to the main pcb via some pogo-pins:
> No soldering on the main apu board. If you are interested, I can send you 
> the gerber-files and BOM. It should also fit the apu3-series (and possibly
> yours, too) and allows convenient SMA-access through the front panel to
> the SDP pins of two of the NICs.
> 
>> What I'm using right now is a Portwell NANO-6050[1], and it has i210 and
>> i218 NICs. The SDP pins on the i210 aren't broken out into nice pads like
>> the APU2 has, but with some magnet wire and a steady hand I was able to
>> connect directly to one of the pins. Where I am struggling right now is
>> ironing out the software configuration side of things. I'm not interested
>> at all in PTP yet, right now the focus is purely on feeding the PPS into
>> chrony via the SDP pins. 
> 
>> The GNSS I'm using is a Sparkfun uBlox NEO-M9N
>> GNSS receiver in its default configuration, connected to the computer over
>> USB. PPS pin connected to the i210's SDP0. PPS pulse is 3v3 for 100ms.
> That should work fine.
> 
>> I have tried using refclock strings from chrony's examples page[2] as a
>> jumping-off point, but it doesn't make much sense to me.
> 
> To me it seems that chrony is just using the timestamps on the PHC of that
> network interface and not actually locking the PHC to the PPS input. As I
> wanted to verify that the lock is working, and maybe later use the PHC also
> for PTP, I also wanted the PHC to follow the external time, and running 
> both chrony and phc2sys to make the phc follow system time ended in chaos.
> 
> Therefore it seems that a two-step approach works better: First I make sure
> that using ts2phc the PHC is locked to the 100ms-1PPS input on SDP0:
> 
> # ----------[contents of /etc/linuxptp/ts2phc.conf]-------------------------
> # run with ts2phc -c eth3 -s generic -l 7 -f /etc/linuxptp/ts2phc.conf -m -q
> [global]
> use_syslog              0
> verbose                 1
> logging_level           6
> ts2phc.pulsewidth       100000000
> max_frequency           1000000
> step_threshold          0.05
> [eth3]
> ts2phc.channel          0
> ts2phc.extts_polarity   both
> ts2phc.pin_index        0
> ts2phc.extts_correction -32
> 
> For this to start up properly, you need to make sure the clocks are roughly correct,
> i.e. you need to set your system time (e.g. with ntpdate, ntp, chrony) and then
> sync your PHC to system time by letting 
> 
> # Locking the PHC of eth3 (ptp3) to CLOCK_REALTIME
> phc2sys -c eth3 -s CLOCK_REALTIME -O +37 -m -q  
> 
> run for a few seconds. 
> 
> If you also output the PHC timer on SDP1 by
> testptp -d /dev/ptp3 -L1,2 -p 1000000000
> you can see a falling edge right when SDP0 has a rising edge input 
> with only a few nanoseconds jitter.
> (if anyone know how to invert the 1PPS output on i211 interfaces, let me know...)
> Sidenote: The interfaces /sys/class/ptp/* seem to be broken with my kernel. 
> I can configure PPS output there, but every time I do that I get random 
> frequencies for ~10 seconds before the output actually starts...
> 
> 
> When the PCH is locked to the 1PPS, I can have chrony use the PHC as clock input
> with this chrony.conf line:
> 
> refclock PHC /dev/ptp3 tai refid PTP3 dpoll -4 poll -2
> 
> I do _not_ use the "extpps" option here, as ts2phc is already reading and consuming
> the time stamps. If there are two time-stamp readers, my chrony just hangs.
> 
>> I have not been able to use the testptp tool on this system yet - building
>> it on another machine and running the copied-over executable fails, citing
>> too old a version of glibc, and when I try and build it locally it fails
>> for reasons that are unknown to me (I am very much not a C developer). 
> 
> Maybe try making a static library: gcc -static testptp.c -o testptp
> so that it has it's current glibc version linked in.
> 
>> I am going to continue to fiddle with this - I think getting testptp working
>> such that I can verify that I'm actually getting a pulse on SDP0 is the
>> most important thing to confirm right now.
> 
> The intel cards always give timestamp events on both pulse edges. The pulse-width and 
> the roughly correct clock are necessary such that ts2phc can ignore the wrong pulse edge. 
> From the source code it seems that ts2phc only considers edges falling within ±pulsewidth/2
> around the expected time valid and discards the rest. So for a 100ms-1PPS pulse you should
> get the clock precise to 50ms before you start. As my pps is originally only µs long, I needed extra
> hardware to stretch it. 
> 
> The result:
> 
> watch -n 0.5 'chronyc -m "sources -v" "sourcestats -v"  "selectdata -v"'
> 
>  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
> / .- Source state '*' = current best, '+' = combined, '-' = not combined,
> | /             'x' = may be in error, '~' = too variable, '?' = unusable.
> ||                                                 .- xxxx [ yyyy ] +/- zzzz
> ||      Reachability register (octal) -.           |  xxxx = adjusted offset,
> ||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
> ||                                \     |          |  zzzz = estimated error.
> ||                                 |    |           \
> MS Name/IP address         Stratum Poll Reach LastRx Last sample               
> ===============================================================================
> #* PTP3                          0  -2   377     0     +2ns[   +2ns] +/-  195ns
> ^- sth1-ts.nts.netnod.se <http://sth1-ts.nts.netnod.se/>         1   8   377    83   -449us[ -450us] +/- 5331us
> ^- sth2-ts.nts.netnod.se <http://sth2-ts.nts.netnod.se/>         1   8   377   213   -461us[ -463us] +/- 5322us
> ^? ptbtime1.ptb.de <http://ptbtime1.ptb.de/>               1   8   377    21    -46us[  -46us] +/- 5489us
> ^? ptbtime2.ptb.de <http://ptbtime2.ptb.de/>               1   7   377    19    -60us[  -60us] +/- 5505us
> ^- polarx5tr.time.internal       1   8   377   147    -41us[  -43us] +/-   12ms
>                             .- Number of sample points in measurement set.
>                            /    .- Number of residual runs with same sign.
>                           |    /    .- Length of measurement set (time).
>                           |   |    /      .- Est. clock freq error (ppm).
>                           |   |   |      /           .- Est. error in freq.
>                           |   |   |     |           /         .- Est. offset.
>                           |   |   |     |          |          |   On the -.
>                           |   |   |     |          |          |   samples. \
>                           |   |   |     |          |          |             |
> Name/IP Address            NP  NR  Span  Frequency  Freq Skew  Offset  Std Dev
> ==============================================================================
> PTP3                        9   7     2     +0.000      0.005     +0ns     2ns
> sth1-ts.nts.netnod.se <http://sth1-ts.nts.netnod.se/>      25  11   31m     +0.060      0.044   -483us    28us
> sth2-ts.nts.netnod.se <http://sth2-ts.nts.netnod.se/>      22  10   29m     +0.097      0.031   -419us    16us
> ptbtime1.ptb.de <http://ptbtime1.ptb.de/>            25  12   32m     +0.071      0.031    -43us    23us
> ptbtime2.ptb.de <http://ptbtime2.ptb.de/>            21   5   23m     +0.097      0.053  -5339ns    26us
> polarx5tr.time.internal    25  14   30m     +0.038      0.153    -41us   104us
>  .-- State: N - noselect, M - missing samples, d/D - large distance,
> /           ~ - jittery, w/W - waits for others, T - not trusted,
> |            x - falseticker, P - not preferred, U - waits for update,
> |            S - stale, O - orphan, + - combined, * - best.
> |        Effective options ------.  (N - noselect, P - prefer
> |       Configured options -.     \  T - trust, R - require)
> |   Auth. enabled (Y/N) -.   \     \     Offset interval --.
> |                        |    |     |                       |
> S Name/IP Address        Auth COpts EOpts Last Score     Interval  Leap
> =======================================================================
> * PTP3                      N ----- --TR-    0   1.0  -194ns  +199ns  N
> D sth1-ts.nts.netnod.se <http://sth1-ts.nts.netnod.se/>     Y ----- --TR-   83   1.0 -5780us +4891us  N
> D sth2-ts.nts.netnod.se <http://sth2-ts.nts.netnod.se/>     Y ----- --TR-  213   1.0 -5769us +4888us  N
> T ptbtime1.ptb.de <http://ptbtime1.ptb.de/>           N ----- -----   20   1.0 -5515us +5458us  N
> T ptbtime2.ptb.de <http://ptbtime2.ptb.de/>           N ----- -----   19   1.0 -5564us +5448us  N
> D polarx5tr.time.internal   N --TR- --TR-  147   1.0   -12ms   +11ms  N
> 
> 
> Cheers,
> 	Jürgen
> _______________________________________________
> time-nuts mailing list -- time-nuts at lists.febo.com <mailto:time-nuts at lists.febo.com>
> To unsubscribe send an email to time-nuts-leave at lists.febo.com <mailto:time-nuts-leave at lists.febo.com>




More information about the Time-nuts_lists.febo.com mailing list