Enabling PPS on Jetson Nano with Jetpack 4.3

Hi!

I have looked through the forum and apart form some ancient threads I wasn’t able to find any information on setting up any pin as a PPS. I’ve looked through the documentation on Expansion Header Configuration however I couldn’t find anything that would be helpful.

I also checked all the options and even tried to find something in the jetsion-io.py source code to no avail.

I even tried following the information here: PPS On Jetson Nano and compiling the kernel using instructions from ridgerun website. All without a tangible results (not seeing any /dev/pps* device).

Any ideas on how to fix that would be highly appreciated!

what is the output of the commands below?
gunzip < /proc/config.gz | grep CONFIG_PPS_CLIENT_GPIO
zcat /proc/config.gz | grep -i pps
you may also like to install:
sudo apt install pps-tools
reference: https://www.kernel.org/doc/html/latest/driver-api/pps.html

The output is as follows:

gunzip < /proc/config.gz | grep CONFIG_PPS_CLIENT_GPIO
# CONFIG_PPS_CLIENT_GPIO is not set


zcat /proc/config.gz | grep -i pps
# PPS support
CONFIG_PPS=y
# CONFIG_PPS_DEBUG is not set
# PPS clients support
# CONFIG_PPS_CLIENT_KTIMER is not set
# CONFIG_PPS_CLIENT_LDISC is not set
# CONFIG_PPS_CLIENT_GPIO is not set
# PPS generators support
# CONFIG_NVPPS is not set

Do you know how I would set these up with the latest kernel version?

I assume you would need to follows steps from https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide%2Fkernel_custom.html%23wwpID0E02C0HA
and modify the file tegra_defconfig at step 3,
text editor can be used for customizing listed parameters

Many thanks for your reply Andrey.

I’ve followed the tutorial to flash the kernel and made sure to enable CONFIG_PPS_CLIENT_GPIO.

Now, here is the output of the commands you’ve mentioned:

gunzip < /proc/config.gz | grep CONFIG_PPS_CLIENT_GPIO
CONFIG_PPS_CLIENT_GPIO=y

zcat /proc/config.gz | grep -i pps
# PPS support
CONFIG_PPS=y
# CONFIG_PPS_DEBUG is not set
# PPS clients support
# CONFIG_PPS_CLIENT_KTIMER is not set
CONFIG_PPS_CLIENT_LDISC=y
CONFIG_PPS_CLIENT_GPIO=y
# PPS generators support
# CONFIG_NVPPS is not set

Unfortunately when I do ls /dev/pps* no device is shown, the jetson-io.py GUI doesn’t show any PPS functions either:

Would you have any other ideas of what I could try?

CONFIG_PPS_CLIENT_KTIMER is not set
When you enable it with m key you should be able to run
modprobe pps.ktimer
otherwise if you enable it with y, it will be persistently loaded
that might add /dev/pps* device
I did not test it, but documentation seem to refer to such option
https://www.kernel.org/doc/Documentation/pps/pps.txt

1 Like

from the pps.txt

-----------------------

In order to test the PPS support even without specific hardware you can use
the pps-ktimer driver (see the client subsection in the PPS configuration menu)
and the userland tools available in your distribution's pps-tools package,
http://linuxpps.org , or https://github.com/redlab-i/pps-tools.

Once you have enabled the compilation of pps-ktimer just modprobe it (if
not statically compiled):

   # modprobe pps-ktimer

and the run ppstest as follow:

   $ ./ppstest /dev/pps1
   trying PPS source "/dev/pps1"
   found PPS source "/dev/pps1"
   ok, found 1 source(s), now start fetching data...
   source 0 - assert 1186592699.388832443, sequence: 364 - clear  0.000000000, sequence: 0
   source 0 - assert 1186592700.388931295, sequence: 365 - clear  0.000000000, sequence: 0
   source 0 - assert 1186592701.389032765, sequence: 366 - clear  0.000000000, sequence: 0

Please note that to compile userland programs, you need the file timepps.h.
This is available in the pps-tools repository mentioned above.

Many thanks! Almost there it seems!

modprobe pps-ktimer
modprobe: FATAL: Module pps-ktimer not found in directory /lib/modules/5.3.0-46-generic

So, modprobe returns an error. The docs says

Once you have enabled the compilation of pps-ktimer just modprobe it (if not statically compiled)…

