Deep sleep & wake through GPIO and RTC

Kernel: Linux beaglebone 4.4.48-ti-r88 #1 SMP Sun Feb 12 01:06:00 UTC 2017 armv7l GNU/Linux
OS: Debian 8.1

In order to get a low-power board, I get sensors data every 10min and I need to sleep meanwhile.
I have an external RTC DS3231 with a SQW pin in order to setAlarm. I can plug it to a gpio and it changes its value when I want.

What I would like is:

  1. After the sampling, put the board in the highest low-power mode as possible (only the RTC running?)
  2. Let the RTC wakup from suspension changing the gpio pin value

I tried:

root@beaglebone:/# echo standby > /sys/power/state

The rtc set the gpio value from 1 to 0 but it doesn’t wakeup. I think because I don’t have the wakup option in /sys/class/gpio/gpio44/power. Right? How could I enable it?

Is there a way to close the 3.3/5V output to the sensor when the device is sleeping and reopen it after wakeup?

It this guideline still good for my beaglebone green wireless? It tells to set

echo uart0_rxd.gpio1_10=0x27,rising > standby_gpio_pad_conf

but If I would set gpio P8_12?
Something like:

echo something.gpio44=0x??, falling > standby_gpio_pad_conf

???

Some tutorials speak about a GPIO0 use for wakeup. Which is in our BB?

Is this the right way?

Thank you for the support :smiley:

If you want the lowest possible power usage from the beaglebone, and using something like, or akin to sleeping the system. You will need an external processor( low power MCU ) involved.

It would work something like this:

  • The beaglebone is completely powered down
  • the External MCU would toggle power, and reset lines on the beaglebone.
  • The beaglebone after boot through systemd would run a OneShot service.
  • This services calls a script that runs through a sequence of things it must do for a single time period. Lastly, the board powers down.
  • The MCU, has a timer loop than will toggle toggle the power and reset lines on the beaglebone every X time period.

While your at it, add psuedo watch dog functionality to your MCU, which basically you’ve already done by following the above proceedures. Add an I2C RTC to the board you made for this automated wake up system described above. As the onboard beaglebone RTC functions, but only while it has power.

So I’m a bit unclear what yo uwant a real time clock for. If it’s to keep proper time stamps on the beaglebone while logging, You do not need one. Part of your systemd startup service / script could call ntpdate to update the time from a atomic clock. IF the system has access to the internet.

If no internet, or you would like to keep time from the control MCU, Then one would probably need an external RTC. Which would complicate things a good bit, but is possible.

We’re looking for something less external mcu-based in order to exploit all the AM335x capabilities. I would prefer consume a bit more without making the project too complex with programming an external mcu :slight_smile:

I’m wondering if the BB offers a inner way to sleep/awake or at least the possibility to use the GPIO and the external rtc with the interrupt.
I’m trying rtcwake with ‘standby’ mode and it’s working quite good, but the best (imho) wat would be the ‘mem’ mode if it’s possible to wake it up with the rtc (rtc0 or rtc1).

I’m using an external RTC because I will have possible situations without the access to Internet, like you guessed.

If you leave out the need for an external MCU, the system will not be
robust, nor efficient.

I'm not saying what you want is not possible, I'm honestly not sure if this
is possible on this platform or not. More or less like it's possible and
most if not all X86 style systems. What I am saying is that if you rely
solely on the beaglebone, you're asking for trouble. For several reasons,
but for starters, there is no functional watchdog hardware module on the
beaglebone. Passed that, if the processor on the beaglebone has to be
active, but even in low power mode. The PMIC has to be active as well.
Comparatively, this will use a lot of power. Compared to something that was
specifically designed to use micro, or nano amps.

Those are just two reasons. There are many more reasons if you think about
it hard.

The AM335x platform already includes a Cortex M3 for exactly this purpose – a low power MCU that can be used to wake the system on certain interrupts (http://processors.wiki.ti.com/index.php/AM335x_Power_Management_Standby_User's_Guide#Linux_Implementation)

I don’t yet have the wakeup working on a 4.4.x kernel, but will post an update when I figure it out.

Davide – have you have any luck since posting this question?

Hi flyingfred0!
Not really; I haven’t investigated more about this problem…I’m using rtcwake at the moment but I would be glad if you find a powerful standby mode way.