Sitemap

Implementing gPTP for Time-Sensitive Networking (TSN) on BeagleY-AI and Raspberry Pi 5

5 min readAug 18, 2025
Press enter or click to view image in full size
RPI5 with i210

In this article I will try to implement parts of TSN by checking for hardware timestamping and do PTP synchronization with a RPI5 and the BeagleY-AI. The TI Sitara SOC has hardware timestamping which helps a lot. On the raspberry Pi an intel i210 board was connected to get proper timestamping by the hardware.

TSN (Time-Sensitive Networking) is the evolved set of standards (also IEEE 802.1) that expands AVB’s concepts to all kinds of deterministic Ethernet traffic (industrial control, robotics, automotive, etc.).

TSN core standards:

  • 802.1AS — gPTP, precise time synchronization
  • 802.1Qav — Credit-Based Shaper (CBS) for predictable bandwidth
  • 802.1Qat — Stream Reservation Protocol (SRP) to reserve bandwidth in the network
  • IEEE 1722 — AVTP (transport protocol for audio/video over Ethernet)
  • IEEE 1722.1 — AVDECC (device discovery/control)

In this article we look at 802.1AS — gPTP, precise time synchronization.

Setting Up TSN on 2 ARM Single Board Computers

Time-Sensitive Networking (TSN) transforms standard Ethernet into a deterministic, real-time communication system. This guide demonstrates gPTP from the TSN implementation on BeagleY-AI and Raspberry Pi, covering hardware timestamping verification and PTP synchronization setup.

HW Timestamps, PTP synchronisation.

Watch this Video to learn about PTP

https://www.ti.com/video/series/precision-time-protocol-ptp-in-the-processor-sdk-for-linux.html

First we set this up on the beagleY.

Install the required software

sudo apt update
sudo apt install \
linuxptp \
ethtool

Check capabilities

ethtool -T eth0
Time stamping parameters for eth0:
Capabilities:
hardware-transmit
software-transmit
hardware-receive
software-receive
software-system-clock
hardware-raw-clock
PTP Hardware Clock: 0
Hardware Transmit Timestamp Modes:
off
on
Hardware Receive Filter Modes:
none
all

This is good. On the beagleY the CPSW port can do HW TX/RX timestamps and has a PHC (PTP Hardware Clock: 0).

Start the ptp

sudo ptp4l -i eth0 -m -2 -H &
ptp4l[2931.474]: selected /dev/ptp0 as PTP clock ptp4l[2931.535]:
port 1: INITIALIZING to LISTENING on INIT_COMPLETE ptp4l[2931.535]:
port 0: INITIALIZING to LISTENING on INIT_COMPLETE ptp4l[2939.207]:
port 1: LISTENING to MASTER on ANNOUNCE_RECEIPT_TIMEOUT_EXPIRES ptp4l[2939.207]:
selected local clock c0d60a.fffe.f963af as best master ptp4l[2939.208]:
port 1: assuming the grand master role

To verify that kernel has ptp support check kernel settings e.t.c.

dmesg | egrep -i 'ptp|phc|cpsw|cpts' 
[ 0.152125] PTP clock support registered
[ 1.416910]am65-cpsw-nuss 8000000.ethernet: initializing am65 cpsw nuss version 0x6BA01903,
cpsw version 0x6BA81903 Ports: 3 quirks:00000006
[ 1.417271] am65-cpsw-nuss 8000000.ethernet: initialized cpsw ale version 1.5
[ 1.417280] am65-cpsw-nuss 8000000.ethernet: ALE Table size 512
[ 1.418039] am65-cpsw-nuss 8000000.ethernet: CPTS ver 0x4e8a010d, freq:500000000, add_val:1 pps:0
[ 1.419899] am65-cpsw-nuss 8000000.ethernet: set new flow-id-base 19
[ 7.948616] am65-cpsw-nuss 8000000.ethernet eth0: PHY [8000f00.mdio:00] driver [TI DP83867] (irq=POLL)
[ 7.948660] am65-cpsw-nuss 8000000.ethernet eth0: configuring for phy/rgmii-rxid link mode
[ 11.009241] am65-cpsw-nuss 8000000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
$ ls -l /dev/ptp*
/dev/ptp0

