Enable PSS on Jetson-GPIO Pin Header

Hey,

I’m currently trying to set up the GPIO-pin of Jetson Orin NX 16 GB(JetPack 5.1.2) to accept the PPS signal to synchronize the clock with GPS-Time. Is there some clear instructions how to do this? That could not be so difficult, on Raspbery Pi it takes like 10 min to set up the PPS signal… The approaches that I found here at the Forum unfortunately does not work:/

Hi dzhukov.dp,

Are you using the devkit or custom board for Orin NX?

Which pin would you like to use for PPS signal?

Could you check if the following thread helps for your case?
How to Enable PPS on Orin which pin to setup - #5 by bastibr8yu

Hey Kevin,

thanks for reply.

what i am missing is some kind of “the Big Picture” and step by step instructions how to configurate jetson to accept PPS-Signal over GPIO for the clock corrections.
If I understood correctly (correct me if I wrong) I have to build the kernel new to enable PPS

PPS clients support

CONFIG_PPS_CLIENT_KTIMER=y
CONFIG_PPS_CLIENT_LDISC=y
CONFIG_PPS_CLIENT_GPIO=y

and then flash it on the jetson hardware
Currently I’m using this step by step example and try to adapt to Orin NX:

What I did so far:

1.  install Jetson-Linux toolchain: https://docs.nvidia.com/jetson/archives/r34.1/DeveloperGuide/text/AT//etsonLinuxToolchain.html#at-jetsonlinuxtoolchain 
2. install sdk manager & downloaded software for my target system (Orin_NX)
3. went to nvidia_sdk/JetPack_5.1.2_Linux_JETSON_ORIN_NX_TARGETS/Linux_for_Tegra/
   and performed ./source_sync.sh (tag: jetson_35.4.1 )
4. in JetPack_5.1.2_Linux_JETSON_ORIN_NX_TARGETS/Linux_for_Tegra/sources/kernel/kernel-5.10/
   make ARCH=arm64 O=$TEGRA_KERNEL_OUT tegra_defconfige
5. in kernel_output folder set the PPS-Suport:
# PPS support
#
CONFIG_PPS=y
# CONFIG_PPS_DEBUG=y

#
# PPS clients support
#
CONFIG_PPS_CLIENT_KTIMER=y
CONFIG_PPS_CLIENT_LDISC=y
CONFIG_PPS_CLIENT_GPIO=y
6. in JetPack_5.1.2_Linux_JETSON_ORIN_NX_TARGETS/Linux_for_Tegra/sources/hardware/nvidia/soc/t19x/kernel-dts/tegra194-soc-base.dtsi
   and add pps line in to that file:
   pps {
       gpios = <&gpio TEGRA_GPIO(B, 7) 0>;
   
       compatible = "pps-gpio";
       status = "okay";
   };
   Do not really get the difference between t19x and t23x files, where should I put the line?
7. Tried to put the solution from the tread into tegra234-soc-base.dtsi, an than make (make ARCH=arm64 O=$TEGRA_KERNEL_OUT -j8) it did not work:/ (output.txt)

I’m currently stuck on step 6

The next step would be to flash it on the Jetson-M2 memory via USB-cable:
sudo ./flash.sh jetson-orin-nano-devkit-nvme internal

I’m using devkit and the pin number should be 7

output.txt (9.7 KB)

What’s your carrier board for Orin NX?

Do you want to use PB.07 as PPS signal?
I can’t find this pin in pinmux spreadsheet.

You may use l4t_initrd_flash.sh instead of flash.sh to flash the NVMe on Orin NX.

thanks for your reply

the carrier board is - reComputer J401
And the goal is to connect PPS-signal to 40 pin header. The pin-number is not so important, I just want to understand, how can I set the pin-number. But let’s say, the number should be 7 (on the 40-pin header). What is the procedure to figure this out?
Can you please post a link to pinmux spreadsheet that you are using?

thanks for the tipp with l4t_initrd_flash.sh

Which pin to be used is important because I would show you the configuration for PPS.

For PIN 7 of 40-pin header, it is GPIO09.

It is also PAC.06.

So the configuration in your device tree should be the following

   pps {
       gpios = <&gpio TEGRA234_MAIN_GPIO(AC, 6) GPIO_ACTIVE_HIGH>;
   
       compatible = "pps-gpio";
       status = "okay";
   };

could you please also name the file where I should paste it? Is this “tegra234-soc-base.dtsi” or some other file?

I paste it into that file and try to make kernel (make ARCH=arm64 O=$TEGRA_KERNEL_OUT -j8) , I get the ERROR messages like:
“ERROR (phandle_references): /pps: Reference to non-existent node or label “gpio””
Full file->make_output.txt (5.2 KB)

dtsi will be included to each other so that the tegra234-soc-base.dtsi could work with that change.

