Designing Embedded Systems for Low Power Operations

作者:Jon Gabay

投稿人:Convergence Promotions LLC


Reducing energy is a widespread movement in the world, and spans items like appliances, transportation, entertainment, communications, computing, medical devices, and more. Everything that uses electricity consumes power, thus energy. With energy sources being the stuff wars are made from, and costs rising, the trickle up effect makes everything more sensitive to energy efficiency, especially when it comes to the cost of energy over a products lifetime.

Tremendous gains have been made when we get challenged, and the benefits are felt by us all. For example, when California legislated that refrigerators had to be more energy efficient, the industry rose to the challenge, created the new technology needed to satisfy guidelines, and everyone in the world is better off because of this. In California alone, the energy savings from the deployment of low energy refrigerators eliminated the need to build 50 coal-fired power plants over a 10 year period according University of California studies. Little savings add up when multiplied by us, the vast population.

Compared to an electric heating element, the energy required by any microprocessor or microcontroller may seem insignificant. However, the huge multiplier of population makes this number very significant especially when it comes to phantom loads. Phantom loads are devices that draw power, even when a unit is turned off. Because we live in an on demand – we want it now – society, things like TV sets, constantly draw considerable power to be able to ‘power up’ quicker.

Energy studies have shown that up to 10 percent of domestic electricity in the U.S. alone is due to phantom loads and here is one place that embedded intelligence can change the way our world around us operates. Smarter power supplies like those used in the new Qi wireless power standards, shut themselves off when fully charged or not needed.

With more battery powered toys and equipment in use, the microcontrollers themselves have been going through a transformation to reduce their runtime energy needs as well. This is what can extend battery life. Not only is this a marketing plus, when your gadget can last longer on a battery, this can be a life saver. How often for example, would you want to replace a defibrillator or pacemaker.

Lower voltage CMOS processes have significantly lowered the power needed by modern microcontrollers, but, there is a lot more to designing systems for lower energy than just fab processes. Designing a system to reduce energy requires a different mindset. In addition, the hardware resources, as well as software development tools must be in place to be able to take this energy savings to the next level.

This article focuses a spotlight on one fairly new and innovative approach to lowering energy demands in embedded systems. This approach and the products come from a company called Energy Micro, who has introduced a family of Energy Friendly Micros (EFMs).

Called the Geckos (because a Gecko uses only 10 percent the energy of the same size mammal), the EFMs are ARM Cortex (M0 and M3) flavored microcontrollers (see Figure 1) that embed clever technology and techniques that drastically lower the energy use, if you know how to take advantage of it.

We will explore these parts, techniques, and tools here as we introduce you to a new way of approaching low energy design, including the use of new types of hardware, new types of software tools, and a new way of approaching system design. All play a key role in extending battery life by as much as three fold as claimed by Energy Micro. All parts and development tools discussed here are available on the DigiKey Website.

Geckos EFMs—ARM Cortex (M0 and M3)

Figure 1: Geckos EFMs—ARM Cortex (M0 and M3) flavored microcontrollers that embed clever technology and techniques that drastically lower the energy use.

An ARM by any other name

You may say an ARM core is an ARM core. There is not much you can do to lower its power other than clock it slower or put it to sleep. The energy used is directly proportional to the clock speed in a CMOS circuit. This means, that through innovative clocking, and clock management, a lot of power can be saved.

While it’s not uncommon for a micro to use a second crystal when entering low power mode to reduce energy, Energy Micro takes this a step further. Typically, the low frequency crystal is 32.768 KHz since this resolves nicely to exact ticks that real time clocks like. Compared to the up to 48 MHz range these EFM parts can operate at, switching to the 32.768 KHz saves quite a bit of power.

This can be reduced even more by letting you choose even lower frequencies and to use lower power oscillators which maximize energy. Energy Micro added two other low energy R/C oscillators which use even less energy. These are not the precision of a crystal, but that level of precision may not be needed for many designs.

The R/C oscillators can be switched in and used like any other oscillator (see Figure 2), and, allows the main crystals to shut down, especially if peripherals can use lower frequency clocks. To this end, clock management and use throughout a chip becomes critical, and here is another place Energy Micro moves this technology to the next level. Through the use of newly designed low energy peripherals.

The R/C oscillators

Figure 2: The R/C oscillators can be switched in and used like any other oscillator.

