RTC(real time clock) in drivepx gets reset after system reboot

Hi,

Looks like there are two RTC’s in my drivepx.

rtc0 is max77620 on an I2C
rtc1 is internal tegra c2a0000.rtc

When I set the rtc0 using “hwclock --systohc” it gets set correctly to the current system time. AFter reboot, it gets reset back to a old time.

RTC should be persistent across reboot. Any comments will be helpful.

Thanks
Anup

Dear anup.pemmaiah,

Could you please refer to below procedure for DPX2 time sync? Thanks.

Step 1 : Boot the target and connect to Aurix from putty or minicom. Set Aurix time (Note: Aurix needs Unix Hex time, you can get current Unix Hex time from http://www.epochconverter.com/hex)

Shell> date 0x5881877A
Check if the command took effect.
Shell> date
0x5881877B

Step 2 : start ptp service from Aurix console
Shell> gptpon

Step 3 : change time zone on target to GMT (click the time string on the upper right corner of your desktop, and change time zone to GMT. Double check with linux command: date)
nvidia@tegra-ubuntu:~$ date
Sun Feb 14 14:50:02 GMT 2016

Step 4 : stop NTP service and sync target time to Aurix time on target
nvidia@tegra-ubuntu:~ sudo timedatectl set-ntp 0 nvidia@tegra-ubuntu:~ cd /home/nvidia/drive-t186ref-linux/samples/nvavb/daemons
nvidia@tegra-ubuntu:/home/nvidia/drivet186ref-linux/samples/nvavb/daemons$ sudo ./phc2sys -s /dev/ptp0 -w &
nvidia@tegra-ubuntu:/home/nvidia/drive-t186ref-linux/samples/nvavb/daemons$ sudo ./ptp4l -f ./gPTP.cfg -p /dev/ptp0 -i eth0.200 -s -m -D -l 7

Step 5 : review the time setting on target
After 2-3 minutes, terminate the ptp4l application by enter CTRL-C and enter the following command to show HW timestamp
nvidia@tegra-ubuntu:/home/nvidia/drive-t186ref-linux/samples/nvavb/daemons$ sudo ./phc_ctl /dev/ptp0 get
Show Linux system time
nvidia@tegra-ubuntu:/home/nvidia/drive-t186ref-linux/samples/nvavb/daemons$ date

Hi Steve,

Really appreciate your response. I tried the steps that you clearly outlined above. But, still facing some issues.

Was able to set the correct time in Aurix. The target is Tegra-a and interface eth0 is not connected to any network. Interface enp3s0 gets connected to external network intermittently and during this step both interfaces was not connected. To do step 4, should any of the interface be connected to external network, I assume NO, because we are just sync’g with Aurix right?

In step-4 “sudo ./ptp4l -f ./gPTP.cfg -p /dev/ptp0 -i eth0 -s -m -D -l 7” was just displaying “port 1: delay timeout”.

As per my understanding, since it is suppose to sync with Aurix, I used interface eth0.200 for the next try. “sudo ./ptp4l -f ./gPTP.cfg -p /dev/ptp0 -i eth0.200 -s -m -D -l 7”. This sync’d the time and was able to see the correct time when I did “sudo ./phc_ctl /dev/ptp0 get” and using date.

$./phc_ctl /dev/ptp0 get
phc_ctl[5255.526]: clock time is 1520542668.412596911 or Thu Mar 8 20:57:48 2018

$date
Thu Mar 8 20:57:54 GMT 2018

But, the time was was not persistent across reboots on the target. After reboot, it gets reset.The AURIX time still looks fine.

sudo ./phc_ctl /dev/ptp0 get
phc_ctl[45.385]: clock time is 0.000000000 or Thu Jan 1 00:00:00 1970

$ date
Thu Feb 8 19:12:26 GMT 2018

Do I have to re-sync everytime the target is rebooted?

Your comments will be very helpful

Hi,

Have a question regarding setting the Drive-pX system clock

The Aurix clock drifts over time. I am looking at solutions to how to keep the Aurix clock in sync? Is it possible to sync it through network?

Any comments will be helpful.

Thanks
Anup

Dear anup.pemmaiah,

Thank you for your checking “sudo ./ptp4l -f ./gPTP.cfg -p /dev/ptp0 -i eth0.200 -s -m -D -l 7”

Unfortunately there is no RTC on DPX.
So it need to re-sync everytime the target is rebooted. Thanks.

Hi Steve,

Thank you for your response. I understand the target(tegraA or tegraB) needs to be re-synced with the Aurix(master clock) after reboot. Just to make sure I understood, are you also saying that there is no way to keep the Aurix clock itself in sync and not to drift either through network or GPS etc? So, when we powercycle the entire DrivePX or when Aurix clock drifts over time, is the only way to sync the Aurix clock is by manually setting the current time using the Aurix serial console? The reason I am asking is, we are syncing our target(Tegra or b) with the Aurix clock, but during drive-px power cycle or after few hours the Aurix clock itself would have drifted off from the actual time.

Anup

Dear anup.pemmaiah,

Can I know how far is the clock drift off from the actual time? Thanks.

Hi Steve,
Over two days it drifted more than an hour. Also, if we powercycle the DrivePX, the Aurix clock gets reset to some preset time, in my case it is Feb 8th, not sure where that comes from. We often power cycle the system, and the clock getting reset is a bigger issue than the drift.

Anup