This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PROCESSOR-SDK-AM64X: PTP Unstable

Part Number: PROCESSOR-SDK-AM64X


Dear forum,

I'm attempting to modify the SDK to enable PTP when the system boots. I have many Starter Kits and I need to know that they are time synchronized after boot so that I may run my tests. But I'm having difficulty finding a solution that ensures the system clock is synchronized and that survives reboots. For example, if I reboot one of the SKs then the clocks fail to synchronize and requires me to manually restart the service.

Here's what I've done so far. I have two SKs that are connected to each other directly via ethernet cable. I modified the base SDK so that the two ethernet adapters come up bridged to br0, and br0 is configured to obtain an IP address using DHCP.

I created a service /lib/systemd/system/clock-sync.service:

[Unit]
Description=Synchronize system clock to ptp clock
After=systemd-logind.service

[Service]
Type=exec
ExecStart=/usr/bin/phc2sys -a -rr --transportSpecific=1
StandardOutput=journal+console
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

And /lib/systemd/system/ptp.service:

[Unit]
Description=Precision Time Protocol
After=systemd-logind.service

[Service]
Type=exec
ExecStart=/usr/bin/ptp4l -P -2 -H -i eth0 -i eth1 -f /etc/gPTP.cfg --step_thresh
StandardOutput=journal+console
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Then I created symbolic links in /etc/systemd/system/multi-user.target.wants so that these two services will start automatically. I load this image onto two SKs to make sure they will synchronize their clocks, but they fail to synchronize evidenced by using the 'date' command. It looks like they are stuck. Here are the log outputs:

root@sk1: grep ptp4l /var/log/syslog

Jan 17 20:57:15 am64xx-evm ptp4l[771]: [15.633] selected /dev/ptp0 as PTP clock
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [15.688] driver rejected most general HWTSTAMP filter
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [15.688] ioctl SIOCSHWTSTAMP failed: Invalid argument
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [15.736] port 1 (eth0): INITIALIZING to FAULTY on FAULT_DETECTED (FT_UNSPECIFIED)
Jan 17 20:57:15 am64xx-evm ptp4l[771]: [15.633] selected /dev/ptp0 as PTP clock
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [15.688] driver rejected most general HWTSTAMP filter
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [15.688] ioctl SIOCSHWTSTAMP failed: Invalid argument
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [15.736] port 1 (eth0): INITIALIZING to FAULTY on FAULT_DETECTED (FT_UNSPECIFIED)
Jan 17 20:57:16 am64xx-evm phc2sys[770]: [15.847] Waiting for ptp4l...
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [15.862] port 2 (eth1): INITIALIZING to LISTENING on INIT_COMPLETE
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [15.863] port 0 (/var/run/ptp4l): INITIALIZING to LISTENING on INIT_COMPLETE
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [15.863] port 2: unexpected socket error
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [15.863] port 2 (eth1): LISTENING to FAULTY on FAULT_DETECTED (FT_UNSPECIFIED)
Jan 17 20:57:16 am64xx-evm phc2sys[770]: [15.847] Waiting for ptp4l...
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [15.862] port 2 (eth1): INITIALIZING to LISTENING on INIT_COMPLETE
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [15.863] port 0 (/var/run/ptp4l): INITIALIZING to LISTENING on INIT_COMPLETE
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [15.863] port 2: unexpected socket error
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [15.863] port 2 (eth1): LISTENING to FAULTY on FAULT_DETECTED (FT_UNSPECIFIED)
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [16.632] port 2: link down
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [16.633] selected best master clock ac1f0f.fffe.83f28b
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [16.633] selected local clock ac1f0f.fffe.83f28b as best master
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [16.632] port 2: link down
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [16.633] selected best master clock ac1f0f.fffe.83f28b
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [16.633] selected local clock ac1f0f.fffe.83f28b as best master
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [16.633] selected best master clock ac1f0f.fffe.83f28b
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [16.633] selected local clock ac1f0f.fffe.83f28b as best master
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [16.633] selected best master clock ac1f0f.fffe.83f28b
Jan 17 20:57:16 am64xx-evm ptp4l[771]: [16.633] selected local clock ac1f0f.fffe.83f28b as best master
Jan 17 20:57:17 am64xx-evm phc2sys[770]: [16.850] Waiting for ptp4l...
Jan 17 20:57:17 am64xx-evm phc2sys[770]: [16.850] Waiting for ptp4l...
Jan 17 20:57:20 am64xx-evm ptp4l[771]: [19.908] port 2: link up
Jan 17 20:57:20 am64xx-evm ptp4l[771]: [19.968] port 2 (eth1): FAULTY to LISTENING on INIT_COMPLETE
Jan 17 20:57:20 am64xx-evm ptp4l[771]: [19.908] port 2: link up
Jan 17 20:57:20 am64xx-evm ptp4l[771]: [19.968] port 2 (eth1): FAULTY to LISTENING on INIT_COMPLETE
Jan 17 20:57:23 am64xx-evm ptp4l[771]: [23.534] port 2: announce timeout
Jan 17 20:57:23 am64xx-evm ptp4l[771]: [23.534] port 2 (eth1): LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
Jan 17 20:57:23 am64xx-evm ptp4l[771]: [23.535] selected best master clock ac1f0f.fffe.83f28b
Jan 17 20:57:23 am64xx-evm ptp4l[771]: [23.535] selected local clock ac1f0f.fffe.83f28b as best master
Jan 17 20:57:23 am64xx-evm ptp4l[771]: [23.535] port 2: assuming the grand master role
Jan 17 20:57:23 am64xx-evm ptp4l[771]: [23.534] port 2: announce timeout
Jan 17 20:57:23 am64xx-evm ptp4l[771]: [23.534] port 2 (eth1): LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
Jan 17 20:57:23 am64xx-evm ptp4l[771]: [23.535] selected best master clock ac1f0f.fffe.83f28b
Jan 17 20:57:23 am64xx-evm ptp4l[771]: [23.535] selected local clock ac1f0f.fffe.83f28b as best master
Jan 17 20:57:23 am64xx-evm ptp4l[771]: [23.535] port 2: assuming the grand master role

