Getting your Trinity Audio player ready...
low power modes

Now a day, conserving energy and extending battery life is more important than ever, especially for the embedded devices and systems. To achieve this, a very effective way is to take advantage of low power modes. In this blog post, we will take a deep dive into how to manage power through various low power modes. And provide suggestions to boost the energy efficiency.

Understanding MCU Low Power Modes

What are the low power modes? Most ARM based MCUs provide three key low power modes: Sleep, Stop, and Standby. Each mode is designed for a specific purpose. The low power modes affect power consumption in distinct ways.

1.1 Testing Consumption in Low Power Modes

Now we have learned about the three low power modes. So let’s check the efficiency of these modes. Let’s have the STM32F103C8T6 development board and the energy calculator, and test the power consumption. Then we get the summary of the results:

  • Without RTOS
    • Running Mode: When the device is in the running mode, the current is 29.16mA.
    • Sleep Mode: When the device is in the sleep mode, the current is 7.68mA.
    • Stop Mode: When the device is in the stop mode, the current is 4.89mA.
    • Standby Mode: When the device is in the Standby mode, the current is 4.91mA.
  • With RTOS
    • Running Mode: When the device is in the running mode, the current is 29.37mA.
    • Sleep Mode: When the device is in the sleep mode, the current is 6.77mA.
    • Stop Mode: When the device is in the stop mode, the current is 4.83mA.
    • Standby Mode: When the device is in the Standby mode, the current is 4.89mA.
Testing environment

STM32F103C8T6 dev board & engergy calculator

Without RTOSWith RTOS
No Instructions 6.36mA
Running mode 29.16mA 29.37mA
Hard fault 15.87mA
Sleep mode 7.68mA 6.77mA
Stop mode 4.89mA 4.83mA
Standby mode 4.91mA 4.89mA
Current for low power modes

Although the rest results are different from the datasheet values. Because the electronic components on STM32F103C8T6 will increase the overall energy consumption. But the test results still make sense.

1.2 Testing results Conclusion

Here we get the test results, and we can also get the conclusions as follows:

  • Sleep Mode: When the STM32F103C8T6 goes into the sleep mode, it saves up to 73.7% energy.
  • Stop/Standby Mode: When the STM32F103C8T6 goes into the stop or standby mode, it saves up to 83.2% energy.

That’s to say, when the devices go into the stop or standby mode, it saves the greatest energy.

1.3 MCU Behavior in Low Power Modes

Also, let’s find out the behavior between each mode:

  • Sleep Mode: The core remains active and responds to interrupts or events, including the sysTick interrupt. That’s to say, the real time os is scheduled normally. So the sleep mode is suitable for devices that need to remain responsive.
  • Stop Mode: The core can be woken up from Stop mode via an external interrupt on a GPIO line. This mode is ideal for devices that require an external trigger.
  • Standby Mode: The core is reset after waking up. It’s similar to pressing a wake up button. If the device can fully restart, this mode is useful.

1.4 Recommendations for MCU Designs

We undestand the energy efficiency and behavior of low power modes. Then we recommend:

  1.  Interactive Devices: When developing devices that require user interaction (such as devices with serial ports), it is recommended to enter sleep mode. It make sure of the responsiveness and save the energy.
  2. Interrupt Driven Devices: When developing a device that is activated by an external interrupt (such as a button press), it is recommended to enter stop mode. It saves power and responds quickly to triggers.
  3. Power Management: In addition to entering low power mode, make sure the inactive modules are turned off.
  4. RTOS Usage: The difference in power consumption between devices with and without an RTOS is minimal. However, a device with an RTOS will result in a more manageable and portable coding.

2 Exploring Linux Low Power Modes

Linux is the most efficient and powerful embedded system. And the Linux supports several low power states to reduce system activity when not in use. And these states are Suspend to Idle, Suspend to RAM, and Hibernation.

2.1 Consumption Testing in Low Power Modes

Now that we understand Linux’s low power states. Let’s make clear the efficiency of these Linux modes. Here we test with a Linux board and an energy calculator. And we get the following results:

  • Running (no CPUIDLE): When the Linux board keeps in the running state withou cpu idle, the current is 188.76mA.
  • Running (with CPUIDLE): When the Linux board keeps in the running state with cpu idle, the current reduces to 187.94mA.
  • Suspend to Idle: When the Linux board goes into the suspend to idle state, the current reduces to 131.44mA.
  • Suspend to RAM: When the Linux board goes into the suspend to RAM state, the current reduces to 200.14mA.
Testing Env
Running (no CPUIDLE)Running (CPUIDLE)Suspend to IdleSuspend to RAM
188.76mA 187.94mA 131.44mA 200.14mA

2.2 Linux Behavior in Low Power States

And also, let’s find out the behavior between each states:

  • CPUIDLE: In CPUIDLE state, the Linux device works as usaul.
  • Suspend to Idle: In SUSPEND TO IDLE state, the Linux device will not resume until the power button is pressed.
  • Suspend to RAM: In theory, the device should save power in this state, but in practice on our test board, the current increased by about 2mA in this state. This suggests that there may be a problem with its implementation.

2.3 Recommendations for Linux Devices

Now we know the energy efficiency and behavior of Linux low power states. Then we recommend the following approaches for the Linux devices:

  • Enable CpuIdle: When developing the Linux devices, it’s good to enable cpu idle. It saves the energy.
  • Always Active Devices: When developing the Linux devices that need to be responsive to the user at all times, entering low power mode is not recommended as it may affect performance.
  • Trigger Based Devices: When developing the Linux devices that respond to interrupts, it is recommended to enter a low power mode as this can effectively reduce energy consumption.

3 Power Management in Android Systems

What about the Android devices? The Android devices use the System Suspend service to manage power, which is based on the Linux low power states. For the Android devices, we test and get the following results:

  • Running: When the Android device is in the running state, its current is 222mA.
  • Suspend to Idle: When the Android device is in suspend to idle state, its current is 81mA.
  • Suspend to RAM: When the Android device is in suspend to RAM state, its current is 45mA.
RunningSuspend to IdleSuspend to RAM
222mA 81mA 45mA
current for Android

Now we understand the energy efficiency of the Android devices. So we can find out:

  • Suspend to Idle: When the Android devcie goes into the suspend to idle state, it saves up to 63.5% energy.
  • Suspend to RAM: When the Android devcie goes into the suspend to RAM state, it saves up to 79.7% energy.

Therefore, we suggest: please keep the Android’s System Suspend service to manage power.

4 Summary

We have go through the embedded devices, Linux devices and the Android devices. We can get the recommands:

  • Embedded Devices: please make use of idle hooks and low power modes, to save energy.
  • Linux Devices: please enable the CPUIDLE and suspend configurations, to boost the energy efficiency.
  • Android Devices: please keep the Android’s System Suspend service, to manage the power.

References

https://www.st.com/resource/en/datasheet/stm32f103c8.pdf

https://www.kernel.org/doc/html/v5.0/admin-guide/pm/sleep-states.html#system-sleep-states

https://www.kernel.org/doc/html/v5.0/admin-guide/pm/cpuidle.html

https://source.android.com/docs/core/interaction/sensors/suspend-mode

https://source.android.com/docs/core/power/systemsuspend

Thanks for reading!!

To learn more about Engineering topics visit – https://engineering.rently.com/

Get to know about Rently at https://use.rently.com/