Setting system time at startup

Please provide the following info:
Hardware Platform: DRIVE AGX Pegasus™ Developer Kit
Software Version: DRIVE Software 10
Host Machine Version: native Ubuntu 18.04
SDK Manager Version: 1.0.1.6343

Hello,

we are not sure on how to set up the system such that our work pipeline can function. We have studied the according chapters of the documentation (setting the RTC dongle, setting Aurix time, synchronizing the SoCs and Aurix) and related inquiries of others without being able to find some method that suits us.
Ideally, we want to set the system time across all components of the DRIVE to a time we obtain via GPS, which is connected over Ethernet. We have developed a program that sets the Linux timestamp upon obtaining GPS signal, but on the DRIVE the Aurix MCU is the time master and overwrites our time stamp in an instant. With gptp turned off on Aurix, the Linux system time cannot even be set.
We can set the RTC dongle time with the provided script nv_rtc_sync.sh and altering the predefined google time server to our GPS, but the Aurix only accepts its time after a system restart, which is not acceptable.
We can set the Aurix time via the date command via USB connection, but this is not something that is desirable, and even a workaround like accessing the Aurix via a Xavier over USB is not something we particularly desire, as it defeats the purpose of the architecture of the DRIVE.
Ideally, we would like to either conveniently set the Aurix time without needing a undesirable workaround or a restart, or have an option to keep the Aurix MCU out of the loop concerning time synchronization.
There is a section in the documentation discussing synching one Xavier with the other, but we do not understand how this is even meaningful when the Aurix retains Master functionality in any case.

Thank you in advance for your help.

Just to follow up on our post here, we solved our problem. The problem was not the Aurix overriding the time, but the PTP HW controller (PHC). If you disable nv_ptp4l.service and nv_phc2sys.service by using the command “systemctl disable nv_ptp4l” and for the other service likewise, you can then set the Linux system time however you want. After that, you can enable the services again.
If you do this on Tegra A, the added benefit is that Tegra B will be synchronized after a short while automatically, unless you switched their Master-Slave relationship.
We worried since the MCU controls cameras, that the video frame timestamps might be wrong, but both for recording and live feed this was not the case with us.

We hope that helps some other developers.

Hello @josua.zscheile,

I believe that the reason you could not change the time on XavierA is that the system time got overwritten by phc2sys which sources its time from the ptp4l with a command like the following
-s /dev/ptp0 -c CLOCK_REALTIME

You can turn phc2sys around(-s CLOCK_REALTIME -c /dev/ptp0) on the Xavier which you want it to be the gPTP master so the clock relation would be GPS → CLOCK_REALTIME → PTP
and by doing that you don’t need to change anything on the other Xavier which is gPTP slave, on that Xavier the clock relation remains PTP → CLOCK_REALTIME

and now you have(if XA is gPTP master): GPS → XA (CLOCK_RT) → XA (PTP) → XB (PTP) → XB (CLOCK_RT)
so everything sync up nicely to the GPS UTC time.

to do that you can change the PTP service script (/etc/systemd/scripts/tegra_ptp.sh) at line 80:
replace the line:
$PHC2SYS -q -s /dev/$node -c CLOCK_REALTIME -w -S 1.0 -O 0 > $PHC2SYS_SAVE_LOG 2>&1 < /dev/null &
with:
$PHC2SYS -q -c /dev/$node -s CLOCK_REALTIME -w -S 1.0 -O 0 > $PHC2SYS_SAVE_LOG 2>&1 < /dev/null &

Note: Choosing Xavier as PTP clock master instead of Aurix has no impact on image acquisition.

How about the RTC module, any relationship? seems that It will take effect on XA (CLOCK_RT).
Some refer: Time synchronisation using RTC and PPS module

Hi @GaryChan35,

Please help to create a new topic linked to this topic and any other topics you referred to. Thanks!