root@sk1: grep ptp4l /var/log/syslog

Jan 17 20:57:14 am64xx-evm ptp4l[775]: [14.165] selected /dev/ptp0 as PTP clock
Jan 17 20:57:14 am64xx-evm ptp4l[775]: [14.222] driver rejected most general HWTSTAMP filter
Jan 17 20:57:14 am64xx-evm ptp4l[775]: [14.222] ioctl SIOCSHWTSTAMP failed: Invalid argument
Jan 17 20:57:14 am64xx-evm ptp4l[775]: [14.260] port 1 (eth0): INITIALIZING to FAULTY on FAULT_DETECTED (FT_UNSPECIFIED)
Jan 17 20:57:14 am64xx-evm ptp4l[775]: [14.165] selected /dev/ptp0 as PTP clock
Jan 17 20:57:14 am64xx-evm ptp4l[775]: [14.222] driver rejected most general HWTSTAMP filter
Jan 17 20:57:14 am64xx-evm ptp4l[775]: [14.222] ioctl SIOCSHWTSTAMP failed: Invalid argument
Jan 17 20:57:14 am64xx-evm ptp4l[775]: [14.260] port 1 (eth0): INITIALIZING to FAULTY on FAULT_DETECTED (FT_UNSPECIFIED)
Jan 17 20:57:15 am64xx-evm ptp4l[775]: [14.507] port 2 (eth1): INITIALIZING to LISTENING on INIT_COMPLETE
Jan 17 20:57:15 am64xx-evm ptp4l[775]: [14.508] port 0 (/var/run/ptp4l): INITIALIZING to LISTENING on INIT_COMPLETE
Jan 17 20:57:15 am64xx-evm ptp4l[775]: [14.508] port 2: unexpected socket error
Jan 17 20:57:15 am64xx-evm ptp4l[775]: [14.508] port 2 (eth1): LISTENING to FAULTY on FAULT_DETECTED (FT_UNSPECIFIED)
Jan 17 20:57:15 am64xx-evm ptp4l[775]: [14.564] port 2: link down
Jan 17 20:57:15 am64xx-evm ptp4l[775]: [14.565] selected best master clock ac1f0f.fffe.84011b
Jan 17 20:57:15 am64xx-evm ptp4l[775]: [14.565] selected local clock ac1f0f.fffe.84011b as best master
Jan 17 20:57:15 am64xx-evm ptp4l[775]: [14.507] port 2 (eth1): INITIALIZING to LISTENING on INIT_COMPLETE
Jan 17 20:57:15 am64xx-evm ptp4l[775]: [14.508] port 0 (/var/run/ptp4l): INITIALIZING to LISTENING on INIT_COMPLETE
Jan 17 20:57:15 am64xx-evm ptp4l[775]: [14.508] port 2: unexpected socket error
Jan 17 20:57:15 am64xx-evm ptp4l[775]: [14.508] port 2 (eth1): LISTENING to FAULTY on FAULT_DETECTED (FT_UNSPECIFIED)
Jan 17 20:57:15 am64xx-evm ptp4l[775]: [14.564] port 2: link down
Jan 17 20:57:15 am64xx-evm ptp4l[775]: [14.565] selected best master clock ac1f0f.fffe.84011b
Jan 17 20:57:15 am64xx-evm ptp4l[775]: [14.565] selected local clock ac1f0f.fffe.84011b as best master
Jan 17 20:57:15 am64xx-evm phc2sys[773]: [14.841] Waiting for ptp4l...
Jan 17 20:57:15 am64xx-evm phc2sys[773]: [14.841] Waiting for ptp4l...
Jan 17 20:57:19 am64xx-evm ptp4l[775]: [18.441] port 2: link up
Jan 17 20:57:19 am64xx-evm ptp4l[775]: [18.441] port 2: link up
Jan 17 20:57:19 am64xx-evm ptp4l[775]: [18.537] port 2 (eth1): FAULTY to LISTENING on INIT_COMPLETE
Jan 17 20:57:19 am64xx-evm ptp4l[775]: [18.537] port 2 (eth1): FAULTY to LISTENING on INIT_COMPLETE
Jan 17 20:57:22 am64xx-evm ptp4l[775]: [21.805] port 2: announce timeout
Jan 17 20:57:22 am64xx-evm ptp4l[775]: [21.805] port 2 (eth1): LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
Jan 17 20:57:22 am64xx-evm ptp4l[775]: [21.806] selected best master clock ac1f0f.fffe.84011b
Jan 17 20:57:22 am64xx-evm ptp4l[775]: [21.806] selected local clock ac1f0f.fffe.84011b as best master
Jan 17 20:57:22 am64xx-evm ptp4l[775]: [21.806] port 2: assuming the grand master role
Jan 17 20:57:22 am64xx-evm ptp4l[775]: [21.805] port 2: announce timeout
Jan 17 20:57:22 am64xx-evm ptp4l[775]: [21.805] port 2 (eth1): LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
Jan 17 20:57:22 am64xx-evm ptp4l[775]: [21.806] selected best master clock ac1f0f.fffe.84011b
Jan 17 20:57:22 am64xx-evm ptp4l[775]: [21.806] selected local clock ac1f0f.fffe.84011b as best master
Jan 17 20:57:22 am64xx-evm ptp4l[775]: [21.806] port 2: assuming the grand master role

