Time sensitive networking [TSN] on NX

after awhile

Every 5.0s: (ntpq -p ; echo "" ; ntptime ; echo "" ; sudo phc_ctl eth0 get cmp)                                                                                        comp@comp: Thu Jul  2 16:05:28 2020

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 0.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 1.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 2.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 3.ubuntu.pool.n .POOL.          16 p    -   64    0    0.000    0.000   0.000
 ntp.ubuntu.com  .POOL.          16 p    -   64    0    0.000    0.000   0.000
xGPS_NMEA(0)     .GPS0.           1 l    -    8  377    0.000  -365.77   1.833
 SHM(0)          .NMEA.           0 l    -   16    0    0.000    0.000   0.000
 SHM(1)          .PPS.            0 l    -   16    0    0.000    0.000   0.000
+ntp5.doctor.com 50.205.244.27    2 u  155  512  377   28.423   -0.586   0.134
+time.cloudflare 10.106.8.5       3 u   99  512  377    3.015   -0.911   0.155
*time1-inapsales 66.79.142.245    2 u   45  512  377   77.646   -1.149   0.315
+chilipepper.can 145.238.203.14   2 u  286  512  377   75.968   -0.716   0.120

ntp_gettime() returns code 0 (OK)
  time e2a8bc88.e7f90d9c  Thu, Jul  2 2020 16:05:28.906, (.906144655),
  maximum error 95583 us, estimated error 291 us, TAI offset 37
ntp_adjtime() returns code 0 (OK)
  modes 0x0 (),
  offset -780.623 us, frequency 1.379 ppm, interval 1 s,
  maximum error 95583 us, estimated error 291 us,
  status 0x2001 (PLL,NANO),
  time constant 9, precision 0.001 us, tolerance 500 ppm,

phc_ctl[10755.502]: clock time is 1593720365.920004661 or Thu Jul  2 16:06:05 2020

phc_ctl[10755.503]: offset from CLOCK_REALTIME is -37000000312ns

from thte client

linuxptp# ptp4l -i eth0 -p /dev/ptp0 -s -m
ptp4l[17298.557]: selected /dev/ptp0 as PTP clock
ptp4l[17298.559]: port 1: INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[17298.559]: port 0: INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[17298.707]: port 1: pdelay_req on E2E port
ptp4l[17299.036]: port 1: new foreign master 48b02d.fffe.05a771-1
ptp4l[17299.707]: port 1: pdelay_req on E2E port
ptp4l[17300.707]: port 1: pdelay_req on E2E port
ptp4l[17301.707]: port 1: pdelay_req on E2E port
ptp4l[17302.707]: port 1: pdelay_req on E2E port
ptp4l[17303.037]: selected best master clock 48b02d.fffe.05a771
ptp4l[17303.037]: port 1: LISTENING to UNCALIBRATED on RS_SLAVE
ptp4l[17303.707]: port 1: pdelay_req on E2E port
ptp4l[17304.707]: port 1: pdelay_req on E2E port
ptp4l[17305.133]: master offset -76548177455614433 s0 freq      +0 path delay      3820
ptp4l[17305.707]: port 1: pdelay_req on E2E port
ptp4l[17306.134]: master offset -76548177455615561 s1 freq   -1128 path delay      3820
ptp4l[17306.707]: port 1: pdelay_req on E2E port
ptp4l[17307.134]: master offset          8 s2 freq   -1120 path delay      3820
ptp4l[17307.134]: port 1: UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED
ptp4l[17307.707]: port 1: pdelay_req on E2E port
ptp4l[17308.134]: master offset        190 s2 freq    -935 path delay      3614
ptp4l[17308.707]: port 1: pdelay_req on E2E port
ptp4l[17309.134]: master offset        284 s2 freq    -784 path delay      3416
ptp4l[17309.707]: port 1: pdelay_req on E2E port
cntrl+c

date
Sun Jan 28 15:47:54 EST 2018

sigh

phc_ctl /dev/ptp0 get
phc_ctl[17818.920]: clock time is 1593721090.297988637 or Thu Jul 2 16:18:10 2020

 phc2sys -s eth0 -c CLOCK_REALTIME  -w -m
