PTP Support

AVNU PTP Support

All networking nodes of NVIDIA DRIVE development platforms are made time-aware systems/nodes. The Tegra CPU nodes act as time-aware end-stations and all switches act as time-aware bridge (Only AVNU CDS 1.6 profile).

Orin development platforms have two different models of ethernet switches connected on board.

  • Marvell 88Q5072 switch (OAK).
  • Marvell 88Q6113 switch (Spruce).

Both switches have their own internal MCU and firmware capable of handling the PTP (AVNU CDS 1.6 profile) locally in side switches. Switches are made time-aware bridge by enabling the PTP support in its firmware. All external switch ports support PTP with static PTP roles.

3710 Base Configuration PTP Network Topology

3710 Base Configuration PTP Port Roles of Switch Ports

Switch - Port Connecting External port /Internal Node Switch Port PTP Role Protocol support PTP device allowed to connect to this port (Role/Protocol)
Switch-1 (88Q5072) - Port 1 MateNET Connector J11: P1 Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6
Switch-1 (88Q5072) - Port 2 MateNET Connector J11: P2 Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6
Switch-1 (88Q5072) - Port 3 MateNET Connector J11: P3 Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6
Switch-1 (88Q5072) - Port 4 MateNET Connector J11: P4 Secondary AVNU AutoCDS v1.6 Primary/AVNU AutoCDS v1.6
Switch-1 (88Q5072) - Port 5 MateNET Connector J11: P5 Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6
Switch-1 (88Q5072) - Port 6 MateNET Connector J11: P6 Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6
Switch-1 (88Q5072) - Port 9 QUAD HMTD Connector J3: P1 Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6
Switch-2 (88Q6113) - Port 2 QUAD HMTD Connector J3: P2 Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6
Switch-2 (88Q6113) - Port 3 QUAD HMTD Connector J3: P3 Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6
Switch-2 (88Q6113) - Port 4 QUAD HMTD Connector J3: P4 Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6
Switch-2 (88Q6113) - Port 5 QUAD HMTD Connector J4: P1 Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6
Switch-2 (88Q6113) - Port 7 QUAD HMTD Connector J4: P2 Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6
Switch-2 (88Q6113) - Port 8 QUAD HMTD Connector J4: P3 Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6
Switch-2 (88Q6113) - Port 9 QUAD HMTD Connector J4: P4 Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6
Switch-1 (88Q5072) - Port 10 Tegra- MGBE 2 Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6
Switch-2 (88Q6113) - Port 10 Tegra- MGBE 3 Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6
Switch-1 (88Q5072) - Port 8 Aurix -MAC Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6

3663 Base Configuration PTP Network Topology

3663 Base Configuration PTP Port Roles of Switch Ports

Switch - Port Connecting External port /Internal Node Switch Port PTP Role Protocol support PTP device allowed to connect to this port (Role/Protocol)
Switch (88Q5072) - Port 1 MateNET Connector J3: P1 Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6
Switch (88Q5072) - Port 2 MateNET Connector J3: P2 Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6
Switch (88Q5072) - Port 3 MateNET Connector J3: P3 Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6
Switch (88Q5072) - Port 4 MateNET Connector J3: P4 Secondary AVNU AutoCDS v1.6 Primary/AVNU AutoCDS v1.6
Switch(88Q5072) - Port 5 MateNET Connector J3: P5 Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6
Switch (88Q5072) - Port 6 MateNET Connector J3: P6 Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6
Switch (88Q5072) - Port 7 QUAD HMTD Connector J7: P1 Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6
Switch (88Q5072) - Port 10 Tegra- MGBE 2 Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6
Switch (88Q5072) - Port 8 Aurix -MAC Primary AVNU AutoCDS v1.6 Secondary/AVNU AutoCDS v1.6

AVNU PTP Support in Tegra

In DRIVE OS Linux (AV+L), Linuxptp daemon i.e ptp4l should run in client mode with automotive profile mode to synchronize the Tegra MGBE_2 mac interface from external GM.

./ptp4l -f automotive_slave.cfg -i mgbe2_0 -p /dev/ptp<X> -m 