Sorry, please replace &gpio with &tegra_main_gpio.

   pps {
       gpios = <&tegra_main_gpio TEGRA234_MAIN_GPIO(AC, 6) GPIO_ACTIVE_HIGH>;
   
       compatible = "pps-gpio";
       status = "okay";
   };

hey,

thanks for response.
Just to understand it correctly: if i want to define a new pin number 12 (I2C0_SCLK) for PPS-input, I have just look up in the pinmux table of my Jetson (Sheets …A01, …A03 does not matter in this case) the right definition of the pin

and just change the code to:

   pps {
       gpios = <&gpio TEGRA234_MAIN_GPIO(H, 7) GPIO_ACTIVE_HIGH>;
   
       compatible = "pps-gpio";
       status = "okay";
   };

Or should I also pay attention to something else?

this line should be the following, or you will hit previous error in Oct 13.

gpios = <&tegra_main_gpio TEGRA234_MAIN_GPIO(H, 7) GPIO_ACTIVE_HIGH>;

Please just check if there’s other node also using this pin in device tree.

thanks for reply

I have managed to flash the Jetson with a build kernel. I have connected the PPS-Signal to pin 7 (GPIO09) but unfortunately it does not recognize the signal on pps1.
my outputs:

sudo ppstest /dev/pps0

trying PPS source “/dev/pps0”
found PPS source “/dev/pps0”
ok, found 1 source(s), now start fetching data…
source 0 - assert 1697457821.255333653, sequence: 36 - clear 0.000000000, sequence: 0
source 0 - assert 1697457822.279546976, sequence: 37 - clear 0.000000000, sequence: 0

sudo ppstest /dev/pps1
trying PPS source “/dev/pps1”
found PPS source “/dev/pps1”
ok, found 1 source(s), now start fetching data…
time_pps_fetch() error -1 (Connection timed out)

Here is also output from sudo dmesg | grep pps:
dmesg grep pps.txt|attachment (134.4 KB)

From my understanding pps0 - is the signal from system and pps1 is signal that comes from GPIO09. That is right?
How can I fix this? Should I also make some configuration in the L4T-Linux?

Here is also the output from cat /sys/kernel/debug/gpio
cat_gpio.txt (6.8 KB)

Is it strange that there is no PPS pin defined?

Have you confirmed if there’s signal input to PAC.06 through measuring with oscilloscope?

Could you share the current dtb used from your board (/boot/dtb/XXXXX.dtb) ?

yes, the PPS signal is there, I’ve just checked it with oscilloscope.
Here is the dtb file ziped:
kernel_tegra234-p3767-0000-p3509-a02.zip (58.3 KB)

sorry, it was a false file. There is the right one (with pin number 12 (I2C0_SCLK) ):
kernel_tegra234-p3767-0000-p3768-0000-a0.zip (58.4 KB)

perhaps it will also help to debug:
I’m using gpsd to get the current time over the /ttyTHS0 serial port. When its running I get time out by pps1 signal. If I kill it, the
ppstest /dev/pps1 says
unable to open device "/dev/pps1" (No such file or directory)
Should some changes also be made in the Ubuntu?

Could you share the detailed steps how you use gpsd on /dev/ttyTHS0 and any configuration for this?
How do you mean about “kill it”? do you kill any process and cause the issue?

Thanks for reply.
here is my whole setup&general idea:

I want synchronize the clock of Jetson based on GPS time. So I have external GPS-reciever, that that gives me a NMEA-messege over serial port and and a PPS pulse over another wire. On my Jetson I have installed the pps-tools, gpsd, gpsd-clients, chrony. These are the standard packages from Linux. As I understand it the gps-deamon takes the data from the serial port and PPS-pin, processes it and later I can get synchronization of the date and second with help of chrony. I did it on the Raspi and I thought it will be also easy to implement it on Jetson.

Jetson does not have the PMC_CLK-pin as Raspi does and pin configuration in general works differently, so I have to define pin by myself, and also enable the PPS in kernel. So if I connect all wires to the pins, I will get ppstest /dev/pps1 the timestemp with the couple msec diference.

Here are the steps that I’ve made to configure the tools on Jetson:

Step -2. Recompile image kernel with PPS options enabled

Step -1. Configurate the PPS pin in device tree

Step 0. Flash the Jetson

Step 1. Install Linux packeges:

apt install pps-tools gpsd gpsd-clients chrony

Step 2. configurate gpsd-file (/etc/default/gpsd):

*# Default settings for the gpsd init script and the hotplug wrapper.**

**# Start the gpsd daemon automatically at boot time**

START_DAEMON="true"

**# Use USB hotplugging to add new USB devices automatically to the daemon**

USBAUTO="true"

**# Devices gpsd should collect to at boot time.**

