We have two devices with NX. Each NX device controls its own camera via GPIO.
We would like to synchronize NX devices via PTP. After synchronization, we would like each NX device to send a pulse per second to its own camera.
Currently, we could synchronize two NX devices via PTP. Both system clocks are synced.
But we are trying to find a way to send a pulse per second to the camera via GPIO.
We tried a user-space program that will toggle a GPIO every second, but we see the pulses drift between two NX devices.
We also tried the sample kernel module, and we also see drift.
Jetson TX2 + PTP capture synchronization - Jetson & Embedded Systems / Jetson TX2 - NVIDIA Developer Forums
Is there any way to send these pulses so that is not dependent on software.(ie) similar to a hardware PPS pin ? Basically we would like to send a pulse per second very accurately to our cameras.
you might refer to
Jetson Xavier hardware pps_out - #16 by shgarg, which produce pps signals on GPIO.
it’s sample driver to feed pps signals in GPIO and capture timestamps to synchronize system every second.
Thanks, we executed the sample code. gte_mon
From the sample code and steps,
[we are toggling 40-pin header Pin 16 (gpio=256) and feeding signals to Pin 32(gpio=257) every 1 second.]
We understand that gte_mon monitors GPIO257.
GPIO256 is toggled per second via shell script. On each toggle, gte_mon registers the timestamp.
However, in our case, we want NX to send a pulse per second to an external peripheral. Please see the picture below,
In such a case, could you please let us know why to use gte_mon ? Because we can already toggle a gpio via shell script every 1 second.
We are searching for a way to generate this one second pulse via hardware control and not through software control as it depends on CPU scheduling.
There’s a kernel driver named “nvpps” that can generate the PPS signal on a GPIO pin from PTP. You have to enable the driver in the kernel config and add the gpio pin to the DTB.
Will explore and check out nvpps driver.
As of now, we found a way, (ie) using a modified PPS generator on GPIO. The code is available in the thread.
Just updating our findings here.
We checked the nvpps driver.
It appears the default nvpps driver code can have PPS input via GPIO in GPIO mode.
The code by default does not support PPS output on GPIO unless we modify the code.
We modified the nvpps driver code to generate PPS on GPIO in timer mode. The timer mode in nvpps driver is based on linux timer. And on each timer event, it reads the PTP time from PHC.
When two NX boards synced over PTP use nvpps driver, we could not get the PPS accurately.
We choose to use the GPIO PPS generator code and it is based on high resolution timer. We could get PPS accurately upto microsecond drift from two NX boards after they sync their system clocks over PTP.
Yeah, sorry about that. I had my directions mixed up.
We’ve had some discussions about this in the past.
I see PTP PPS output pin from RGMII in Jetson Xavier SOM Datasheet.
Flexibility to control the Pulse-Per-Second (PPS) output signal (ptp_pps_o)
but I can’t find this pin(or any reference to it) in punmux or in TRM
I need precise PPS signal from RGMII to synchronize other hardware.
and how is it supposed to be used?
In reference to this thread…
I’m trying to figure out exactly what the nvpps driver is supposed to do. I have the device tree set to route AON_GPIO DD-00 (40-pin header pin 27) to the driver and it creates /dev/nvpps0 but I’m not sure how to use it in relation to pps-gpio, ntpd and ptp4l.
From looking at the code, it looks like it’s supposed to synchronize the phc clock to the pps input but I’m not seeing how or where it’s used.
I do have AON_GPIO CC-0…
documentation on the page 25 refers to a feature ‘Precision Time Protocol (PTP)’ for System;
Could you explain what sort of feature, is it?
Will NX have any support of protocols:
IEEE 802.1 Time Sensitive Networking (TSN)?
IEEE1588v2 one-step Precision Time Protocol (PTP)?
probably it is gpio limitation, as frequency of the gpio would have very long delay not fitting precision of PTP standard?
Is the modified nvpps driver code available for review?
Please find the modified nvpps driver code for PPS out. nvpps_main.c (20.7 KB)
The macro PPS_OUT_MODE is set to 1 for activating the changes.
We toggle GPIO 408,
the device tree [tegra194-p3668-common.dtsi] is modified as
compatible = “nvidia,tegra194-nvpps”;
status = “okay”;
gpios = <&tegra_main_gpio TEGRA194_MAIN_GPIO(P, 0) 0>;
However the nvpps driver code is based on linux timer and jiffies. The drift in PPS between two boards is huge. Probably if we modify this, it may become closer.
@Srinivasan.Arvindh , can you please share the GPIO PPS Generator code which you used to acheive microsecond drift ? We are also trying to generate PPS from PTP.
@Srinivasan.Arvindh I’d be interested as well how you reduced the PPS drift to microseconds… Thanks!