Synchronizing clock with a Jetson using NMEA (TCP) + PPS signal

I’m currently working on a Nvidia Jetson TX2 with Ubuntu 18, using an Emlid Reach GPS Module connected by USB and getting NMEA messages through a TCP connection plus a 1-PPS signal through a UART pin.

I’m not being able to correctly sync the system clock with the GPS clock.

I managed to correctly expose the PPS signal using a GPIO pin in the Jetson (recompiling kernel with proper flags), and obtained two linux devices: /dev/pps0 and /dev/pps1. pps0 corresponds to the Jetson kernel PPS and pps1 is the GPS PPS related to the GPIO pin in the board.

The GPS module is connected with a USB cable but provides data by creating a USB-To-Ethernet interface and responding on IP 192.168.2.15, TCP port for data acquisition is configurable and set at port 9001. The PPS signal is connected to the pin in the jetson.

My issue is that some gps+pps tools give me satisfactory results while others fail horribly.

Testing both pps signals:

 sudo ppstest /dev/pps0
 sudo ppstest /dev/pps1

Gives satisfactory results:

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

But the ppscheck tool doesn’t and fails with:

sudo ppscheck /dev/pps0
# Seconds  nanoSecs   Signals
PPS ioctl(TIOCMIWAIT) failed: 25 Inappropriate ioctl for device

gpsmon is able to get the NMEA data from the TCP connection but not the PPS, the PPS line remains blank with:

sudo gpsmon -D 5 192.168.2.15:9001:/dev/pps0
or
sudo gpsmon -D 5 192.168.2.15:9001:/dev/pps1

On the other hand trying to configure gpsd fails, and I’m getting:

sudo gpsd -D 5 -N -n tcp://192.168.2.15:9001
gpsd:INFO: launching (Version 3.17)
gpsd:IO: opening IPv4 socket
gpsd:ERROR: can't bind to IPv4 port gpsd, Address already in use
gpsd:ERROR: maybe gpsd is already running!

Using the GPS PPS signal, /dev/pps1 in those examples gives me the same results.

Is this the intended way of synchronizing clocks with the GPS Module?
Does anyone has some information on the proper way to configure gpsd to take NMEA data from the TCP connection + the device PPS signal?
Any information on that PPS “Inappropriate ioctl for device” error?

Thankss

1 Like

Hi, I got your PM too but since others may look for the same I thought I would post here to share it.
There are some differences in my setup. RPI for ones and second I used tx/rx serial for the nmea string. TCP/IP hardware of RPI didnt provide the speed needed to optain nanosecond syncronization.
I didnt run into your issue but recalled something like that beeing noted here under pnt.4

Could this be your case?

If not, I would try serial.
Btw. I do not use USB because M2 pulls to much current from the RPI unit which also produces alot of error.
Without a USB cable hack you can not power M2 from USB and Serial at the same time.

It might not look so, but this is my cleanest setup with least amount of error and highest accuracy

2 Likes

Nicee! I was following that HOWTO page and came across those notes on ioctl but as gpsd tools have support for tcp connections, I never figured that this may be the issue.

What is bugging me is that ‘ppscheck /dev/pps0’ seems a valid command but the ioctl(TIOCMIWAIT) is a required feature of the nmea data connection. How the ppscheck expects to have knowledge of where to find the serial nmea connection if it’s not in the arguments??:
https://manpages.debian.org/testing/gpsd/ppscheck.8.en.html

It sounds to me that using the TCP connection is not the usual intended way of doing the synchronization (there is actually very little information on internet about that). I will proceed in the direction of using a UART Tx/Rx connection.

Thanks!