Check kernel config

zcat /proc/config.gz | egrep 'PTP_1588_CLOCK|NETWORK_PHY_TIMESTAMPING|NET_PTP_CLASSIFY|NET_SCH_TAPRIO|NET_SCH_CBS|NET_SCH_MQPRIO|NET_SCH_ETF|TI_CPTS|AM65|CPSW'
CONFIG_NET_PTP_CLASSIFY=y
CONFIG_NETWORK_PHY_TIMESTAMPING=y
CONFIG_NET_SCH_CBS=m
CONFIG_NET_SCH_ETF=m
CONFIG_NET_SCH_TAPRIO=m
CONFIG_NET_SCH_MQPRIO=m
# CONFIG_TI_CPSW_PHY_SEL is not set
CONFIG_TI_CPSW_PROXY_CLIENT=m
CONFIG_TI_K3_AM65_CPSW_NUSS=y
CONFIG_TI_K3_AM65_CPSW_SWITCHDEV=y
CONFIG_TI_K3_AM65_CPTS=y
CONFIG_TI_AM65_CPSW_TAS=y
CONFIG_PTP_1588_CLOCK=y
CONFIG_PTP_1588_CLOCK_OPTIONAL=y
# CONFIG_PTP_1588_CLOCK_INES is not set
CONFIG_PTP_1588_CLOCK_KVM=y
# CONFIG_PTP_1588_CLOCK_IDT82P33 is not set
# CONFIG_PTP_1588_CLOCK_IDTCM is not set
# CONFIG_PTP_1588_CLOCK_OCP is not set
CONFIG_MMC_SDHCI_AM654=y
CONFIG_PHY_AM654_SERDES=y

Check the time

sudo phc_ctl /dev/ptp0 get
phc_ctl[4577.013]: clock time is 4576.961603906 or Thu Jan 1 01:16:16 1970

Capture packages,

This will show all PTP message types (Sync, Follow_Up, Delay_Req, Delay_Resp, Announce)

tcpdump -i eth0 ether proto 0x88f7 -vv -XX
tcpdump: listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
11:56:51.601336 PTPv2, v1 compat : no, msg type : sync msg, length : 44, domain : 0, reserved1 : 0, Flags [two step], NS correction : 0, sub NS correction : 0, reserved2 : 0, clock identity : 0xc0d60afffef963af, port id : 1, seq id : 1795, control : 0 (Sync), log message interval : 0, originTimeStamp : 0 seconds, 0 nanoseconds
0x0000: 011b 1900 0000 c0d6 0af9 63af 88f7 0002 ..........c.....
0x0010: 002c 0000 0200 0000 0000 0000 0000 0000 .,..............
0x0020: 0000 c0d6 0aff fef9 63af 0001 0703 0000 ........c.......
0x0030: 0000 0000 0000 0000 0000 ..........

As we can see, the ptp clock is not in sync with the actual time.

This is how we can synchronize the ptp clock

# Push system CLOCK_REALTIME to the PHC on eth0
sudo phc2sys -s CLOCK_REALTIME -c eth0 -O 0 -m

-s CLOCK_REALTIME = source is your system clock
-c eth0 = destination is the PHC on eth0
-O 0 = no offset
-m = print messages

Let it run a few seconds until you see the offset is basically zer

Get status

sudo pmc -u -b 0 "GET TIME_STATUS_NP"
[sudo] password for olof:
sending: GET TIME_STATUS_NP
c0d60a.fffe.f963af-0 seq 0 RESPONSE MANAGEMENT TIME_STATUS_NP
master_offset 0
ingress_time 0
cumulativeScaledRateOffset +0.000000000
scaledLastGmPhaseChange 0
gmTimeBaseIndicator 0
lastGmPhaseChange 0x0000'0000000000000000.0000
gmPresent false
gmIdentity c0d60a.fffe.f963af

