Tegra Tx1 set hwclock question

Hi all
I have some question about set hwclock time on Tegra Tx1,
test1:
I use date command to set time on the terminal
sudo date -s “2017-3-7 10:10:10”
sudo hwclock -w
reboot
then, time set is success.
test2:
sudo date -s “2000-1-1 10:10:10”
sudo hwclock -w
reboot
date set failed. date change to “2016-2-11 16:28:26”, set time cannot less than “2016-2-11 16:28:26”.
watch hwclock time
hwclock -D
the hwclock time is “2013/01/01 00:00:26”
ps:
on the other board ,perform some tests ,test1 settime success, test2 setting time change to “2017-2-27 ::", set time cannot less than "2017-2-27 ::”.
anyone can help?
thankyou

Hi there
The RTC chip on TX1 is Max77620 and the year REG only can present 0 - 99 so suppose it range is from 2001 - 2100

You can also check the rtc driver …/kernel/drivers/rtc/rtc-max77620.c

Hi ShaneCCC
thanks for you reply.
I set date time such as
date -s “2011-1-1 12:12:12”
then hwclock -w
reboot
then,I still cannot set success. do you meet such phenomenon at your board?
I still novice , I also need to take some time to read rtc driver,
by the way how can I get you attach a document.
thank you .

Hi linwen
Could you try to modify the tegra21_default like below.

CONFIG_RTC_BACKUP_HCTOSYS_DEVICE=rtc0
CONFIG_RTC_HCTOSYS_DEVICE=rtc1

Hi ShaneCCC
Thanks for your reply.
I according to your tip modified kernel config file:/arch/arm64/configs/tegra21_defconfig,Generate a new kernel to replace the old version,then it’s still has same phenomenon , time setting early 2016-2-11 cannot success.
I use this command “cat /var/log/kern.log | grep rtc”.
The following is its output:

vdd-rtc:850 mV with ramp delay 100000 uV/us ; Rail ON
max77620-rtc max77620-rtc.1: rtc core: registered max77620-rtc as rtc1
tegra-rtc 7000e000.rtc: rtc core: registered tegra-rtc as rtc0
max77620-rtc max77620-rtc.1: rtc_set_time: tm: 70-00-01 00:00:21, wday=4
max77620-rtc max77620-rtc.1: rtc_tm_to_reg: Invalid year, 70
max77620-rtc max77620-rtc.1: rtc_set_time: Failed to convert time format into register format
/home/sh/kernel-r24.2/kernel/drivers/rtc/hctosys.c: Ingnoring backup rtc device (rtc0)
max77620-rtc max77620-rtc.1: setting system clock to 2010-01-01 01:02:00 UTC (1262307720)

I found that the hardware time have update to 2010-01-01, but the system time change into the 2016-2-11.
do you have some advices?
thank you .

Hi linwen

This is specific to Ubuntu-16.04.

I tried to find official link for this info, but couldn’t found. We verified on other Ubuntu-16.04 machine, there also it sets “2016-2-11” if we try to set less than this.

If the system time mysteriously corrects itself, then you are probably seeing the Network Time Protocol service (NTP). See:
https://help.ubuntu.com/lts/serverguide/NTP.html

NTP is not specific to Ubuntu or Jetsons, even Windows uses this. Admin of NTP services will differ among operating systems.

Hi linuxdev
This test set the “Time&Date” to Manually mode or disable the LAN first. So it could’t be the Network Time service cause it.

I have same trouble.
I’m using many TX1s.
Some of them cannot remember time.

VDD-RTC (Backup Battery) : over 3.0V.

Reboot : TX1 remember time.
Power Off/On : TX1 forget time.

I set time with following command.

sudo hwclock --set --date “13 Jul 2017 18:49”

sudo hwclock -w

sudo hwclock -s

after reboot

Jul 13 21:01:10 tegra-ubuntu kernel: [ 2.454672] vdd-rtc: 850 mV with ramp delay 100000 uV/us ; Rail ON
Jul 13 21:01:10 tegra-ubuntu kernel: [ 8.704490] max77620-rtc max77620-rtc.1: rtc core: registered max77620-rtc as rtc0
Jul 13 21:01:10 tegra-ubuntu kernel: [ 11.484086] max77620-rtc max77620-rtc.1: setting system clock to 2017-07-13 21:01:08 UTC (1499979668)

after power off/on

Jan 1 00:00:02 tegra-ubuntu kernel: [ 2.454992] vdd-rtc: 850 mV with ramp delay 100000 uV/us ; Rail ON
Jan 1 00:00:02 tegra-ubuntu kernel: [ 8.706311] max77620-rtc max77620-rtc.1: rtc core: registered max77620-rtc as rtc0
Jan 1 00:00:02 tegra-ubuntu kernel: [ 11.540027] max77620-rtc max77620-rtc.1: setting system clock to 2013-01-01 00:00:00 UTC (1356998400)

drivers/rtc/rtc-max77620.c set 2013-01-01 00:00:00.

I think this issue is caused by TX1 hardware problem.

ShaneCCC
How do you think about it?

@kousukes
Does your kernel config follow the #4? What’s result if not?

Hi, ShaneCCC

Thank you for your reply.

I checked my config.

It is set to
CONFIG_RTC_HCTOSYS_DEVICE=rtc0

I’ll try to set
CONFIG_RTC_BACKUP_HCTOSYS_DEVICE=rtc0
CONFIG_RTC_HCTOSYS_DEVICE=rtc1

BTW, could you tell me what the config change means?

@kousukes
enable below config to register tegra-rtc as default rtc
CONFIG_RTC_BACKUP_HCTOSYS_DEVICE=rtc0
CONFIG_RTC_HCTOSYS_DEVICE=rtc1

@ShaneCCC, Sorry for late reply.
Thank you.

Other machines use same “CONFIG_RTC_HCTOSYS_DEVICE=rtc0” setting.
They don’t have problem.
Do you think I should change config?

Thanks, BR,

@kousukes
Should be good to change the config for your case.

Hi,

I also have the same issue.
@ ShaneCCC : if we update Ubuntu to latest version does this get resolved.

Thanks,
Nikhil N

In our case, RTC use coin battery.
So we need to change device tree parameter.

Thanks for reply Kousukes,

can you please let us know how you mounted a coin battery?
I guess there is no provision for coin battery in TX1, correct me if wrong.
To give a background I am from Mechanical background trying to sort certain issues in existing Equipment with basic knowledge I have.
If you did it in TX1 can you please provide the details.

Hi nikhiln,

We use our original carrier board for our product.
If you want to use coin battery, I think you need to use special carrier board.

Can you please let us know where we can connect the carrier board to TX1.
Sorry if the question is too elementary, hope you understand.

Hi nikhiln,

What carrier board do you use?
We don’t use developer kit board.
My"carrier board" means motherboard for TX1.

Does it make sense for you?
(Sorry, my explanation is also poor.)