Not an island unto itself

No processor or processor core is an island unto itself. To be useful, it is surrounded by a rich set of peripheral functions that communicate, calculate, encrypt/decrypt, move data, convert between analog/digital, and so on. Every one of these peripheral interfaces is fair game to energy reduce, and that’s what Energy Micro did.

Instead of using old world canned peripheral IP, Energy Micro designed all new peripheral functions from the ground up, with the intent on making them use less energy. This is important since like the TV, peripherals are always drawing some power in the event they are needed.

A perfect example of this is their low energy UART (see Figure 3). Designed from the ground up, instead of using the standard 3.6864 MHz or 11.0592 MHz frequencies, Energy Micro made this work with the 32.768 KHz clock saving energy when running.

Energy Micro’s low energy UART

Figure 3: Energy Micro’s low energy UART.

Layering on top of the basic UART functionally, the Gecko’s take advantage of dedicated low power hardware that quickly detect starts of packets and wakeup so the UART is in sleep mode until a start of packet is detected. Only 150 nanoAmps are drawn by the low energy UART which supports baud rates up to 9600. Higher baud rates can be achieved by switching in the higher frequency clocks and using the non low energy UARTS.

All key power hungry peripherals are redesigned to use lower energy and a slower clock. Timers, A/D’s, D/A’s, DMA, SPI, multi-master IIC, Counters, and more are all new lower energy versions that can operate at a fraction of the power that standard peripherals in other micros can. Table 1 shows how effective this was for the runtime power draw.

Meditative vs REM

We have more than two states of sleep and so do the EFM32s (see Figure 4). The colors indicate what peripherals are alive in each sleep mode, and you may be surprised to learn that sophisticated peripherals that need or generate data can function without waking up the core micro.

EFM32s with two states of sleep

Figure 4: EFM32s with two states of sleep.

The full shutoff mode draws 20 nanoAmps. A GPIO pin or Reset can wake it up in 2 uSec. You can retain the real time clock and 512 bytes of SRAM with a 400 nanoAmp draw.

The next lowest state is the Stop Mode which draws 600 nanoAmps. The Stop Mode preserves CPU registers and internal RAM, and a variety of analog and digital functions come alive as well like the D/A, Op-Amps, and comparators, brown out detector, IIC, Watchdog, and a handy pulse counter (more on this later).

The Deep Sleep mode (900 nanoAmps) adds USB, UART, Timer/Counters, Sensor Interface, and LCD driver functionality while the Sleep Mode (45 uA/MHz) adds TFT driver, External Bus Interface, ADC, AES, and more, — ALL WHILE THE MICRO SLEEPS.

How can this functionality occur without waking up the micro? Through the use of an autonomous state machine that coordinates the activities of the internal peripheral without micro intervention.

Energy Micro calls this the reflex bus (see Figure 5) and it is actually an internal state machine based sequencer that allows the low energy peripherals to queue each other, pass data, and communicate while the core is asleep.

Energy Micro reflex bus

Figure 5: Energy Micro reflex bus.

Like a baton passing trigger mechanism, a recurring real time clock tick for example, can trigger an A/D conversion at precise intervals. The converted data triggers the DMA to move that value to a memory buffer which triggers a counter to update a count. When a predetermined number of samples has been taken, you can wake up the micro which has a block of data to operate on, not just a single sample.

This is just one example as to how relatively complex functions can take place while the core micro stays asleep. Others include LCD animations, TFT refreshing, and of key interest sensor preprocessing and event detection.

Sleep-working

Processing data acquired from sensors is one of the largest embedded system applications, especially when it comes to battery powered equipment, that is either field deployed, handheld, powered through energy harvesting, or worn and used as a medical device.

From wearable blood pressure and glucose monitors, to remote environmental monitoring, accessing sensors, processing some data, and then going back to sleep is the only way to extend usable battery life.

For events with regular intervals, this can be pretty straightforward. A Micro goes to sleep, wakes up at regular intervals, performs a function, then goes back to sleep (see Figure 6A). These are time driven events. A real time clock interrupt can wake the micro and the area under the power curve is the total energy used. This type of hardware and software can be optimized pretty well with any micro architecture.

A Micro goes to sleep

Figure 6A: A Micro goes to sleep, wakes up at regular intervals, performs a function, then goes back to sleep.

