Rtc wakeup not happening in jetson tx2 4GB

Hi,
I am jetson Tx2 4GB custom board.

hwclock -s is working
hwclock -w is not working

ntp is working for both linux time and hardware time

hctosys is setting RTC1

we checked in both rtc0 and rtc1,in both case hardware time is not updated

also rtc1(tegra rtc,default rtc),wake up is not happening but rtc0(pmic rtc) wake is happening.

could you please help on this which rtc we should use.

Did you try below command? It will wakeup after 60 seconds.

sudo rtcwake -m mem -s 60

Hi ShaneCCC

Thanks for your reply.

We tried the command and this also using rtc0. So wakeup is happening.

We want to understand the behaviour:

  1. If we use rtc1(tegra rtc), wakeup is not happening
    e.x: sudo echo $(date ‘+%s’ -d ‘+ 1 minutes’) > /sys/class/rtc/rtc1/wakealarm and followed by “shutdown -h now” command
  2. by default rtc1 is set in kernel config file so hctosys is set as 1 for rtc1. If we do “hwclock -w” linux date has to set in rtc1 hardware which is not happening(checked in /sys/class/rtc/rtc1/date).

Please clarify the above 2 points.

Could you modify rtc0 in below files to rtc1 to try.

root@tegra-ubuntu:/lib/udev# grep -ir rtc0 .
./rules.d/50-udev-default.rules:SUBSYSTEM==“rtc”, KERNEL==“rtc0”, SYMLINK+=“rtc”, OPTIONS+=“link_priority=-100”
./hwclock-set:HCTOSYS_DEVICE=rtc0

Hi Shane,

Please find the below output. still i have issues on both point:

root@tegra-ubuntu:/home/ubuntu# date -s “2 OCT 2006 18:00:00”
Mon Oct 2 18:00:00 UTC 2006
root@tegra-ubuntu:/home/ubuntu#
root@tegra-ubuntu:/home/ubuntu#
root@tegra-ubuntu:/home/ubuntu#
root@tegra-ubuntu:/home/ubuntu#
root@tegra-ubuntu:/home/ubuntu# hwclock -w
root@tegra-ubuntu:/home/ubuntu# cat /sys/class/rtc/rtc1/date
2021-03-24
root@tegra-ubuntu:/home/ubuntu# cat /sys/class/rtc/rtc0/date
2021-03-24
root@tegra-ubuntu:/home/ubuntu# cat /sys/class/rtc/rtc1/hctosys
1
root@tegra-ubuntu:/home/ubuntu# grep -nir “rtc1” /lib/udev/
/lib/udev/hwclock-set:23:HCTOSYS_DEVICE=rtc1
/lib/udev/rules.d/50-udev-default.rules:11:SUBSYSTEM==“rtc”, KERNEL==“rtc1”, SYMLINK+=“rtc”, OPTIONS+=“link_priority=-100”
root@tegra-ubuntu:/home/ubuntu#

Have a try below command

sudo timedatectl set-ntp no 
sudo timedatectl set-time “2019-04-01 00:00”
sudo hwclock -w  

Hi Shane,

We able to see changes to hardware using timedatectl command as follows:

root@tegra-ubuntu:/home/ubuntu# timedatectl set-ntp no
root@tegra-ubuntu:/home/ubuntu# date
Sat Oct 2 19:56:46 UTC 2021
root@tegra-ubuntu:/home/ubuntu# timedatectl set-time “2019-04-01 00:00”
root@tegra-ubuntu:/home/ubuntu# date
Mon Apr 1 00:00:07 UTC 2019
root@tegra-ubuntu:/home/ubuntu# cat /sys/class/rtc/rtc1/date
2019-04-01
root@tegra-ubuntu:/home/ubuntu# cat /sys/class/rtc/rtc0/date
2019-04-01

Observations:

  1. hwclock -w is not required i think to have this working
  2. its setting in both rtc0 and rtc1.

No problem with above observation. 2nd issue is resolved. Thank you very much.

Issue still persists:

  1. If we use rtc1(tegra rtc), wakeup is not happening
    e.x: sudo echo $(date ‘+%s’ -d ‘+ 1 minutes’) > /sys/class/rtc/rtc1/wakealarm and followed by “shutdown -h now” command
    expecting in 1 min it has to wakeup but same is working with rtc0.

Does this command working for rtc0?

Yes Shane. Sorry for late reply.

Same example is working(waking up after shutdown) if we configure for rtc0(pmic rtc). But default rtc(rtc1- tegra rtc) is not working.

@Dhanaraj
Any reason must use RCT1 to wake up the system?

Hi Shane,

Because rtc1 only is configures as default and hctosys are set for rtc1 only. Thats what to avoid any problem I thought of using rtc1. Can I use rtc0 itself? No need of any other changes required in kernel config or other?

Current default is using rtc0 no need any change in kernel.