Time sensitive networking [TSN] on NX

OK, here we go…

Save this file as /boot/pps.dts

/dts-v1/;
/plugin/;

/ {
    overlay-name = "Jetson PPS";
    compatible = "nvidia,p3509-0000+p3668-0001";

    fragment {
        target-path = "/";
        __overlay__ {
			pps: pps_gpio {
				compatible = "pps-gpio";
				gpios = <&tegra_main_gpio 148 1>;
				assert-falling-edge;
				status = "okay";
			};
        };
    };
};

I changed the gpio to GPIO09 which is pin 7 on the 40 pin header because the GPS hat I have already hard wires the PPS signal to that pin.

Compile the dts into a dtbo

$ cd /boot
$ sudo dtc -I dts -O dtb -@ -o pps.dtbo pps.dts

Create a custom dtb from the stock dtbs and pps.dtbo

$ sudo fdtoverlay -i tegra194-p3668-all-p3509-0000.dtb -o tegra194-p3668-all-p3509-0000-user-custom.dtb tegra194-p3668-all-p3509-0000-hdr40.dtbo pps.dtbo

Now edit /boot/extlinux/extlinux.conf and add the following line to your menu entry…

    LINUX ...
    INITRD ...
    FDT /boot/tegra194-p3668-all-p3509-0000-user-custom.dtb
    APPEND ...

Now reboot.

When the system comes back up you should now have a /dev/pps0 device. If you connect your PPS source to pin 7 and you install the pps-tools package, you should be able to run

$ sudo ppstest /dev/pps0
trying PPS source "pps0"
found PPS source "pps0"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1592529430.097600543, sequence: 2333 - clear  0.000000000, sequence: 0
source 0 - assert 1592529431.097604009, sequence: 2334 - clear  0.000000000, sequence: 0
source 0 - assert 1592529432.097600339, sequence: 2335 - clear  0.000000000, sequence: 0
source 0 - assert 1592529433.097601277, sequence: 2336 - clear  0.000000000, sequence: 0

Your next steps depend on how you want to get the kernel time to sync so that it can be sent by ptpd. What I do is use ntpd to take 2 sources. The first is a reliable upstream ntp server. The second is a generic nmea source that takes both the nmea sentences and the pps signal from the gps unit. Once the kernel is synced, ptpd can be set up as a master server.