By simply restarting the ptp service on one of the SKs, it appears the ptp service starts to synchronize:

root@sk2: systemctl restart ptp
root@sk2: grep ptp4l /var/log/syslog

Jan 17 21:10:19 am64xx-evm ptp4l[1255]: [798.341] selected /dev/ptp0 as PTP clock
Jan 17 21:10:19 am64xx-evm ptp4l[1255]: [798.384] port 1 (eth0): INITIALIZING to LISTENING on INIT_COMPLETE
Jan 17 21:10:19 am64xx-evm ptp4l[1255]: [798.416] port 2 (eth1): INITIALIZING to LISTENING on INIT_COMPLETE
Jan 17 21:10:19 am64xx-evm ptp4l[1255]: [798.417] port 0 (/var/run/ptp4l): INITIALIZING to LISTENING on INIT_COMPLETE
Jan 17 21:10:19 am64xx-evm ptp4l[1255]: [798.341] selected /dev/ptp0 as PTP clock
Jan 17 21:10:19 am64xx-evm ptp4l[1255]: [798.384] port 1 (eth0): INITIALIZING to LISTENING on INIT_COMPLETE
Jan 17 21:10:19 am64xx-evm ptp4l[1255]: [798.416] port 2 (eth1): INITIALIZING to LISTENING on INIT_COMPLETE
Jan 17 21:10:19 am64xx-evm ptp4l[1255]: [798.417] port 0 (/var/run/ptp4l): INITIALIZING to LISTENING on INIT_COMPLETE
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [801.752] port 1: new foreign master ac1f0f.fffe.83f28b-2
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [801.752] port 1: new foreign master ac1f0f.fffe.83f28b-2
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [802.207] port 2: announce timeout
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [802.207] port 2 (eth1): LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [802.207] selected best master clock ac1f0f.fffe.84011b
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [802.207] selected local clock ac1f0f.fffe.84011b as best master
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [802.207] port 2: assuming the grand master role
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [802.225] port 1: announce timeout
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [802.226] port 1 (eth0): LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [802.226] selected best master clock ac1f0f.fffe.84011b
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [802.226] selected local clock ac1f0f.fffe.84011b as best master
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [802.226] port 1: assuming the grand master role
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [802.226] port 2: assuming the grand master role
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [802.207] port 2: announce timeout
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [802.207] port 2 (eth1): LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [802.207] selected best master clock ac1f0f.fffe.84011b
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [802.207] selected local clock ac1f0f.fffe.84011b as best master
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [802.207] port 2: assuming the grand master role
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [802.225] port 1: announce timeout
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [802.226] port 1 (eth0): LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [802.226] selected best master clock ac1f0f.fffe.84011b
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [802.226] selected local clock ac1f0f.fffe.84011b as best master
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [802.226] port 1: assuming the grand master role
Jan 17 21:10:22 am64xx-evm ptp4l[1255]: [802.226] port 2: assuming the grand master role
Jan 17 21:10:24 am64xx-evm ptp4l[1255]: [803.752] selected best master clock ac1f0f.fffe.83f28b on port 1
Jan 17 21:10:24 am64xx-evm ptp4l[1255]: [803.753] selected best master clock ac1f0f.fffe.83f28b
Jan 17 21:10:24 am64xx-evm ptp4l[1255]: [803.753] port 1 (eth0): MASTER to UNCALIBRATED on RS_SLAVE
Jan 17 21:10:24 am64xx-evm ptp4l[1255]: [803.752] selected best master clock ac1f0f.fffe.83f28b on port 1
Jan 17 21:10:24 am64xx-evm ptp4l[1255]: [803.753] selected best master clock ac1f0f.fffe.83f28b
Jan 17 21:10:24 am64xx-evm ptp4l[1255]: [803.753] port 1 (eth0): MASTER to UNCALIBRATED on RS_SLAVE
Jan 17 21:10:25 am64xx-evm ptp4l[1255]: [804.716] port 1 (eth0): UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED
Jan 17 21:10:25 am64xx-evm ptp4l[1255]: [804.716] port 1 (eth0): UNCALIBRATED to SLAVE on MASTER_CLOCK_SELECTED
Jan 17 21:10:26 am64xx-evm ptp4l[1255]: [805.342] rms 16238546271 max 32477092774 freq -10675 +/- 5442 delay 406 +/- 0
Jan 17 21:10:26 am64xx-evm ptp4l[1255]: [805.342] rms 16238546271 max 32477092774 freq -10675 +/- 5442 delay 406 +/- 0
Jan 17 21:10:27 am64xx-evm ptp4l[1255]: [806.342] rms 1876 max 3882 freq -9907 +/- 2223 delay 406 +/- 0
Jan 17 21:10:27 am64xx-evm ptp4l[1255]: [806.342] rms 1876 max 3882 freq -9907 +/- 2223 delay 406 +/- 0