phc2sys[17942.189]: CLOCK_REALTIME phc offset -76548140341196013 s0 freq      +0 delay   3168
phc2sys[17943.190]: CLOCK_REALTIME phc offset -76548140338905069 s1 freq +2289897 delay   3136
phc2sys[17944.191]: CLOCK_REALTIME phc offset    550830 s2 freq +2840727 delay   3161
phc2sys[17945.191]: CLOCK_REALTIME phc offset    310205 s2 freq +2765351 delay   3191
phc2sys[17946.191]: CLOCK_REALTIME phc offset   -399891 s2 freq +2148316 delay   3159

date
Thu Jul 2 16:21:02 EDT 2020

That looks mostly correct.

Is the next post from the client?

exactly!
Thank you for getting me through the configuration

on client with eth0 &openvpn tun0;
one ptp4l synchronizes eth0 with server.

ptp4l[899465.839]: master offset       -177 s2 freq    +998 path delay      3674
ptp4l[899466.939]: master offset       -241 s2 freq    +880 path delay      3674
ptp4l[899468.039]: master offset        -81 s2 freq    +968 path delay      3674
ptp4l[899469.139]: master offset       -354 s2 freq    +671 path delay      3903
ptp4l[899470.239]: master offset      -1065 s2 freq    -146 path delay      3903

on the tun0 interface I run:

ptp4l -i tun0 -m -S
ptp4l[899349.695]: port 1: INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[899349.695]: port 0: INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[899356.936]: port 1: LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
ptp4l[899356.936]: selected local clock 000000.fffe.000000 as best master
ptp4l[899356.936]: port 1: assuming the grand master role

on a remote(local) computer connected through the internet [openvpn] I also run:

sudo ptp4l -i tun0  -m -s -S
ptp4l[51276.940]: port 1: INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[51276.940]: port 0: INITIALIZING to LISTENING on INIT_COMPLETE
ptp4l[51283.543]: selected local clock 000000.fffe.000000 as best master
ptp4l[51289.885]: selected local clock 000000.fffe.000000 as best master
ptp4l[51297.223]: selected local clock 000000.fffe.000000 as best master
ptp4l[51303.369]: selected local clock 000000.fffe.000000 as best master

it won’t work over the internet[vpn] with software synchronization? ntp should be used instead? or still could work? with adjusted parameters?

It turned out that ntpd is depreciated in ubuntu 18.04;
the default tool that needs to be disabled is timesyncd

sudo timedatectl set-ntp no

enabling ntp autostart

systemctl enable ntp

enabling ptp autostart [server side] where pps gps &ntp server are presented

sudo su
 cat <<EOT >>  /lib/systemd/system/ptp4l.service
[Unit]
Description=linuxptp server side autostart
[Service]
ExecStart=/usr/sbin/ptp4l -i eth0 -m -H
[Install]
WantedBy=multi-user.target
EOT
systemctl ptp4l enable

adding phc2sys autostart

cat <<EOT >>  /lib/systemd/system/phc2sys.service
[Unit]
Description= phc2sys synchronization autostart
[Service]
ExecStart=/usr/local/sbin/phc2sys -m -s CLOCK_REALTIME -c eth0 -w
[Install]
WantedBy=multi-user.target
EOT
systemctl enable phc2sys

for auto-boot baudrate set
/etc/udev/rules.d/99-gps…

KERNEL=="ttyTHS0", SYMLINK+="gps0" , RUN+="/bin/stty -F /dev/ttyTHS0 38400"
KERNEL=="pps0", MODE="0660", SYMLINK+="gpspps0",TAG="systemd"

the udev method did not work for setting the baudrate on system boot; another way is to get it done through
sudo su
 echo "stty -F /dev/ttyTHS0 38400" >> /etc/rc.local
the abovi neither worked though .
sudo su
 cat <<EOT >>  /lib/systemd/system/stty.service
[Unit]
Description=stty baudrate autostart
[Service]
ExecStart=/bin/stty -F -f /dev/ttyTHS0 38400
[Install]
WantedBy=multi-user.target
EOT
 systemctl enable stty

by some reason the method above also fails autostaring; it works with manually startig the service

