Repository navigation
Description
Describe the bug
Apparently hardware timestamping is somehow broken and applications don't get timestamps delivered.
Steps to reproduce the behaviour
Run ptp4l in hardware timestamping mode. It will have timestamp errors. Also reproducible with statime when PHC is enabled.
Device (s)
Raspberry Pi 5
System
Raspberry Pi reference 2023-12-11
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 2acf7afcba7d11500313a7b93bb55a2aae20b2d6, stage2
2024/01/24 12:16:01
Copyright (c) 2012 Broadcom
version 1aeae380 (release) (embedded)
Linux helios 6.6.13-v8-16k+ #1724 SMP PREEMPT Mon Jan 22 13:14:14 GMT 2024 aarch64 GNU/Linux
Same happens on 6.1 kernel series
Logs
Hardware timestamping (sudo ptp4l -i eth0 -l 7 -m -q -s):
Details
``` p4l[1215.045]: port 0 (/var/run/ptp4lro): INITIALIZING to LISTENING on INIT_COMPLETE ptp4l[1215.045]: port 1 (eth0): received link status notification ptp4l[1215.045]: interface index 2 is up ptp4l[1215.605]: port 1 (eth0): setting asCapable ptp4l[1215.606]: port 1 (eth0): received SYNC without timestamp ptp4l[1216.606]: port 1 (eth0): received SYNC without timestamp ptp4l[1216.606]: port 1 (eth0): new foreign master f8e43b.fffe.a6665f-1 ptp4l[1217.606]: port 1 (eth0): received SYNC without timestamp ptp4l[1218.606]: port 1 (eth0): received SYNC without timestamp ptp4l[1219.606]: port 1 (eth0): received SYNC without timestamp ptp4l[1220.606]: port 1 (eth0): received SYNC without timestamp ptp4l[1220.606]: selected best master clock f8e43b.fffe.a6665f ptp4l[1220.606]: foreign master not using PTP timescale ptp4l[1220.606]: port 1 (eth0): LISTENING to UNCALIBRATED on RS_SLAVE ptp4l[1221.606]: port 1 (eth0): received SYNC without timestamp ptp4l[1221.606]: port 1 (eth0): have FOLLOW_UP 13, expecting SYNC but got FOLLOW_UP 14, dropping ptp4l[1222.589]: port 1 (eth0): delay timeout ptp4l[1222.606]: port 1 (eth0): received SYNC without timestamp ptp4l[1222.606]: port 1 (eth0): have FOLLOW_UP 14, expecting SYNC but got FOLLOW_UP 15, dropping ptp4l[1222.767]: port 1 (eth0): delay timeout ptp4l[1223.206]: port 1 (eth0): delay timeout ptp4l[1223.606]: port 1 (eth0): received SYNC without timestamp ptp4l[1223.606]: port 1 (eth0): have FOLLOW_UP 15, expecting SYNC but got FOLLOW_UP 16, dropping ptp4l[1224.249]: port 1 (eth0): delay timeout ptp4l[1224.606]: port 1 (eth0): received SYNC without timestamp ptp4l[1224.606]: port 1 (eth0): have FOLLOW_UP 16, expecting SYNC but got FOLLOW_UP 17, dropping ptp4l[1225.156]: port 1 (eth0): delay timeout ptp4l[1225.607]: port 1 (eth0): received SYNC without timestamp ptp4l[1225.607]: port 1 (eth0): have FOLLOW_UP 17, expecting SYNC but got FOLLOW_UP 18, dropping ptp4l[1226.411]: port 1 (eth0): delay timeout ptp4l[1226.606]: port 1 (eth0): received SYNC without timestamp ptp4l[1226.606]: port 1 (eth0): have FOLLOW_UP 18, expecting SYNC but got FOLLOW_UP 19, dropping ptp4l[1226.700]: port 1 (eth0): delay timeout ptp4l[1227.607]: port 1 (eth0): received SYNC without timestamp ptp4l[1227.607]: port 1 (eth0): have FOLLOW_UP 19, expecting SYNC but got FOLLOW_UP 20, dropping ptp4l[1227.989]: port 1 (eth0): delay timeout ptp4l[1228.149]: port 1 (eth0): delay timeout ```Software timestamping (sudo ptp4l -i eth0 -l 7 -m -q -s -S):
Details
``` ptp4l[1352.508]: port 0 (/var/run/ptp4lro): INITIALIZING to LISTENING on INIT_COMPLETE ptp4l[1352.508]: port 1 (eth0): received link status notification ptp4l[1352.508]: interface index 2 is up ptp4l[1352.618]: port 1 (eth0): setting asCapable ptp4l[1352.618]: port 1 (eth0): new foreign master f8e43b.fffe.a6665f-1 ptp4l[1356.618]: selected best master clock f8e43b.fffe.a6665f ptp4l[1356.618]: foreign master not using PTP timescale ptp4l[1356.618]: port 1 (eth0): LISTENING to UNCALIBRATED on RS_SLAVE ptp4l[1356.736]: port 1 (eth0): delay timeout ptp4l[1357.619]: port 1 (eth0): have FOLLOW_UP 149, expecting FOLLOW_UP but got SYNC 150, dropping ptp4l[1358.433]: port 1 (eth0): delay timeout ptp4l[1358.435]: delay filtered 699375 raw 699375 ptp4l[1358.619]: master offset 13075711 s0 freq -31579 path delay 699375 ptp4l[1358.727]: port 1 (eth0): delay timeout ptp4l[1358.729]: delay filtered 703069 raw 706763 ptp4l[1359.619]: master offset 13139396 s0 freq -31579 path delay 703069 ptp4l[1360.619]: master offset 12997246 s0 freq -31579 path delay 703069 ```Additional context
I am currently going to do additional tests like https://github.com/torvalds/linux/blob/master/tools/testing/selftests/net/timestamping.c to surely isolate the issue.
Activity
pelwell commentedon Jan 30, 2024
The Pi 5 PHY does not support hardware timestamping.
dsseng commentedon Jan 30, 2024
What? I've seen (perhaps 3rd party) reviews about it supporting PTP hardware timestamping. Cadence GEM MACs support PTP (unsure about the PHY support). Perhaps this should be reopened to properly detect hardware timestamping support in the GEM/macb driver. However PHC itself should be kept as we tested it to be functional and properly adjustable even with userspace timestamping.
P33M commentedon Jan 30, 2024
Works on my machine(s)? CM4+CM4IO plugged into a dumb switch with a Pi 5. CM4 assumes master role, Pi 5 syncs to master.
P33M commentedon Jan 30, 2024
The MAC driver registers the ptp device in this case, not the PHY driver. What is your server configuration? I see you have
in the log.
dsseng commentedon Jan 30, 2024
Both ptp4l and statime (with all 4 combinations of these two on the either side) produce the same: missing RX timestamps. The server is a PC with USB NIC using software (kernel) timestamping.
@P33M what are your kernel and ptp4l versions?
P33M commentedon Jan 31, 2024
Pi 5:
Local kernel build, but reflects latest rpi-update.
CM4:
Interestingly, if I swap CM4 to slave mode and the Pi 5 assumes master role then the CM4 reports sync errors similar to yours.
The MAC supports both one-step and two-step timestamping. It appears that the Pi 4 is expecting two-step but the Pi 5 is transmitting one-step frames.
dsseng commentedon Jan 31, 2024
I'll try a bit more and could maybe also do a 3.1.1 linuxptp build (it's missing some of the features I use)
dsseng commentedon Jan 31, 2024
ptp4l from Git v3.1.1 exhibits the same behavior. Current kernel:
6.1.0-rpi8-rpi-2712If PC with software timestamps is client and Pi is server it shows
received DELAY_REQ without timestampunless I disable HW timestamping on the Pi 5.davidv1992 commentedon Feb 22, 2024
I have played around a bit with the hardware timestamping available on the PI 5 and there are definitely a few strange things going on which suggest to me there are some driver and/or kernel bugs involved.
When looking at IPv4 ptp packets, when configuring the driver to timestamp only layer 4 v2 ptp packets (passing HWTSTAMP_FILTER_PTP_V2_L4_EVENT to the SIOCSHWTSTAMP ioctl), some received packets are not properly timestamped. However, when enabling the HWTSTAMP_FILTER_ALL filter (which is according to ethool -T the only filter that is supported, and hence what HWTSTAMP_FILTER_PTP_V2_L4_EVENT should be upgraded to) send timestamps for delay requests are suddenly not properly timestamped.
However, looking at ethernet packets, due to a bug I was configuring this also with HWTSTAMP_FILTER_PTP_V2_L4_EVENT, and there all ptp packets seem to get timestamped. So the upgrade process at least partially works. Not sure what is going on in the driver exactly but definitely some hardware timestamping bugs.
All this testing was done on the 6.1.0-rpi8-rpi-2712 kernel
davidv1992 commentedon Feb 22, 2024
Further update: for ethernet packets, the send timestamping not working when using HWTSTAMP_FILTER_ALL also occurs for ptp over raw ethernet.
dsseng commentedon Feb 22, 2024
Thanks for looking into this!
scottstanfield commentedon Mar 6, 2024
I'm configuring a Raspberry Pi 5 with a ZED-F9T (via SparkFun GNSS over RS-232), hoping to use it for PTP hardware timestamping. Following this thread.
I also have a TimeBeat w/the CM4 sandwich to reference.
lmfses commentedon Apr 6, 2024
I am running on RPI5, 6.6.20+rpt-rpi-2712
When enabling PTP with same config that I have on other x64 hosts, I started to receive these;
ptp4l[1546.963]: port 1: received SYNC without timestamp
I added the hwts_filter to "full" in the ptp4l config, which seems to have effect. The default for hwts_filter is "normal".
Not only are the SYNC without timestamps events gone, but chrony seems to accept the PTP now
by commentedon May 3, 2024
Have you tried
ptp4l.confw/network_transport L2?gspreeth commentedon Jun 26, 2024
I have a issue on the CM4 that seems related to a driver bug. I can setup a PTP master that syncs fine with pdelay mechanism using UDP (low nanosecond values) . but when switching to L2 then the pdelay timestamps are very inaccurate (60 to 80 microseconds or more with large jitter) this seems like it defaults to software timestamping for those packets.
ewaldc commentedon Sep 25, 2024
It seems the CM4 can't timestamp TX packets that have the minor version set to a non-zero value. See here. I was struggling with a similar issue on the Realtek 8125. Compiling linuxptp 4.4 (instead of version 4.0 deliverd with Ubuntu Noble) and setting
ptp_minor_versionto0(new config parameter) helped to get rid ofreceived DELAY_REQ without timestampand could possibly also fix other... without timestampissues. Haven't tested on RPI though, just a suggestion...fridtjof commentedon Oct 5, 2024
I can confirm this as well with the Pi 5 - it refused to sync to another host, giving the mentioned "without timestamp" messages.
Setting
ptp_minor_versionto0on the other computer as @ewaldc mentioned made things work immediately, so the same issue seems to apply here as well(?).Some versions and details:
Host:
Pi 5:
@ewaldc that link seems to be broken
ewaldc commentedon Oct 7, 2024
Link corrected, my mistake (working too late). Sorry for the inconvenience.
ptp 2.1 not supported by raspberry pi 5 raspberrypi/linux#5904 (comment)
squeeb commentedon Sep 20, 2026
FWIW, changing that option resulted in this error on a CM5:
however
Updating linuxptp to 4.4 results in the suppression of these messages:
Which now appear to have been replaced with:
Interestingly, these messages only seemed to appear when I enable PTP on a downstream port (in this case an Arista CCS-710XP-12TH-2S) , UDPv4, P2P delay mechanism after I start ptp4l.
If I start ptp4l after I enable PTP on the downstream device, then the message doesn't appear. In either case, the result is the downstream clock being synchronised as expected.