// where:
// /dev/ptp<X> - PTP dev node associated with the mgbe2_0

For device connected on EQOS another daemon instance can be started with following command in server mode.

./ptp4l -f automotive_master.cfg -i eqos_0 -p /dev/ptp<X> -m 

// where:
// /dev/ptp<X> - PTP dev node associated with the eqos_0
Note:
  • AVNU CDS 1.6 profile is the default profile for DRIVEOS Linux (AV+L), DRIVEOS QNX (AV+Q & AV+Q+Q) Standard & QNX overlay for development. All the time aware switches supports it by default and DRIVEOS QNX startup scripts has AVNU profile daemon launched by default.
  • For AV+Q+Q, Time sync over ethernet (PTP) is only enabled on VM0 i.e Perception GOS VM.

Other PTP Profiles in Tegra

DRIVE OS Linux and QNX supports IEEE 1588, IEEE 802.1AS & AUTOSAR EthTsync profiles. Support for these profiles are limited to the software stack running in Tegra/Orin i.e no support in switches. This means these profiles can not be enabled on Ethernet MACs which are directly connected to the switches on the Drive Orin Development Platforms. For custom boards all the Tegra MACs can support these profiles.

IEEE 1588 (over IPV4) command in Linux

// #Server Mode
// Assign IP address to interface first

sudo ./ptp4l -i <iface>  -p /dev/ptp<X> -m -4 -l7

// #client Mode

sudo ./ptp4l -i <iface>  -p /dev/ptp<X> -m -s -l7  -4 &

// where:
// <iface> : Interface name i.e eqos_0, mgbe0_0, mgbe1_0 on which PTP is supposed to be started. It could be a VLAN interface above the primary interface.
// /dev/ptp<X> - PTP dev node associated with the interface. Use "ethtool -T" command to identify the hardware clock instance i.e., <X>

IEEE 802.1AS Command in Linux

#Server Mode

sudo ./ptp4l -f ./gPTP.cfg -p /dev/ptp<X> -i <iface> -m -l7


// #client Mode

sudo ./ptp4l -f ./gPTP_slave.cfg -p /dev/ptp<X> -i <iface> -m -l7

// where:
// <iface> : Interface name i.e eqos_0, mgbe0_0, mgbe1_0 on which PTP is supposed to be started. It could be a VLAN interface above the primary interface.
// /dev/ptp<X> - PTP dev node associated with the interface. Use "ethtool -T" command to identify the hardware clock instance i.e., <X>

AUTOSAR EThTsync Command in Linux

// #Server Mode

cd /home/nvidia/samples/nvavb/daemons/
sudo ./gptpTsync <interface> -F autosar_cfg.ini -INITPDELAY 0 -OPERPDELAY 0 -INITSYNC -3 -OPERSYNC -3 -S -V -GM

// #client Mode

cd /home/nvidia/samples/nvavb/daemons/
sudo ./gptpTsync <interface> -F autosar_cfg.ini -INITPDELAY 0 -OPERPDELAY 0 -INITSYNC -3 -OPERSYNC -3 -S -V -N -A

// where:
// <iface> : Interface name i.e eqos_0, mgbe0_0, mgbe1_0 on which PTP is supposed to be started. It could be a VLAN interface above the primary interface.

The following section explains the autosar specific configurable parameters from INI file for gptpTsync binary:

/*
# Time secure

PTP Bridging in Tegra

Tegra SOC has 5 Ethernet MAC controllers imbedded in it. Out of which only one can act as PTP secondary interface to synchronize the Tegra with external GM. There could be use-cases where the time info coming from external GM needs to be forwarded to the devices connected to other mac controllers. This requires a PTP time aware bridge like implementation in Tegra. Starting 6.0.2 a new feature is included in lower layer to sync multiple MAC PHCs from an external GM. As of now support is there for only 2 macs at a time.

MAC selection is configurable through device tree. Check the device tree binding doc at:

Documentation/devicetree/bindings/platform/tegra/tegra-nvethernet.txt
Note: By default, the MGBE2→ EQOS sync is enabled on boot-up starting in 6.0.2.

TSC Reference from PT

Tegra SOC provides a hardware assisted mechanism to align/sync the TSC (clock/counter) with one of the Tegra SOC Ethernet MAC on second boundary using the PPS signal from the MAC. This feature is useful in synchronizing camera fsync signals (used for camera frame capture/timestamping) with PTP time in order to reduce the timestamp jitter between sensors timestamped with PTP domain. This feature is also useful for co-relation of TSC and PTP time-domain timestamps (needed for sensor fusion application) as it ensures a fixed offset (no run-time drift) between PTP and TSC counters over the time. The MAC selection for TSC reference is based on the PTP topology of the platform. It must be always the MAC acting as PTP client for External GTM directly or through switch.

Note: By default, the MGBE2→ TSC locking enabled on boot starting in 6.0.3.

Marvell Switch Firmware Management

The following table describes Marvell switch current firmware versions on the switches.:

Platform Switch Version Firmware Name Function supported
P3663 Oak/88Q5072 0.07.1186.01 P3663_88Q5072_flash.v0.07.1186.01.bin AVNU CDS 1.6 PTP enabled as per role described in PTP section
P3710 Oak/88Q5072 0.07.1186.01 P3663_88Q5072_flash.v0.07.1186.01.bin AVNU CDS 1.6 PTP enabled as per role described in PTP section
Spruce/88Q6113 0.07.1186.01 P3710_88Q6113_flash.v0.07.1186.01.bin AVNU CDS 1.6 PTP enabled as per role described in PTP section

Switch firmware update from Orin over Ethernet

Starting in 6.0.0.1, Its possible to update the Marvell switch firmware from Orin through "update_firmware.sh" script packaged in file system. Silent feature of update process/framework is as below:

  • Automatic upgrade is by default enabled in AV+L standard build only through boot-up script.
  • Manual force upgrade/downgrade is also possible via scripts in AV+L, AV+Q & AV+Q+Q standard builds.
  • Provision to get the current flashed firmware is also possible via script.
Note: Aurix MCU must be pre-flashed with firmware version >= 6.0.0.1.

Manual up-grade/de-grade the firmware

For manual up-grade/de-grade, different scripts are provided per switch, Firmware binaries to be used for this purpose can be found in /lib/firmware/marvell_ethernet. Following are the command references and their locations.

//P3663 - Oak
$sudo /bin/bash /lib/firmware/marvell_ethernet/driveota/P3663_88Q5072.sh --Install <FW>

//P3710 - Oak
$sudo /bin/bash /lib/firmware/marvell_ethernet/driveota/P3710_88Q5072.sh --Install <FW>

//P3710 - Spruce
$sudo /bin/bash /lib/firmware/marvell_ethernet/driveota/P3710_88Q6113.sh --Install <FW>

Print current flashed firmware version:

//P3663 - Oak
$sudo /bin/bash /lib/firmware/marvell_ethernet/driveota/P3663_88Q5072.sh --GetCurrentVersion

//P3710 - Oak
$sudo /bin/bash /lib/firmware/marvell_ethernet/driveota/P3710_88Q5072.sh --GetCurrentVersion

//P3710 - Spruce
$sudo /bin/bash /lib/firmware/marvell_ethernet/driveota/P3710_88Q6113.sh --GetCurrentVersion
Note:
  1. Newly installed firmware will take affect only after aurix is power cycled (As aurix resets the switch)
  2. It is not recommended to update the switch firmware manually unless absolutely required or informed by Nvidia
  3. Its advised to run the script intended for a specific board on that board only(ex: Run P3710_88Q6113.sh on P3710 only) as the recovery from firmware corruption cannot be done without manually flashing using JATG
  4. File format of the firmware binary to be provided as input to "–Install" is fixed. Please refer SWITCH_FW_FORMAT from <board>_<switch>.sh (ex:P3663_88Q5072.sh). Binary provided in any other format will be rejected.
  5. Output of "GetCurrentVersion" follows following format.

    x.xx.xxxx.xx
    0.07.1186.01