systemctl start stty
cat /etc/rc.local 
( /bin/stty -F /dev/ttyTHS0 38400 )&

exit 0

the above neither seem to work also; therefore I had to install

sudo apt install setserial
sudo setserial /dev/ttyTHS0 baud_base 38400
^^this baudrate also doesn't seem to work 

which of the services above do the routine of synchronizing system_clocks to /dev/rtc? is it something done by ntp? by linuxptp? both? neither of the two? does it require a separate process ?
is the default stock kernel compilled " compiled with the ‘11 minute mode’ option ? Ubuntu Manpage: hwclock - read or set the hardware clock (RTC)

I don’t think that ptp was ever designed to run over VPNs. At least layer 3 VPNs.

You don’t have to set the baudrate manually. If you have the correct “mode” parameter set on the ntp.conf “server” line then ntpd will do it for you. For 38400, it has to be 48.

In Ubuntu, I’m not sure what sets the hardware clock. RedHat based systems (which I’m most familiar with) run ntpdate on startup which updates the initial system time and hardware clock from a remote server. ntpd is started after that.

1 Like

shortened ntp.conf

restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited
restrict 127.0.0.1
restrict ::1
restrict source notrap nomodify noquery
driftfile /var/lib/ntp/ntp.drift
leapfile /usr/share/zoneinfo/leap-seconds.list
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

server 127.127.20.0 mode 48 baud 38400 minpoll 3 burst iburst prefer
fudge 127.127.20.0 stratum 1 flag1 1 flag2 0 flag3 1 flag4 0 time1 0.0 time2 0.095 refid GPS0

executing of sudo cat /dev/ttyTHS0 will show raw outputs, not ASCII, so I assume mode 48 added to the ntpconf did not work in my case.
To me it seesm that the mode 48 might instruct the ntp to read from the port with such rate. However, the port needs ty be set to the rate e.g. with stty ion order for ntp to start working. then it also takes to restart the ntp service .

regarding the client side;
is running
ptp4l -i eth0 -p /dev/ptp0 -s -m
redundant for Linux? or phc2sys will also be required?
Moreover, what is a convinient way to add Windows clients? Linux wifi devices?
Thanks @gtj

Oops, just saw this, sorry. If you want to use hardware timestamping on the client for the best accuracy, then you need to run ptp4l (which will run in slave mode) to capture the packets and set the phc, then use phc2sys to set the system clock from the phc. I have no experience with ptp on Windows. Do they need the accuracy of ptp or can they get away with just using ntp? For the linux wifi clients, you can’t use hardware timestamping unless the wifi nic has a phc. If not, then you’d have to fall back to software timestamping (no need for phc2sys) or stick with ntp.

Thank you for following up!
The idea is to run whatever possible timeserver with gps pps inputs on nx; Then get linux ptp wired clients, windows ptp wired clients, maybe also some wifi ntp windows and wifi linux clients.
Windows clients seem to work PTP, but with ptpd, provided a supplied configuration is used: https://github.com/microsoft/W32Time/blob/master/Precision%20Time%20Protocol/PTPd%20Configuration%20Examples/master_e2e_sock_modifed_no_clock_discipline_unicast_configuration.txt
ref: Windows Time service tools and settings | Microsoft Learn

but yet it would need to have some parameters of the ptp4l changed to allign with the client parameters; that might include intervasl// latency parameters.

It seems it could be sorted somehow like that
pmc -u -b 0
"set GRANDMASTER_SETTINGS_NP
clockClass 248
clockAccuracy 0xfe
offsetScaledLogVariance 0xffff
currentUtcOffset 37
leap61 0
leap59 0
currentUtcOffsetValid 1
ptpTimescale 1
timeTraceable 1
frequencyTraceable 1
timeSource 0x50
"
it will set part of parameters so that they will complain with Windows Client but not all.
However, yes, the idea is to use whatever seems workinng on the client side.
E.g. on AGX wired to the server via the switch I would run a service that autostarts with:

 cat /lib/systemd/system/ptp4l.service