I think it might be statically compiled when the kernel was built? Anyway the /dev/pps0 is there now!

running the ppstest I get the following results:

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 1586861632.134228645, sequence: 770 - clear  0.000000000, sequence: 0
source 0 - assert 1586861633.158267010, sequence: 771 - clear  0.000000000, sequence: 0
source 0 - assert 1586861634.182270478, sequence: 772 - clear  0.000000000, sequence: 0
source 0 - assert 1586861635.206267176, sequence: 773 - clear  0.000000000, sequence: 0
source 0 - assert 1586861636.230254550, sequence: 774 - clear  0.000000000, sequence: 0
source 0 - assert 1586861637.254255779, sequence: 775 - clear  0.000000000, sequence: 0
source 0 - assert 1586861638.278258362, sequence: 776 - clear  0.000000000, sequence: 0
source 0 - assert 1586861639.302353601, sequence: 777 - clear  0.000000000, sequence: 0
source 0 - assert 1586861640.326258267, sequence: 778 - clear  0.000000000, sequence: 0
source 0 - assert 1586861641.350253454, sequence: 779 - clear  0.000000000, sequence: 0
source 0 - assert 1586861642.374255672, sequence: 780 - clear  0.000000000, sequence: 0

The only thing I’m missing now is how the /dev/pps0 would get mapped to a GPIO pin if it’s not available in jetson-io. Would you have any advice on that?

probably assigning pps0 to certain gpio pin might require device tree modifications;
May be more knowledgeable folks will add.
some reference Adding PPS input to TX1 for Line Discipline

Thanks!

It looks like device tree overlays could possibly work, however I’m having a hard time finding any concrete information about the specific details what would go into the tree overlay.

I will try to modify the device tree directly before building and see what happens.

Any chance someone from Nvidia would be able to help with this?

I have followed the approach shown in this topic: PPS On Jetson Nano And it seems to have worked well for me!

Thanks for all the help Andrey1984!

I will be writing a blog post to summarize all the steps that I’ve taken, I think some people might find this useful.

EDIT: here is the link to my blog post in case anyone finds it useful in the future: https://msadowski.github.io/pps-support-jetson-nano/

@msadowski90
Thank you for sharing your success.

Thank you two for the information about pps.

ppstest is success on my case,but I don’t know how to use it for time sync.

time sync
probably means NTPd
http://doc.ntp.org/4.1.1/pps.htm
https://www.crc.id.au/2016/09/24/adding-a-pps-source-to-ntpd/
on x86_64 I used to implement a test configuration using http://www.rjsystems.nl/en/2100-ntpd-garmin-gps-18-lvc-gpsd.php

Some excerpt from the document:

After that, several edits to /etc/ntp.conf are required, starting with the addition of these lines:

server 0.debian.pool.ntp.org iburst dynamic 
server 1.debian.pool.ntp.org iburst dynamic
 server 2.debian.pool.ntp.org iburst dynamic
 server 3.debian.pool.ntp.org iburst dynamic
 **server 127.127.28.0 minpoll 4 
fudge 127.127.28.0 time1 0.183 refid NMEA 
server 127.127.28.1 minpoll 4 
prefer fudge 127.127.28.1 refid PPS**

these specific loopback addresses allow ntpd to access the two shared memory segments provided by gpsd . The refid names are arbitrary, but descriptive, while the value for the time1 parameter − 0.183 − is to compensate for the offset of the NMEA 0183 signal. However, other systems will likely achieve better results with a slightly different value.

1 Like

@msadowski90
it works without thew ktimer-pps module;
in case device tree overlay is applied and configured with Jetson-io tool.
Could you confirm the UART NUMA RX/TX from SimpleRT2K generates NUMA sequence? that can be read from /dev/ttyTHS0?

Hi Andrey,

Sorry for the late reply, I didn’t login for quite a while. Do you mean NMEA messages? In my experiments I was connecting using USB (/dev/ttyACM0) and it was working OK with gpsd etc. One thing to keep in mind is that in Ublox UCenter you need to specify the messages that will be OK with the GPSD. For example if you use the Rover config from ArduSimple Github repo it won’t contain the correct sentences. The Base config will have one that should be usable out of the box.

thank you for following up!
yes, the issue seem have been resolved;
It turned out that pps-ktimer is not necessary for implemetnation of gps/ardusimple as long as gpio is configured. NMEA works not only through USB, but also via ttyTHS0.