**# They need to be read/writeable, either by user gpsd or the group dialout.**

DEVICES="/dev/ttyTHS0 /dev/pps1"

**# Other options you want to pass to gpsd**

GPSD_OPTIONS="-n"

Step 3. Reboot PC or just restart gpsd

reboot or systemctl restart gpsd

Step 4. check if gpsd runnig and I have GPS signal:

cgps

Step 5. Check if PPS from kernel works:

ppstest /dev/pps0

=>

trying PPS source "/dev/pps0"
found PPS source "/dev/pps0"
ok, found 1 source(s), now start fetching data...
source 0 - assert 1698848726.442950344, sequence: 19191 - clear  0.000000000, sequence: 0

Step 6. Check if PPS-pin works:

ppstest /dev/pps1

=>

trying PPS source "/dev/pps1"
found PPS source "/dev/pps1"
ok, found 1 source(s), now start fetching data...
time_pps_fetch() error -1 (Connection timed out)

Step 7. Get sad, that it is still not working:/

I do not really know how to debug it.

One thing that I’ve mentioned is that under sys/class/pps I have always pps0 folder and the pps1 only when I gpsd is working (that’s why ppstest says No such file or directory ). And in the path file (cat /sys/class/pps/pps1/path) stands the serial port “/dev/ttyTHS0” what I do not really get. Should there be like a pin number? Because on serial port I’m getting NMEA messages. Or am I searching in the wrong spot?

Sorry that I don’t have GPS module to verify this use case locally.
It seems driver should handle the signal from PAC.06 and you application should get the data from /dev/ttyTHS0.

Could you help to check if there’re messages on /dev/ttyTHS0 and your application read data on it?

How does the signal in /dev/pps0 come from?

Could you share the full dmesg for further check?

hey Kevin,

thanks for your reply

The messages on my serial (/dev/ttyTHS0) are there:

$ sudo cat /dev/ttyTHS0

19,22,24,15,13,17,23,30,05,14,,1.13,0.65,0.93*07

$GLGSA,A,3,78,77,66,67,68,85,76,,,,,,1.13,0.65,0.93*18

$GPGSV,4,1,15,15,68,243,46,22,57,071,43,13,56,146,43,24,46,276,44*74

$GPGSV,4,2,15,14,39,059,26,17,31,101,41,23,30,296,32,19,20,129,44*73

$GPGSV,4,3,15,40,17,128,31,10,13,330,21,30,12,089,20,12,07,215,28*7A

$GPGSV,4,4,15,05,06,201,25,21,04,020,,02,03,030,*4D

$GLGSV,3,1,09,77,82,341,25,67,67,218,42,68,43,317,32,76,36,050,30*67

$GLGSV,3,2,09,78,29,242,34,66,22,169,15,85,18,025,30,86,12,072,*68

$GLGSV,3,3,09,84,02,333,*51

How does the signal in /dev/pps0 come from?:

I think it somehow comes from kernel directly. It has no path specified in /pps0/path

$ cat /sys/class/pps/pps0/path

$ cat /sys/class/pps/pps1/path
/dev/ttyTHS0

$ cat /sys/class/pps/pps1/assert
0.000000000#0

$ cat /sys/class/pps/pps0/assert
1699282451.149367083#1583

here is the full dmesg:
dmesg_full.txt (135.1 KB)

and also gpioinfo:
gpio_info.txt (11.4 KB)

I do not get, why the pins are “unused” if I did define the pin the dtd file?:

Here ist signal on PAC.06

$gpiomon 0 144
event:  RISING EDGE offset: 144 timestamp: [    3459.806621077]
event: FALLING EDGE offset: 144 timestamp: [    3459.906618567]
event:  RISING EDGE offset: 144 timestamp: [    3460.806621127]
event: FALLING EDGE offset: 144 timestamp: [    3460.906621976]
event:  RISING EDGE offset: 144 timestamp: [    3461.806789054]
event: FALLING EDGE offset: 144 timestamp: [    3461.906620426]

This post may be helpful. I was unable to get pps-gpio to work on Orin until I configured pps_client_gpio to be built as a module. Jetpack 5.0.2: UART: CTS pin not working

Please confirm if the following kernel configs have been enabled.

CONFIG_PPS=y
CONFIG_PPS_DEBUG=y
CONFIG_PPS_CLIENT_KTIMER=y
CONFIG_PPS_CLIENT_LDISC=y
CONFIG_PPS_CLIENT_GPIO=y

You could ignore the following messages.

[  833.721567] pps pps1: PPS_FETCH
[  833.721581] pps pps1: timeout 3.000000000

Please also refer to the following thread to check if there’s any error.
Jetpack 5.0.2: UART: CTS pin not working - #15 by JerryChang

Could you clarify what’s your issue here?