RTC Wakeup

Ubuntu

  • Operation confirmed with testing in our XU4/HC1/HC2 on 4.14.0 and 49.47-58 and 3.10.106-146.

You can turn on your ODROID-XU4/HC1 when the specific time using HW RTC(Real Time Clock) on your ODROID board.
The RTC Backup Battery must be connected to ODROID.

0. Update your kernel

The kernel version must be higher than 4.9.47-58 or 3.10.106-146.

$ sudo apt-get update && sudo apt-get install linux-image-xu3
$ reboot

1. Setup timezone / Sync system time with NTP

  • If the ntpdate command doesn't work, try it again after stopping the ntp service.
$ sudo service ntp stop
$ sudo ntpdate ntp.ubuntu.com
$ sudo service ntp start
$ sudo dpkg-reconfigure tzdata
$ sudo apt-get install ntpdate
$ sudo ntpdate ntp.ubuntu.com

2. Update HW clock

$ sudo hwclock -w
$ sudo hwclock -r && date
Tue Sep  5 11:45:21 2017  .455163 seconds
Tue Sep  5 11:45:22 KST 2017
# The results of two lines should be almost same.

3. Setup wakealarm

$ echo 0 | sudo tee /sys/class/rtc/rtc0/wakealarm
$ echo `date '+%s' -d '+ 1 minutes'` | sudo tee /sys/class/rtc/rtc0/wakealarm
 
# Check if "alarm_IRQ" appears to "yes".
$ cat /proc/driver/rtc
rtc_time	: 02:45:30
rtc_date	: 2017-09-05
alrm_time	: 02:46:28
alrm_date	: 2017-09-05
alarm_IRQ	: yes
alrm_pending	: no
update IRQ enabled	: no
periodic IRQ enabled	: no
periodic IRQ frequency	: 1
max user IRQ frequency	: 64
24hr		: yes

4. Test

$ poweroff

Then, your ODROID will turn on after 1 minute automatically.

Android

Test

root@odroidxu3:/ # echo +30 > /sys/class/rtc/rtc0/wakealarm
[  283.803585] [c1] s2m_rtc_read_time: 2018/7/11 5:48:28(3)
[  283.809178] [c1] s2m_rtc_read_time: 2018/7/11 5:48:28(3)
[  283.813045] [c1] s2m_rtc_set_alarm: 2018/7/11 5:48:58(3)
[  283.818640] [c1] s2m_rtc_stop_alarm: 2018/7/11 3:21:43(3)
[  283.827127] [c1] s2m_rtc_start_alarm: 2018/7/11 5:48:58(3)
root@odroidxu3:/ #