5 Practical Tips for Low-Power Design

In our daily lives, computer technology has entered almost every niche market, whether at home, in the office, or even in your garden. We rely on these technological innovations more than we realize.

While you might think that low-power design is only crucial for battery-powered devices, the sheer number of devices connected to the grid can lead to 10-15% of the electricity generated in the U.S. being wasted each year. Therefore, designing low-power embedded systems is essential for maximizing battery life and reducing grid pressure (not to mention the environmental impact). This article will explore practical tips for low-power design to help you develop energy-efficient embedded systems.

5 Practical Tips for Low-Power DesignMeasure Early and Often

It’s wise to get an embedded system working first and then go back to optimize the code and energy usage. If you can’t make the product meet customer needs, then the time spent on optimization might be a waste.

However, I find that when it comes to energy usage, it’s usually better to start measuring your consumption early and often to understand how your system’s energy consumption behaves during execution.

I emphasize measuring early and often because once you discover if the design is going in the wrong direction, it’s easier to make adjustments or small course corrections.

For example, a few years ago, I was working on a battery-powered medical sensor that had a hard requirement for a 14-hour battery life. Therefore, early in the development cycle, I began measuring energy usage and discovered two things. First, the chosen battery was insufficient for the application due to aesthetic reasons; second, our chosen software architecture was inadequate to meet the energy requirements.

By knowing this information early, we could adjust the software architecture without having to rewrite the entire project. Understanding the battery’s limitations also allowed us to make slight adjustments to the hardware to improve its energy profile, and by the end of the project, we successfully achieved the operational lifespan between two charges. If we had waited until the end, I believe the product would have needed at least six months to redesign, which could have cost them the business.
5 Practical Tips for Low-Power DesignThe Choice of Microcontroller Is Not as Critical as You Think

A few years ago, there was a war among chip suppliers to achieve the lowest power sleep states in microcontrollers. One supplier claimed they could achieve a sleep current of 100uA. Another claimed they could reach 50uA. Suppliers increased various low-power peripherals, sleep modes, and features like DMA, aiming to keep the CPU in sleep mode. This war seemed noble, but it was filled with much false marketing nonsense, such as being able to power a device with a button cell for ten years (Jack Ganssle has done a great job refuting this in several articles and talks).

While you will see many numbers and data about the energy efficiency of microcontrollers being thrown around, in most cases, these figures are not based on engineering but rather on marketing numbers. Today, many microcontrollers use similar technologies (like Arm cores) and similar manufacturing techniques. One vendor’s Cortex-M4 is not much different from another vendor’s Cortex-M4, at least in terms of energy consumption.

When it comes to hardware selection, the trick is to choose the right class of processor for it. For example, use Cortex-M0+ or Cortex-M23 instead of Cortex-M4 or Cortex-M33. The more powerful the CPU, the more hardware features added to the microcontroller, which may lead to leakage or current consumption. While security features are necessary in many applications, they can introduce additional cores, TrustZone, MPU, etc., increasing overall energy consumption. These are the issues, not the differences in low-power current states.
5 Practical Tips for Low-Power DesignAdopt an Event-Driven Software Architecture

One important factor affecting the energy consumption of embedded products is the software architecture. I’ve seen excellent, streamlined software architectures collapse and burn out because they couldn’t meet the low-power requirements of the system. The problem with these architectures often lies in their real-time responsiveness. They are sleek but have significant latency or inefficient communication mechanisms that consume clock cycles and power.

When designing a low-power embedded system, the system must be developed to be event-driven. The default state of the system is one of the microcontroller’s sleep modes. Then, events will trigger the system to wake up and do valuable work.

For example, a low-power timer expires, waking the system, retrieving sensor values, performing some operations on them, and then returning to sleep mode. In this case, the system remains in a low-power state, waking up only to perform work. When executing work, it completes the tasks as quickly as possible and then returns to sleep mode.

The entire behavior of the system is driven by events, allowing it to stay in sleep mode for as long as possible. In fact, the previous example can be greatly improved. For instance, a low-power timer expires, and a DMA channel retrieves sensor samples, waking the CPU to process it, and then returning to sleep mode. In the event-driven architecture, we use peripherals, DMA, and all available tools to keep the CPU asleep for as long as possible. The reason is that the CPU is generally the largest energy consumer in the processor.
5 Practical Tips for Low-Power DesignUtilize Multi-Core

We are trying to design a low-power system that requires keeping the CPU off as much as possible, yet I recommend adding more cores. Some applications, such as machine learning or digital signal processing applications, cannot escape the need for high-performance microcontrollers. You need Cortex-M4 or Cortex-M33. You may find that even in sleep modes or your baseline energy consumption is higher than you want. At this point, a second core can come into play.

You can use a multi-core microcontroller that includes a low-power microcontroller like Cortex-M0+ and a high-performance Cortex-M4. When the high-performance core is not needed, you turn it off and let the low-power Cortex-M0+ run. When an event requires high-performance processing, the Cortex-M0+ wakes up the Cortex-M4 to quickly complete the work and then returns it to the off state.

A great example in this area might be keyword detection in machine learning applications. The Cortex-M0+ might search for an initial keyword, and once found, it would activate the high-performance core to process the entire phrase. In this case, the overall energy consumption of the device during the initial keyword discovery phase could be quite low. I think you get the idea. Using a low-power core alongside a high-performance core can potentially reduce your overall energy consumption.
5 Practical Tips for Low-Power DesignOptimize Speed Over Code Size

When writing software for low-power devices, necessary trade-offs must be made: faster processing and larger code, or slower processing and smaller code. If energy efficiency is required, then you should optimize for code speed rather than size. When your processor is awakened to process data, you want it to do so as quickly as possible and then return to sleep mode. The longer it sleeps, the lower the overall energy consumption of the device.

Regarding speed optimization, I can give you an additional tip: commercial compilers often perform better than gcc (this is a claim made in a blog). If you don’t believe me, check the public data from the EMBCC CoreMark MCU Benchmark. When you browse the data, look at the difference between running code in flash versus running it from RAM. You will notice that you can squeeze out some extra cycles from RAM, so if you have frequently run code, you can reduce the system’s energy consumption by placing those algorithms in RAM.

5 Practical Tips for Low-Power DesignConclusion

Designing a low-power embedded system is not only a requirement for battery-powered devices but also for grid-connected devices. As you have seen in this article, low-power design is not just about choosing the right hardware but also about selecting and implementing the correct software architecture. Currently, most hardware in the microcontroller space has similar energy usage profiles. The trick is to write software that can make the most efficient use of the internal hardware to keep the CPU disabled as much as possible.

In this article, we explored some tips and examples that we hope will help you design low-power embedded systems.
Author:Jacob Beningo
Source:EDN sister media embedded

Reference Original:5 practical tips for low-power design; translated by Demi Xia

Copyright Notice:This article is an original piece by Electronic Technology Design, all rights reserved, and reprinting without authorization is prohibited.

Friendly Reminder:

Due to recent changes in WeChat public platform push rules, many readers have reported not seeing updated articles in time. According to the latest rules, it is recommended to click “Recommended Reading, Share, Favorite,” etc., to become a regular reader.

Recommended Reading:

  • Profits of 30.9 billion but no dividends, SMIC urgently responds

  • Xiaomi’s first electric vehicle starts at 149,900, incredible cost-performance!

  • ASML confirms! New Dutch regulations will affect these DUV models

Please click 【View】 to give the editor a thumbs up

5 Practical Tips for Low-Power Design

Leave a Comment