root@sk1: grep ptp4l /var/log/syslog

Jan 17 21:09:50 am64xx-evm ptp4l[771]: [770.063] port 2: new foreign master ac1f0f.fffe.84011b-1
Jan 17 21:09:50 am64xx-evm ptp4l[771]: [770.063] port 2: new foreign master ac1f0f.fffe.84011b-1

So now PTP seems to be working, but the system clocks still aren't synchronizing. The output of phc2sys seems to be correct:

root@sk1: systemctl status clock-sync

* clock-sync.service - Synchronize system clock to ptp clock
Loaded: loaded (/lib/systemd/system/clock-sync.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2022-01-17 20:57:15 UTC; 16min ago
Main PID: 770 (phc2sys)
Tasks: 1 (limit: 2225)
Memory: 332.0K
CGroup: /system.slice/clock-sync.service
`-770 /usr/bin/phc2sys -a -rr --transportSpecific=1

Jan 17 21:13:58 am64xx-evm phc2sys[770]: [1018.271] eth1 sys offset 10 s2 freq +8 delay 605
Jan 17 21:13:59 am64xx-evm phc2sys[770]: [1019.272] eth1 sys offset 10 s2 freq +11 delay 625
Jan 17 21:14:00 am64xx-evm phc2sys[770]: [1020.272] eth1 sys offset -22 s2 freq -18 delay 585
Jan 17 21:14:01 am64xx-evm phc2sys[770]: [1021.273] eth1 sys offset 6 s2 freq +3 delay 605
Jan 17 21:14:02 am64xx-evm phc2sys[770]: [1022.273] eth1 sys offset 0 s2 freq -1 delay 605
Jan 17 21:14:03 am64xx-evm phc2sys[770]: [1023.274] eth1 sys offset 8 s2 freq +7 delay 615
Jan 17 21:14:04 am64xx-evm phc2sys[770]: [1024.274] eth1 sys offset 1 s2 freq +2 delay 615
Jan 17 21:14:05 am64xx-evm phc2sys[770]: [1025.274] eth1 sys offset -8 s2 freq -6 delay 600
Jan 17 21:14:06 am64xx-evm phc2sys[770]: [1026.275] eth1 sys offset 1 s2 freq +0 delay 605
Jan 17 21:14:07 am64xx-evm phc2sys[770]: [1027.275] eth1 sys offset -1 s2 freq -1 delay 610

root@sk2: systemctl status clock-sync

* clock-sync.service - Synchronize system clock to ptp clock
Loaded: loaded (/lib/systemd/system/clock-sync.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2022-01-17 20:57:14 UTC; 17min ago
Main PID: 773 (phc2sys)
Tasks: 1 (limit: 2225)
Memory: 332.0K
CGroup: /system.slice/clock-sync.service
`-773 /usr/bin/phc2sys -a -rr --transportSpecific=1

Jan 17 21:14:22 am64xx-evm phc2sys[773]: [1042.293] eth1 sys offset -32476230810 s2 freq -488281 delay 585
Jan 17 21:14:23 am64xx-evm phc2sys[773]: [1043.294] eth1 sys offset -32476227106 s2 freq -488281 delay 615
Jan 17 21:14:24 am64xx-evm phc2sys[773]: [1044.294] eth1 sys offset -32476223535 s2 freq -488281 delay 605
Jan 17 21:14:25 am64xx-evm phc2sys[773]: [1045.294] eth1 sys offset -32476219912 s2 freq -488281 delay 605
Jan 17 21:14:26 am64xx-evm phc2sys[773]: [1046.295] eth1 sys offset -32476216295 s2 freq -488281 delay 585
Jan 17 21:14:27 am64xx-evm phc2sys[773]: [1047.295] eth1 sys offset -32476212641 s2 freq -488281 delay 615
Jan 17 21:14:28 am64xx-evm phc2sys[773]: [1048.296] eth1 sys offset -32476208970 s2 freq -488281 delay 610
Jan 17 21:14:29 am64xx-evm phc2sys[773]: [1049.296] eth1 sys offset -32476205279 s2 freq -488281 delay 600
Jan 17 21:14:30 am64xx-evm phc2sys[773]: [1050.297] eth1 sys offset -32476201615 s2 freq -488281 delay 600
Jan 17 21:14:31 am64xx-evm phc2sys[773]: [1051.297] eth1 sys offset -32476197952 s2 freq -488281 delay 605

Nevertheless, the clocks do not synchronize, as evidenced by the 'date' command. Finally I restart the clock-sync service on SK2 'systemctl restart clock-sync' and now the system clocks synchronize.

root@sk2: systemctl status clock-sync

* clock-sync.service - Synchronize system clock to ptp clock
Loaded: loaded (/lib/systemd/system/clock-sync.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2022-01-17 21:14:55 UTC; 2min 36s ago
Main PID: 1327 (phc2sys)
Tasks: 1 (limit: 2225)
Memory: 224.0K
CGroup: /system.slice/clock-sync.service
`-1327 /usr/bin/phc2sys -a -rr --transportSpecific=1

Jan 17 21:17:23 am64xx-evm phc2sys[1327]: [1255.217] CLOCK_REALTIME phc offset 35 s2 freq -3692 delay 600
Jan 17 21:17:24 am64xx-evm phc2sys[1327]: [1256.218] CLOCK_REALTIME phc offset 21 s2 freq -3695 delay 615
Jan 17 21:17:25 am64xx-evm phc2sys[1327]: [1257.218] CLOCK_REALTIME phc offset 6 s2 freq -3704 delay 620
Jan 17 21:17:26 am64xx-evm phc2sys[1327]: [1258.219] CLOCK_REALTIME phc offset 21 s2 freq -3687 delay 590
Jan 17 21:17:27 am64xx-evm phc2sys[1327]: [1259.220] CLOCK_REALTIME phc offset 9 s2 freq -3693 delay 585
Jan 17 21:17:28 am64xx-evm phc2sys[1327]: [1260.220] CLOCK_REALTIME phc offset -40 s2 freq -3739 delay 625
Jan 17 21:17:29 am64xx-evm phc2sys[1327]: [1261.221] CLOCK_REALTIME phc offset -12 s2 freq -3723 delay 620
Jan 17 21:17:30 am64xx-evm phc2sys[1327]: [1262.221] CLOCK_REALTIME phc offset 20 s2 freq -3695 delay 590
Jan 17 21:17:31 am64xx-evm phc2sys[1327]: [1263.222] CLOCK_REALTIME phc offset -4 s2 freq -3713 delay 620
Jan 17 21:17:32 am64xx-evm phc2sys[1327]: [1264.223] CLOCK_REALTIME phc offset 26 s2 freq -3684 delay 600

I added a delay to the startup script 'ExecStartPre=/bin/sleep 25'. That seems to help, but it only makes the problem less frequent. Still, if I restart one of the SKs then they no longer synchronize their clocks and I have to manually restart the service again.

Is there something that can be done to make this more stable? Have I done something wrong? I'm currently using ti-processor-sdk-linux-rt-am64xx-evm-08.01.00.39. My expectation is that the system would not require manual intervention to ensure the system clocks are synchronized as this is essential for my application.

Best regards.

  • Hello Brian,

    Apologies for the delayed response. I'm on vacation for the rest of August, reassigning your thread to another team member to comment.

    Regards,

    Nick

  • Brian,

    I'll see if I can get a multi AM64x SK setup going with the modifications to automatically start ptp4l to see what comes up. But couple thoughts to try for you. The value of priority1 in the file /etc/gPTP.cfg (I use https://github.com/richardcochran/linuxptp/blob/master/configs/gPTP.cfg and add two lines added at the end, not mandatory but should match the datasheet of the PHY chip on the board)

    #
    # 802.1AS example configuration containing those attributes which
    # differ from the defaults.  See the file, default.cfg, for the
    # complete list of available options.
    #
    [global]
    gmCapable		1
    priority1		248
    priority2		248
    logAnnounceInterval	0
    logSyncInterval		-3
    syncReceiptTimeout	3
    neighborPropDelayThresh	800
    min_neighbor_prop_delay	-20000000
    assume_two_step		1
    path_trace_enabled	1
    follow_up_info		1
    transportSpecific	0x1
    ptp_dst_mac		01:80:C2:00:00:0E
    network_transport	L2
    delay_mechanism		P2P
    ingressLatency		88
    egressLatency		288

    is used by PTP BMCA to select the master/leader. Algorithm is something like low number wins, in case of a tie use some bits from the MAC address to break ties. My guess is you use the default cfg file on all boards, so the priority1 is the same on all. So it will be down to the tiebreaker. One possibility is some conflict with MAC addresses, if I recall the way were programming the second MAC on some eval boards was not good. So try modifying the priority1 on one board to say 240 from the default 248 to basically force it to be leader/master. Also worth checking the MAC addresses are unique (for example "ip a" prints them out).

    Second item I noticed for auto start is phc2sys and -w option. I think it is intended so phc2sys waits for ptp4l to get synchronized. I think it makes sense in the auto start setup.

    3rd thing to check

    ExecStart=/usr/bin/ptp4l -P -2 -H -i eth0 -i eth1 -f /etc/gPTP.cfg --step_thresh

    I think this is just a cut-and-paste issue, but if not you probably want the line to be:

    ExecStart=/usr/bin/ptp4l -P -2 -H -i eth0 -i eth1 -f /etc/gPTP.cfg --step_threshold=1 -m -q -p /dev/ptp0

      Pekka

  • Second item I noticed for auto start is phc2sys and -w option.

    It seems this is incompatible with the -a option. Unfortunately I couldn't guess how to pass the other arguments. Here's what I tried (and other permutations of below):

    phc2sys -w -s eth0 -s eth1 -s /dev/ptp0 -d /dev/pps0 -r -m --transportSpecific=1