Does the rtc on rockpi4 support wakealarms

It’s nice to have a RTC on the Rockpi4, but it does not seem to support wakealarms.

It is possible to set the alarm with

date -d "tomorrow 08:00" '+%s' > /sys/class/rtc/rtc0/wakealarm

but this does not seem to have any effect. Is this a hardware limitation (i.e. is the IRQ-line of the rtc-chip connected) or something missing in the driver?

1 Like

The hardware should have the ability to power on with alarm. Check the schematic and the datasheet of pmic rk808, there are three condition to trigger the boot:

  • EN singal from low to high
  • EN is high and RTC alarm IRQ triggered
  • EN is high and PWRON button is pressed

@Stephen could you look at it?


I have tested the RTC wakealarms, and I find it works.


Use system image, rockpi4b-ubuntu-bionic-minimal-20190104_2101-gpt.img

Install and update these packages from left to right: rockchip-fstab, rockchip-overlay, u-boot, kernel, rockpi4-dtbo.

And install mate desktop (you can install other desktop)

sudo apt-get install ubuntu-mate-core  
sudo apt-get install ubuntu-mate-desktop


To test rtc wakealarm, execute commands at the terminal

$ date -d "today 20:26" '+%s' | sudo tee  /sys/class/rtc/rtc0/wakealarm

Click ‘suspend’. Or $ echo mem | sudo tee /sys/power/state

After the above operation, the red system led and desktop is off.

When it is 20:26, the system runs again. Red led is flashing and desktop is on.



thanks for this info. I didn’t even know that suspend works, I will try this with my setup (Armbian headless). Nevertheless, have you tested the wakealarm with a real shutdown (halt -p) as well? Suspend is fine, but requires constant power supply. In contrast, after shutdown the RTC backup battery should keep the alarm-time in the registers of the RTC.

Another question: I read the datasheet of the pmic. Is it correct that the registers of the RTC are accessible using I2C?

Best, Bernhard

Somehow, the shutdown wake alarm is not working yet.

Yes, the RTC registers are all accessible via I2C, you can just dump it. Go ahead and debugging :smiley:

I remember seeing option to turn on RockPi without replugging power after shutdown with GPIO, but now can’t find it, can anyone provide information on it?

1 Like

@jack sorry to ping you, but I’m unsure maybe i heared it from another place and spread wrong info. Were there any experiments with turning rock pi on without replugging power supply?

RTC alarm should do that but we haven’t tested it so far. As @Stephen explained above, only works in suspend mode currently. The other way is to assert the power_on signal several seconds with DC on to start booting, but we don’t have power_on signal exported on the GPIO header.

I don’t think RTC will work for me since time i need to turn RockPi4 on highly varies, but i will see. Thank you for answering

The capability to suspend to RAM and wakeup on an RTC alarm is working great on my Rockpi4 :slight_smile:
If I understand correctly, it is not possible to wake up the board from shutdown mode with an external signal (GPIO header does not expose it), but is it possible to get out of suspend mode from an external signal?

You are right. The hardware design doesn’t support power up from shutdown.

I think it’s possible to wake up from suspend mode with external interrupt but I haven’t tried. Maybe @Stephen have some ideas?

1 Like

@Stephen, sorry for ping, but I’m still interested in any other way go wake up RockPi from suspend mode other than wakeup alarm, any information on this?

1 Like

Hello, I am using the Rock Pi Penta SATA HAT kit with a real time clock (because it does not support wake on LAN). It is running on Armbian 21.02.2 and has OMV installed.
systemctl suspend
does not reliably suspend the Rock Pi. First the fan is starting to run at full speed, then it might suspend or not, i.e. the fan just continues to run at full speed. It also has the tendency to start up again in less than a minute.
date -d “today 20:26” ‘+%s’ | sudo tee /sys/class/rtc/rtc0/wakealarm
seems to work, but a lot of times the system is already up and running again before the wakealarm is executed.
echo mem | sudo tee /sys/power/state
also does not suspend the system.

What needs to be done to reliably suspend the system and that start it up with wakealarm?
Thanks in advance!

Since I got tired of wakealarms, because of needing to plan before hand when i will need my NAS - maybe my advice will help, if you are looking for not fully suspend (i.e. deacrese electricity consumption to minimum watts amout) and you wanna to stop noises coming from nas:

Create a bash script that will spindown HDD and stop fan and add it to cron (with stopping all the services that may spin them back, like deluged or find checks) and create script that should spin them all back, in case of smb - it will spin drives back on access, so you will always have access even in the middle of the night, and fan with services could be added to cron job

Of course wakealarms are not ideal, if you nee to use the system at other times, but why does the RockPi 4c behave like that if the the penat SATA hat is attached?

Well, in case of Fan - it’s because there still voltage on GPIO, so it’s race between stop script and suspend. (my guess).
In case why it’s wakes up soon after -

Well, this one is strange, because for me it’s always working for suspend

Sorry, it suspends the system, but with the HAT on it soon starts again.

I was trying to suspend / wakeup my RockPi 4c. Here’s what I found (Armbian buster 5.10.16):

I can suspend it with echo mem | sudo tee /sys/power/state or by using the Suspend button on the UI.

But I can’t wake it up again.

date -d "today 20:26" '+%s' | sudo tee  /sys/class/rtc/rtc0/wakealarm

does not work, or pressing keys on the keyboard doesn’t work either. I have to power it off…

Any ideas, why I can’t wake it up again? What OS are you using?

Thanks for your help.

Ok, I tried the wakeup from suspend with
This has kernel 4.4.x in it.

Now, does anybody know if it is the 4.4 kernel, that makes it work, since with armbian buster 5.10.x it doesn’t work, or is there a module in Armbian with kernel 5.10 so that it would also work?

Thanks for any hints.