[Unit]
Description=linuxptp server side autostart
[Service]
ExecStart=/usr/local/sbin/ptp4l -i eth0 -p /dev/ptp0 -s -m
[Install]
WantedBy=multi-user.target
● ptp4l.service - linuxptp server side autostart
   Loaded: loaded (/lib/systemd/system/ptp4l.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2020-08-21 09:21:48 EDT; 3 days ago
 Main PID: 9081 (ptp4l)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/ptp4l.service
           └─9081 /usr/local/sbin/ptp4l -i eth0 -p /dev/ptp0 -s -m

Aug 24 19:00:58 jetson-0423318029577 ptp4l[9081]: ptp4l[294043.523]: port 1: UNCALIBRATED to LISTENING on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
Aug 24 19:00:58 jetson-0423318029577 ptp4l[9081]: ptp4l[294043.523]: selected local clock 00044b.fffe.cb9a37 as best master
Aug 24 19:00:58 jetson-0423318029577 ptp4l[9081]: [294043.523] port 1: UNCALIBRATED to LISTENING on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
Aug 24 19:00:58 jetson-0423318029577 ptp4l[9081]: [294043.523] selected local clock 00044b.fffe.cb9a37 as best master
Aug 24 19:01:01 jetson-0423318029577 ptp4l[9081]: ptp4l[294046.348]: selected best master clock 00044b.fffe.cbb2a3
Aug 24 19:01:01 jetson-0423318029577 ptp4l[9081]: ptp4l[294046.348]: port 1: LISTENING to UNCALIBRATED on RS_SLAVE
Aug 24 19:01:01 jetson-0423318029577 ptp4l[9081]: [294046.348] selected best master clock 00044b.fffe.cbb2a3
Aug 24 19:01:01 jetson-0423318029577 ptp4l[9081]: [294046.348] port 1: LISTENING to UNCALIBRATED on RS_SLAVE
Aug 24 19:01:01 jetson-0423318029577 ptp4l[9081]: ptp4l[294047.228]: selected best master clock 00044b.fffe.cbb2a3
Aug 24 19:01:01 jetson-0423318029577 ptp4l[9081]: [294047.228] selected best master clock 00044b.fffe.cbb2a3

it seems to listen to the grandmaster clock, but it appears that I also shall create phc2sys service at the client?
Which would be the phc2sys line? will it be the same as it is used at the server grand master device: listed below?

 cat /lib/systemd/system/phc2sys.service
[Unit]
Description= phc2sys synchronization autostart
[Service]
ExecStart=/usr/local/sbin/phc2sys -m -s CLOCK_REALTIME -c eth0 -w
[Install]
WantedBy=multi-user.target

On the master/server side, you want phc2sys to actually set the phc from the system time (which was set by ntpd and the gps). That’s why you use -s CLOCK_REALTIME on that command line. On the client devices, you want the reverse. You want phc2sys to set the system time from the phc. In this case, you want -a -r as the options instead of -s CLOCK_REALTIME. This tells phc2sys to get the available phc from ptp4l (-a) and to synchronize the system clock to it (-r). So the full command line for a client would be…

/usr/local/sbin/phc2sys -m -a -r -w
 systemctl enable phc2sys
Created symlink /etc/systemd/system/multi-user.target.wants/phc2sys.service → /lib/systemd/system/phc2sys.service.
systemctl start phc2sys

so it will be like the above probably, still with -c eth0 probably? or without it?

Maybe you have any suggestion how to set the baudrate on server side to change on restart? So far multiple trials to use system.d/ rc.local etc failed to set the baudrate; so all services at server side need manual start; while at clients ptp4l & phc2sys can be implemented using the script aboove, as it seems to me

I also noticed thhat watch ntp at server shows phc/ ntp time precisely until I run the phc2sys after that it becomes to have differntce almost 1 second in the watch ntp interface between these two

After rebooting of Jetson AGX client I noticed:

 systemctl status ptp4l
● ptp4l.service - linuxptp server side autostart
   Loaded: loaded (/lib/systemd/system/ptp4l.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2020-08-25 13:21:12 EDT; 21s ago
  Process: 4931 ExecStart=/usr/local/sbin/ptp4l -i eth0 -p /dev/ptp0 -s -m (code=exited, status=255)
 Main PID: 4931 (code=exited, status=255)

Aug 25 13:21:12 jetson-0423318029577 ptp4l[4931]: [6.325] selected /dev/ptp0 as PTP clock
Aug 25 13:21:12 jetson-0423318029577 ptp4l[4931]: [6.325] Failed to open /dev/ptp0: No such file or directory
Aug 25 13:21:12 jetson-0423318029577 systemd[1]: Started linuxptp server side autostart.
Aug 25 13:21:12 jetson-0423318029577 ptp4l[4931]: ptp4l[6.325]: selected /dev/ptp0 as PTP clock
Aug 25 13:21:12 jetson-0423318029577 ptp4l[4931]: ptp4l[6.325]: Failed to open /dev/ptp0: No such file or directory
Aug 25 13:21:12 jetson-0423318029577 ptp4l[4931]: failed to create a clock
Aug 25 13:21:12 jetson-0423318029577 systemd[1]: ptp4l.service: Main process exited, code=exited, status=255/n/a
Aug 25 13:21:12 jetson-0423318029577 systemd[1]: ptp4l.service: Failed with result 'exit-code'.

so it required me to manually restart the service:

systemctl status ptp4l
● ptp4l.service - linuxptp server side autostart
   Loaded: loaded (/lib/systemd/system/ptp4l.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-08-25 13:21:58 EDT; 1s ago
 Main PID: 8529 (ptp4l)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/ptp4l.service
           └─8529 /usr/local/sbin/ptp4l -i eth0 -p /dev/ptp0 -s -m

Aug 25 13:21:58 jetson-0423318029577 ptp4l[8529]: ptp4l[52.904]: selected /dev/ptp0 as PTP clock
Aug 25 13:21:58 jetson-0423318029577 ptp4l[8529]: [52.904] selected /dev/ptp0 as PTP clock
Aug 25 13:21:58 jetson-0423318029577 ptp4l[8529]: ptp4l[52.906]: port 1: INITIALIZING to LISTENING on INIT_COMPLETE
Aug 25 13:21:58 jetson-0423318029577 ptp4l[8529]: ptp4l[52.907]: port 0: INITIALIZING to LISTENING on INIT_COMPLETE
Aug 25 13:21:58 jetson-0423318029577 ptp4l[8529]: [52.906] port 1: INITIALIZING to LISTENING on INIT_COMPLETE
Aug 25 13:21:58 jetson-0423318029577 ptp4l[8529]: [52.907] port 0: INITIALIZING to LISTENING on INIT_COMPLETE
Aug 25 13:21:59 jetson-0423318029577 ptp4l[8529]: ptp4l[53.601]: port 1: new foreign master 48b02d.fffe.05a771-1
Aug 25 13:21:59 jetson-0423318029577 ptp4l[8529]: [53.601] port 1: new foreign master 48b02d.fffe.05a771-1
Aug 25 13:21:59 jetson-0423318029577 ptp4l[8529]: ptp4l[53.674]: port 1: new foreign master 00044b.fffe.cbb2a3-1
Aug 25 13:21:59 jetson-0423318029577 ptp4l[8529]: [53.674] port 1: new foreign master 00044b.fffe.cbb2a3-1

the same for phc2sys

systemctl status phc2sys
● phc2sys.service - phc2sys synchronization autostart
   Loaded: loaded (/lib/systemd/system/phc2sys.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2020-08-25 13:21:12 EDT; 1min 46s ago
  Process: 5062 ExecStart=/usr/local/sbin/phc2sys -m -a -r -w (code=exited, status=255)
 Main PID: 5062 (code=exited, status=255)

Aug 25 13:21:12 jetson-0423318029577 phc2sys[5062]:  -x             apply leap seconds by servo instead of kernel
Aug 25 13:21:12 jetson-0423318029577 phc2sys[5062]:  -z [path]      server address for UDS (/var/run/ptp4l)
Aug 25 13:21:12 jetson-0423318029577 phc2sys[5062]:  -l [num]       set the logging level to 'num' (6)
Aug 25 13:21:12 jetson-0423318029577 phc2sys[5062]:  -t [tag]       add tag to log messages
Aug 25 13:21:12 jetson-0423318029577 phc2sys[5062]:  -m             print messages to stdout
Aug 25 13:21:12 jetson-0423318029577 phc2sys[5062]:  -q             do not print messages to the syslog
Aug 25 13:21:12 jetson-0423318029577 phc2sys[5062]:  -v             prints the software version and exits
Aug 25 13:21:12 jetson-0423318029577 phc2sys[5062]:  -h             prints this message and exits
Aug 25 13:21:12 jetson-0423318029577 systemd[1]: phc2sys.service: Main process exited, code=exited, status=255/n/a
Aug 25 13:21:12 jetson-0423318029577 systemd[1]: phc2sys.service: Failed with result 'exit-code'.

pmc -u -b 0 'GET TIME_STATUS_NP'
sending: GET TIME_STATUS_NP
	00044b.fffe.cb9a37-0 seq 0 RESPONSE MANAGEMENT TIME_STATUS_NP 
		master_offset              0
		ingress_time               1598378174611650592
		cumulativeScaledRateOffset +0.000000000
		scaledLastGmPhaseChange    0
		gmTimeBaseIndicator        0
		lastGmPhaseChange          0x0000'0000000000000000.0000
		gmPresent                  true
		gmIdentity                 00044b.fffe.cbb2a3

You don’t need the -c eth0 because the -a option tells phc2sys to ask ptp4l for the interface that has the phc.

Let me try some things out on the other issues.

1 Like

on AGX client;
it doesn’t seem working, does it?

/usr/local/sbin/phc2sys -m -a -r -w
autoconfiguration cannot be mixed with manual config options.

usage: phc2sys [options]


 automatic configuration:
 -a             turn on autoconfiguration
 -r             synchronize system (realtime) clock
                repeat -r to consider it also as a time source
 manual configuration:
 -c [dev|name]  slave clock (CLOCK_REALTIME)
 -d [dev]       master PPS device
 -s [dev|name]  master clock
 -O [offset]    slave-master time offset (0)
 -w             wait for ptp4l
 common options:
 -f [file]      configuration file
 -E [pi|linreg] clock servo (pi)
 -P [kp]        proportional constant (0.7)
 -I [ki]        integration constant (0.3)
 -S [step]      step threshold (disabled)
 -F [step]      step threshold only on start (0.00002)
 -R [rate]      slave clock update rate in HZ (1.0)
 -N [num]       number of master clock readings per update (5)
 -L [limit]     sanity frequency limit in ppb (200000000)
 -M [num]       NTP SHM segment number (0)
 -u [num]       number of clock updates in summary stats (0)
 -n [num]       domain number (0)
 -x             apply leap seconds by servo instead of kernel
 -z [path]      server address for UDS (/var/run/ptp4l)
 -l [num]       set the logging level to 'num' (6)
 -t [tag]       add tag to log messages
 -m             print messages to stdout
 -q             do not print messages to the syslog
 -v             prints the software version and exits
 -h             prints this message and exits


the command works with the latter agrument omittd though:

cat /lib/systemd/system/phc2sys.service
[Unit]
Description= phc2sys synchronization autostart
[Service]
ExecStart=/usr/local/sbin/phc2sys -a -r -m
[Install]
WantedBy=multi-user.target

Another minor issue is that one of AGX clients despite be put into secondary mode, ignores the grandmaster & assigns the grandmaster role to itself:

systemctl status ptp4l
● ptp4l.service - linuxptp server side autostart
   Loaded: loaded (/lib/systemd/system/ptp4l.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-09-01 09:35:51 EDT; 6s ago
 Main PID: 10939 (ptp4l)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/ptp4l.service
           └─10939 /usr/local/sbin/ptp4l -i eth0 -m -H

Sep 01 09:35:51 agx002 ptp4l[10939]: ptp4l[55470.252]: port 0: INITIALIZING to LISTENING on INIT_COMPLETE
Sep 01 09:35:51 agx002 ptp4l[10939]: [55470.252] port 0: INITIALIZING to LISTENING on INIT_COMPLETE
Sep 01 09:35:57 agx002 ptp4l[10939]: ptp4l[55476.378]: port 1: new foreign master 48b02d.fffe.05a771-1
Sep 01 09:35:57 agx002 ptp4l[10939]: [55476.378] port 1: new foreign master 48b02d.fffe.05a771-1
Sep 01 09:35:57 agx002 ptp4l[10939]: ptp4l[55476.672]: port 1: LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
Sep 01 09:35:57 agx002 ptp4l[10939]: [55476.672] port 1: LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
Sep 01 09:35:57 agx002 ptp4l[10939]: ptp4l[55476.672]: selected local clock 00044b.fffe.cbb2a3 as best master
Sep 01 09:35:57 agx002 ptp4l[10939]: ptp4l[55476.672]: port 1: assuming the grand master role
Sep 01 09:35:57 agx002 ptp4l[10939]: [55476.672] selected local clock 00044b.fffe.cbb2a3 as best master
Sep 01 09:35:57 agx002 ptp4l[10939]: [55476.672] port 1: assuming the grand master role

Another minor complication is that at the grtandmaster server after running phc2sys instead of precision between ssytem clock & phc there emerges a diference ~1 second after starting the phc2sys. Before doing so phc & ntp show exactly the same values.
Does the server need something like timedatectl set-ntp true passed before starting ptp4l?

I am sorry that I would like to ask you a question that I used jetson nano, gpsd can work with my device but when I configure the file ntp.conf. My ntp did not work, I used apt install, do you think is it the problem of ntp or not? Thx!

Start a new thread in the Nano forum with details about how your gps device is connected, your ntp.conf file, and a description of what exactly isn’t working. I’ll see if I can help.

@gtj @carolyuu
can we use the SPE to read from gps? to reduce latency?

# Jetson NX
In order to access a AON GPIO from the Cortex-R5 SPE/AON for Jetson NX,
`ENABLE_SPE_FOR_NX` flag has to be set to 1 in the `target_specific.mk` file
in the in the `soc/t19x`. The GPIO SCR, GPIO interrupt map and pinmux
settings need to be updated as described in below steps.
1. Update SCR values as below in the file `tegra194-mb1-bct-scr-cbb-mini-p3668.cfg`:
         scr.49.6 = 0x18001010; # GPIO_CC_SCR_04_0
         scr.53.6 = 0x18001010; # GPIO_DD_SCR_00_0
2. Update gpio interrupt mapping as below in
   `tegra194-mb1-bct-gpioint-p3668-0001-a00.cfg`:
         gpio-intmap.port.CC.pin.4 = 2; # GPIO CC4 to INT2
         gpio-intmap.port.DD.pin.0 = 2; # GPIO DD0 to INT2
3. Update default pinmux configuration as below in the file
   `tegra19x-mb1-pinmux-p3668-a01.cfg`:
         pinmux.0x0c302000 = 0x00000025; # touch_clk_pcc4: GPIO, pull-down, input-disable
         pinmux.0x0c302040 = 0x00000075; # gen2_i2c_sda_pdd0: i2c2, pull-down, input-enable
4. Compile device tree and flash the entire board to ensure that the SCR, gpio
   interrupt mapping and pinmux settings are flashed on the board.
5. Short GPIO pins of the 40 pin header J12 pin 15 and pin 27, this should print
   out "GPIO input irq triggered" message since pin 15 is configured as OUT which
   drives the pin 27 which is configured as INPUT and also has interrupt enabled.
/SPE/l4t-rt$ cat README.txt 
This package contains the rt-aux-cpu-demo sources which provide a FreeRTOS
based software demo to run Real-Time applications on the Cortex-R5 Sensor
Processing Engine (SPE) on the Jetson platforms.

Directory contents:
1. FreeRTOS - The FreeRTOS port for Cortex-R5.
2. freertos-common* - The drivers required for Tegra.
3. hwinc-* - Header files containing IO register definitions.
4. rt-aux-cpu-demo - SPE demo applications and platform drivers.

How to get started:
1. Refer to the rt-aux-cpu-demo/doc directory for steps to compile and flash
this project.

Can you specify what interface with GPS?
Generally it should be UART. (I think you have another thread for SPE UART.)
For GPIO, yes. you can try SPE GPIO access according to doc. But I’m not sure what’s the role of GPIO acting with GPS module.

br
ChenJian