BeagleBone Black RTC Wake Alarms

776 views
Skip to first unread message

darren....@gmail.com

unread,
Apr 21, 2016, 4:36:29 PM4/21/16
to BeagleBoard
I am trying to use power management (sleep mode) in a way that is similar to how Android does it with timerfd and epoll. I want to enable autosleep and use RTC wake timers (created using timerfd) that wake the system back up and prevent sleep mode (using epoll mechanism) until the timer event is handled and all wakelocks have been released again.

When I try using this approach, the wake timer created using timerfd does not wake the system (however, the rtcwake command does work). I'm not sure if this is supported by the BeagleBone kernel or not. I found the following code references from Linux 3.12 code, but appears to be replaced with dts and drivers/soc/ti/wkup_m3_ipc.c in Linux 3.14. Could there be something missing from arch/arm/boot/dts/am33xx.dtsi that would enable what I need?


Reference from 3.12 source:

struct wkup_m3_wakeup_src wakeups[] = {
    {.irq_nr = 35,  .src = "USB0_PHY"},
    {.irq_nr = 36,  .src = "USB1_PHY"},
    {.irq_nr = 40,  .src = "I2C0"},
    {.irq_nr = 41,  .src = "RTC Timer"},
    {.irq_nr = 42,  .src = "RTC Alarm"},
    {.irq_nr = 43,  .src = "Timer0"},
    {.irq_nr = 44,  .src = "Timer1"},
    {.irq_nr = 45,  .src = "UART"},
    {.irq_nr = 46,  .src = "GPIO0"},
    {.irq_nr = 48,  .src = "MPU_WAKE"},
    {.irq_nr = 49,  .src = "WDT0"},
    {.irq_nr = 50,  .src = "WDT1"},
    {.irq_nr = 51,  .src = "ADC_TSC"},
    {.irq_nr = 0,   .src = "Unknown"},
};


Environment
-----------------
3.14.55-ti-r78 kernel
Debian 8.3 filesystem
rtcwake command works successfully

William Hermans

unread,
Apr 21, 2016, 6:26:19 PM4/21/16
to beagl...@googlegroups.com
I can tell you that using kernel 4.1.x https://www.linux.com/learn/wake-linux-rtc-alarm-clock works. I'm not sure that rtc wake timer is related to the one you're asking. However, I can tell you that once the main am335x processor loses power, or the ability to act from being in sleep mode, the RTC on the processor die will no longer function correctly. There has been some discussion on these forums about this in the past, and I do believe there was actually an errata on this as well.

--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/23d3c790-6165-4920-a85f-47ae17c0cbb8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

William Hermans

unread,
Apr 21, 2016, 7:00:46 PM4/21/16
to beagl...@googlegroups.com
drivers/soc/ti/wkup_m3_ipc.c Also from memory has nothing to do with the rtc wakeup stuff. That actually is for  the PRU's or possibly other peripherals sharing the L3 interconnect fabric on the am335x processor.

Sorry, I missed that the first time I read your post.

darren....@gmail.com

unread,
Apr 22, 2016, 10:36:06 AM4/22/16
to BeagleBoard

On Thursday, April 21, 2016 at 6:26:19 PM UTC-4, William Hermans wrote:
I can tell you that using kernel 4.1.x https://www.linux.com/learn/wake-linux-rtc-alarm-clock works. I'm not sure that rtc wake timer is related to the one you're asking. However, I can tell you that once the main am335x processor loses power, or the ability to act from being in sleep mode, the RTC on the processor die will no longer function correctly. There has been some discussion on these forums about this in the past, and I do believe there was actually an errata on this as well.


I am just trying to put the system in the "mem" sleep/suspend state and have a timer wake the system back up. Using the rtcwake command (and "mem" mode) does work, but when I create a timer with timerfd (instead of using the /dev/rtc0 device directly like rtcwake does) it does not work. It seems like there might be a wake source or something missing.

francis ... @gmail.com

unread,
May 19, 2016, 1:05:51 PM5/19/16
to BeagleBoard, darren....@gmail.com
I am also looking for this functionnality for the kernel 3.8 or 3.14.

darren....@gmail.com

unread,
Jun 1, 2016, 9:40:24 AM6/1/16
to BeagleBoard, darren....@gmail.com
I discovered that a fix for the rtc-omap driver is missing in the 3.14.x-ti code. This was preventing alarmtimer and other devices from detecting rtc-omap as a valid wake-capable RTC... applying this patch fixed the issue for me.


Neilh

unread,
Aug 21, 2017, 7:05:44 PM8/21/17
to BeagleBoard, darren....@gmail.com
Just an FYI this worked for me on a BBG 4.4.68-ti-r108

$ sudo su
$ echo 0 > /sys/class/rtc/rtc0/wakealarm
$ echo `date '+%s' -d '+ 1 minutes'` > /sys/class/rtc/rtc0/wakealarm
$ echo standby > /sys/power/state
 (shutsdown to 0.02A then wakesup on deadline or any other event…)
Reply all
Reply to author
Forward
0 new messages