RPI 5

Now we do the same on a RPI 5. The new Raspberry Pi 5 is now capable to do Hardware Time stamping on its NIC and that means it can do PTP. This is the second Raspberry Pi hardware supporting this feature; the previous one was the CM4.
If you look at the BCM54213PE chip you see that is does not support Hardware Time Stamping. However, using the RP1 chip there is a MAC based Time Stamping happening which allows PTP to work.

It seems that the builtin eth0 also have a hardware clock.
ethtool -T eth0
Time stamping parameters for eth0:
Capabilities:
hardware-transmit
software-transmit
hardware-receive
software-receive
software-system-clock
hardware-raw-clock
PTP Hardware Clock: 1
Hardware Transmit Timestamp Modes:
off
on
onestep-sync
Hardware Receive Filter Modes:
none
all
This is the i210 with hardware clock.

avb@avb-desktop:~/work$ ethtool -T enp1s0
Time stamping parameters for enp1s0:
Capabilities:
hardware-transmit
software-transmit
hardware-receive
software-receive
software-system-clock
hardware-raw-clock
PTP Hardware Clock: 0
Hardware Transmit Timestamp Modes:
off
on
Hardware Receive Filter Modes:
none
all
sudo lshw -class network

Kernel settings for the raspi

cat /boot/config-6.8.0-1031-raspi  | egrep 'PTP_1588_CLOCK|NETWORK_PHY_TIMESTAMPING|NET_PTP_CLASSIFY|NET_SCH_TAPRIO|NET_SCH_CBS|NET_SCH_MQPRIO|NET_SCH_ETF|TI_CPTS|AM65|CPSW'
CONFIG_NET_PTP_CLASSIFY=y
CONFIG_NETWORK_PHY_TIMESTAMPING=y
CONFIG_NET_SCH_CBS=m
CONFIG_NET_SCH_ETF=m
CONFIG_NET_SCH_MQPRIO_LIB=m
CONFIG_NET_SCH_TAPRIO=m
CONFIG_NET_SCH_MQPRIO=m
CONFIG_PTP_1588_CLOCK=y
CONFIG_PTP_1588_CLOCK_OPTIONAL=y
CONFIG_PTP_1588_CLOCK_INES=m
CONFIG_PTP_1588_CLOCK_KVM=m
CONFIG_PTP_1588_CLOCK_IDT82P33=m
CONFIG_PTP_1588_CLOCK_IDTCM=m
CONFIG_PTP_1588_CLOCK_MOCK=m
CONFIG_PTP_1588_CLOCK_OCP=m

For a normal ethernet without hardware time stamping, it looks like this.

ethtool -T enx3c
Time stamping parameters for enx3c:
Capabilities:
software-receive
software-system-clock
PTP Hardware Clock: none
Hardware Transmit Timestamp Modes: none
Hardware Receive Filter Modes: none

Time master configuration

But now we have 2 interfaces on the raspberry and we should probably configure timemaster. timemaster is a program that uses ptp4l and phc2sys in combination with chronyd or ntpd to synchronize the system clock to NTP and PTP time sources. The PTP time is provided by phc2sys and ptp4l via SHM reference clocks to chronyd/ntpd, which can compare all time sources and use the best sources to synchronize the system clock.

Starting the ptp4l manualy.

Hardware timestamping

sudo ptp4l -i eth0 -l 7 -m -q -s

Software timestamping

 sudo ptp4l -i eth0 -l 7 -m -q -s -S
cat /etc/linuxptp/timemaster.conf
# Configuration file for timemaster

#[ntp_server ntp-server.local]
#minpoll 4
#maxpoll 4

[ptp_domain 0]
interfaces enp1s0
delay 10e-6

[timemaster]
ntp_program chronyd

For further testing download this, https://raw.githubusercontent.com/torvalds/linux/refs/heads/master/tools/testing/selftests/ptp/testptp.c

--

--

No responses yet