RTC and Wakealarm problems

Dear Community;

I am trying to use the lp1 mode on the Apalis TK1. To enter in the lp1 mode I use this command:

echo mem > /sys/power/state

According to this tutorial I need to set up a wakealarm in order to wake up after some time. The first problem I have is that my rtc1 does not have a wakealarm function. So I have tried with rtc0 and rtc2 with baffling results.

echo +20 > /sys/class/rtc/rtc0/wakealarm

This command wakes up the TK1, but if I set more time (60s for example) to the wakeup it sleeps forever. The same happens if I use the rtc2.

The rtc time is keept with a coin cell. If I set the time using hwclock commnad I noticed that rtc0 and rtc2 lose the time every shutdown. On the other hand rtc1 keeps the time perfectly. The firts boot I set the time using this command:

timedatectl set-time "2019-09-21 12:21:12"
hwclock --rtc=/dev/rtc1 -w

However I can not keep rtc0 and rtc2 using that commands.

To sum up, I managed to set and keep rtc1 time succesfully, but not rtc0 and rtc2, and I can not wake up the TK1 if the sleep time is longer that 20-30s.

I don’t care about rtc0 and rtc2 time losing, rtc1 is enough, but I need to wake up the TK1 after long time periods (7200s).

If useful this is my dmesg | grep -i rtc output:

dmesg | grep -i rtc
[    0.530089] +V1.05_RTC: 1000 mV at 150 mA 
[    5.180799] as3722-rtc as3722-rtc.1: rtc core: registered as3722 as rtc0
[    5.189387] as3722-rtc as3722-rtc.1: RTC interrupt 449
[    5.199361] rtc-ds1307 0-0068: rtc core: registered m41t0 as rtc1
[    5.207802] tegra_rtc tegra_rtc: rtc core: registered tegra_rtc as rtc2
[    5.221345] tegra_rtc tegra_rtc: Tegra internal Real Time Clock
[    6.663221] as3722-rtc as3722-rtc.1: setting system clock to 2000-01-01 00:00:24 UTC (946684824)

Thanks in advance.

Hi,

Please, can anyone try if you face the same problem??

Thank you.

We’re not seeing that issue, I’ve successfully entered\exited lp1 for 60, 120 and 300 seconds.
BSP 2.8b3 is no longer supported please try with 2.8b5.

Thanks for your answer @dominik.tx ;

I have installed Nvidia JetPack instead of Nvidia Linux for Tegra (LT4). That way wake up function works perfectly. I don’t know which is the difference between Nvidia JetPack and Nvidia Linux for Tegra (LT4) that both are available to install from Easy Installer.

Thank you.

You are welcome. Thanks for the feedback.

The Nvidia Jetpack has lot of specific Scripts introduced by Nvidia, which may change the Startup of the module and also the behaviour of the RTC.

Best regards, Jaski

Thank you very much.

You are welcome.

This is very interesting, I have been dabbling with this too. Looking at /sys/class/rtc/, I see rtc0and rtc1. I am using a custom carrier board (with no RTC onboard). Looking at dmesg, rtc0 is using the as3722 driver and rtc1 is using the tegra-rtc driver.

Any idea what the two devices are? From the datasheet, it seems there is only one RTC on the SBC.

Hi @notthetup, thanks for trying something around this question.

It would be great to know something about what you said. Thanks again for your feedback.

For TK1, there is one RTC in the PMIC and another in the SoC. All of our Apalis carrier boards have another RTC on them. That gives you the 3 RTCs you see.

Thanks @dominik.tx.

From the Apalis TK1 datasheet, it seems that the RTC on the PMIC (I’m guessing that’s /sys/class/rtc/rtc0) is connected to the main power rail to the modules. So am I right to assume that will it will remain on during lp1?

Yes, LP1 won’t actually turn off any voltage supply rails at all so any and all devices including such RTC are still fully powered.

I am posting this only for global knowledge:

Does Nvidia Jetpack support LP0? If I run echo mem > /sys/power/state I get this output:

Warning: enabling a non-LP0 wake source 171

After resuming from sleep or after disconnecting the power supply of the TK1 only 1 RTC out of 3 keeps the time as you can see: (I have set all RTC to current date before the test.)

root@tegra-ubuntu:~# hwclock–rtc=/dev/rtc1 -r

Fri 05 Apr 2019 08:37:24 AM UTC -0.749035 seconds

root@tegra-ubuntu:~# hwclock --rtc=/dev/rtc0 -r

Sat 01 Jan 2000 12:00:41 AM UTC -0.523532 seconds

root@tegra-ubuntu:~# hwclock --rtc=/dev/rtc2 -r

Thu 01 Jan 1970 12:00:47 AM UTC -0.304680 seconds

Unfortunately we do not support LP0 suspend mode on TK1.