With event driven detection, this becomes more problematic and can be VERY wasteful of energy. The micro must constantly wake up and check for a condition that would indicate an event has begun. If no event is detected, the MCU goes back to sleep (see Figure 6B). Only if an event has occurred will it stay awake and perform.

MCU goes back to sleep

Figure 6B: If no event is detected, the MCU goes back to sleep.

The time interval between wakeups determines your timestamp resolution. If the micro wakes up every second, that is your time resolution. The more often you wake up, the more power you draw coming out of sleep mode, checking, and then going back to sleep. Unfortunately, to work better, devices must be more responsive which means waking up a lot more to check for an event.

Take a cardiac monitor that logs data of an event for a doctor. If it was asleep too long and missed key data the doctor needs, it is not very effective. If it catches the event right when it occurs and logs data, it is effective. If it uses too much power and goes dead before it finds anything, it is not effective.

It is not uncommon for hundreds, thousands, or millions of wakeups (or more) before the sought after event occurs. That power over time is your wasted energy, and it can add up.

Dedicated hardware can be used to cause interrupts only when needed to save on all the unnecessary wakeups. This is an energy efficient approach, but may not be a cost effective or PCB space effective solution. This dedicated hardware needs to be on chip, and this is what the reflex bus, and the Low Energy Sensor bus (LESENSE) combine to do for you.

LESENSE takes advantage of the on-chip analog comparators and Op-Amps, A/D converters, and the digital comparators to allow self running, cycle based, event detecting, data acquisition processing (to a limited extend), and control.

To illustrate this, let’s look at an inductive sensor application that can be used to perform flow rate sensing and accumulation (see Figure 7). Metal is arranged in a circular binary count configuration so when the metal strip (dark) is next to the inductive coil, it changes its oscillating characteristics.

An inductive sensor application

Figure 7: An inductive sensor application that can be used to perform flow rate sensing and accumulation.

With no metal near the inductor, the inductor is free to ring at a well known and expected decay rate. If the on-chip Op-Amp and comparator are used to create a threshold detector, the result is a pulse train of events. The pulse counter counts these pulses and accumulates a count. It the count is over the pre-determined threshold, the micro stays asleep. Nothing to see here.

If metal is in close proximity, the oscillator is dampened and the pulse count is lowered. This lower count can trigger the micro to wake up and take action since an event has occurred which needs the micro to process. Note: the quadrature waveform is generated to let the micro know the direction of rotation as well as the rate.

Tools of the trade

In order to code more effectively, new tools are needed to let software engineers take advantage of lower energy coding techniques. Brute force has its place, but not when each cycle time draws power.

To tackle this, Energy Micro created a top level position in the company to develop and maintain a new suite of tools that are easy to use, understand, and effective at reducing processor run time as well as development time.

The comprehensive suite of development tools is called Simplicity Studio, and it encompasses several tools which speed up development of code and let the designers reduce energy consumption though an energy aware runtime feature.

To go into intimate detail about all the features of the Simplicity Studio would be the subject of another full article. So, here, just to indicate how this is so effective, we will look at one of the integrated tools to show how effective this is.

The Energy Profiler lets you see in real time, how much energy is being used as your code is running (see Figure 8). As a bar-graph (lower right), the amount of power used by each main routine is displayed, as is the code (on the left).

The Energy Profiler

Figure 8: The Energy Profiler lets you see in real time, how much energy is being used as your code is running.

The key is the runtime energy draw (top right) which shows the real time current draw. Note each of the small red indicators. Any one of them can be clicked to reveal the code that is running at that level.

This is particularly helpful for energy reducing a routine. For example, if you see a block of energy being used that is high and prolonged, you can click into it to see the underlying code. If for example, it is a ‘WHILE’ loop, you may want to change it to use a timer, put the micro to sleep, then let it wake up closer to the time when it is ready to move on. This saves all that active time while the micro is powered up waiting for an event.

Lights out

Developing low energy systems is a discipline that comes with experience and support. Energy Micro provides the hardware and software to allow extended runtimes on very low amounts of energy, if you are clever enough to take advantage of the architectures, tools, and techniques.

免责声明:各个作者和/或论坛参与者在本网站发表的观点、看法和意见不代表 DigiKey 的观点、看法和意见,也不代表 DigiKey 官方政策。

关于此作者

Jon Gabay

关于此出版商

Convergence Promotions LLC