Home Alternative Low Power Design Rules with MCU

Low Power Design Rules with MCU

Summary

 

Market and government demands for a greener environment and better use of resources, such as making batteries longer lasting, mean that the need for low power operation and standby time continues to increase. On the contrary, the demands for greater features and functionalities are also on the rise, a combination generally not identified with the decrease in consumption.

 

Introduction

 

This is the second in a series of four papers examining various considerations for low-power design and operation. In this document we look at many of the “tricks” (techniques) that allow designers to combine both performance and low power in their applications. Specific examples and references are included that are based on the RL78 16-bit and RX100 32-bit families described in the first document (which run the system from a lemon!). It should be noted that while specific devices are used for the reference (RL78/L12 and RX111) the principles can be equally applied to the other families of the RL78 and RX.

 

"Tricks" for low consumption

 

As indicated in document 1, the microcontroller (hereinafter MCU) is a significant factor in the consumption used in the applications, but it is not always the only area to consider and although the application requirements differ, there is a general set of issues that contribute to the power used, which we study in this paper.

  1. MCU timeouts
  2. MCU clock speed
  3. MCU Clock Selection Source
  4. MCU Peripheral Operation
  5. MCU I/O Pin Usage
  6. system integration
  7. Power Supply Options

These topics are covered in detail below, but please refer to the other articles in the series as they cover the specific topic associated with energy efficient design in more depth. The other documents in the series are referenced at the end of this document.

 

MCU standby modes

 

Standby modes used during standstill or idle periods are normally considered the primary method for reducing average consumption in any battery powered system.

Many MCU families offer a number of low power options because applications require different scenarios where some peripherals still need to function.

(RTC, UART and Timer etc.). The premise here is that the main clock speed is reduced or stopped completely and that any operation is based on a slow speed clock such as 32KHz or internal oscillator.

Obviously the optimum is where the system is completely stopped and all clock sources stopped and the MCU is powered at or above the minimum supply voltage, where the MCU is held in a static state.

Examples of our featured products are shown in Figures 1 and 2, showing the reduction in energy consumption. Here the HALT/SLEEP modes are using a low clock speed of 32 KHz and STOP/ SW Standby, with all clocks stopped.

As indicated in document 1 the two low consumption modes of the RL78, suspended (HALT) and stopped (STOP) (See figure 1) offer a significant reduction of energy in any case, and the SNOOZE function (linked to the sleep mode) stop) decreases the number of times the CPU needs to be woken up until a valid wake-up condition occurs, further reduces the average stop mode current.

For example, analyzing a heating controller based on the RL78 in “SNOOZE” mode, which measures the temperature (ADC conversion), checks the result and reports to the HVAC unit controller, only if the temperature is out of range (see figure 3 ).

By just using the “STOP” mode, an average current of 880 nA can be achieved, but by using “SNOOZE” operation, the average current is reduced to 680 nA, a 25% reduction that can directly translate into longer battery life. 25% more.

For the RX100 family of MCUs the three modes of SLEEP, DEEP SLEEP and SOFTWARE STANDBY, as shown in Figure 2 and described in Document 1, are understood to be not as low as RL78 but still offer power savings. important for a highly integrated and high performance MCU family.

We must not ignore one last factor of external analog functions or digital peripherals, so during standby, it is important that these can be “turned off” as some analog functions can consume as much power as the MCU.

I think it's clear that by employing standby and full system shutdown modes as part of the design, very low average currents can be achieved, thus maximizing battery life.

 

MCU Clock Operation Speed

 

A simple and perhaps obvious way to reduce power consumption that should not be overlooked is to run the MCU and any external peripherals at a lower clock rate, permanently or during periods of inactivity.

Reducing the system clock from the maximum available will reduce operating current with product dependent results. For example, the RL78's internal high-oscillation system clock can be reduced in a number of steps from 32 MHz to 1 MHz, with each reduction in frequency decreasing the operating current by 22%. So selecting a lower operating frequency can have an impact on the energy calculation. During periods, when the system does not have to perform any main processing, many MCUs allow the CPU clock to be soft-shifted to lower main frequencies or even low clock speeds (internal or external).

Using the RL78/L12, as explained in the lemon demo document 1) as an example, at full speed operation using the internal oscillator around 3 mA is consumed (24 MHz @ 3 V), while at 1 MHz the consumption current is reduced by at least 30% and less than 1 mA and at 32 KHz drops to 3.6 µA.

There is a similar scenario for the RX111, that at full speed the current draw is 10mA (32MHz @ 3.6V) while at 1MHz the draw is reduced by 90% down to 1mA and at 32KHz it is 11.5 µA. So the same snapshot can be seen on both of our microcontroller families.

Operating with a lower system clock is of course something that affects the foreground process, taking longer and impacting the average current, so an analysis of the average current at different clock speeds is recommended.

The average current consumption can be calculated in general with the following equation:

Iave = ((AC1 * AT1) + (AC2 * AT2) + (IC * IT)) / P

Where:

  • Activate Current 1 (AC1). Current consumption during the 1st period of activity.
  • Activate Current 2 (AC2). Current consumption during the 2nd period of activity**
  • Activate Time 1 (AT1). Time required for the 1st period of activity.
  • Activate Time 2 (AT2). Time required for the 2nd period of activity.
  • Inactive Current (IC). idle current. Idle/wait time.
  • Inactive Time (IT). Total period of inactive time – Total times active.
  • Time Period (P). Total time of the repetition period. 

** If there is only one active time then simply remove this from the equation and if there are additional active times then add what is needed to the equation.

An example of the above calculation is the one on which the operation shown in Figure 3 is based.

Iave = ((AC1 * AT1) + (AC2 * AT2) + (IC * IT)) / P

Iave = ((5.2 mA * 42.8 µs) + (4.7mA * 8 µs) + (0.56 µA * 949.2 µs)) / 1

Iave = ((222.56 nA) + (37.6 nA) + (53.2 nA)) / 1

Iave = 313.36 nA

Note: The event of sending temperature and time does not occur very often and has not been included in the above calculations.

When this event occurs, additionally 31.5 µA (4.7 mA*6.7 ms) is used during this time.

If the period of operation occurs every 5 minutes (5000 seconds) the average current of this additional event would be 6.9 nA (31.5 mA/5000).

While some MCUs allow software to change the main clock, it must be remembered that changing the main clock dynamically can affect the operation of peripherals, so careful consideration must be given to ensure that external devices are not affected and if it is used during the waiting time, normal operation settings can be restored.

While the MCU works at low frequencies, this has a marked effect on reducing the power used, the main method of reducing average system power is to use it dynamically or to use lower frequencies in conjunction with standby modes as discussed above. .

 

MCU Clock source selection

 

The selection of the main and secondary clock type (if used) refers to not only setting the clock speed as we have commented before, but also the type of the clock source, since such a choice will affect the current consumption.

It is already common for MCU manufacturers to provide internal clock oscillators, so in many applications the need for an external crystal/resonator is eliminated, not only for power savings, but also for cost.

In internal oscillators two categories are generally distinguished, the high-speed system clock (eg main clock) and the low-speed subsystem clock.

The internal main system oscillators have been rendered accurate enough for many applications (≤1%), and can include a “trim” feature allowing the oscillator to be profiled and tuned, to maintain accuracy over the temperature range. Low speed internal clocks are generally not as accurate so it may still be necessary to use a 32KHz crystal or external resonator, for example where an RTC is required to record time. While it is preferable to use internal oscillators especially for the main system clock source, there may still be times when a specific frequency is required or where greater precision is needed to drive a USB or Ethernet interface. There are few options here to choose other than the lowest consumption crystal or the possible resonator compatible with the MCU manufacturer. Remember that the processor and other peripherals do not have to run at this frequency and may also run slower.

A simple comparison between the different currents required by the main system clock source using the internal or external clock source based on our example products, compares the maximum available clock frequency and assuming normal operation.

The maximum external crystal of the RL78 is 20 MHz, thus rationalizing both clock sources, the internal oscillator uses 137.5 µA/MHz while the external one uses 150 µA/MHz. So for comparison, if the two clocks were running at 16 MHz, then the internal would draw 2.2 mA and the external crystal 2.4 mA. 200 µA may not seem like a big difference, but it all adds up when looking to make your battery last longer.

Analyzing the same scenario for the RX111 (table 2), the difference is around 100 µA. Again not a huge difference, but still 100 µA not drawn from the battery. One point to note is that using an external crystal with the RX111 it is necessary to use the PLL when considering system clock speeds above 20 MHz.

Using internal main oscillators saves current but another important factor is that internal oscillators have faster startup times than crystals or resonators, which means less time (and power) is wasted during wake-up from standby, where the clock has stopped. Normally the wake-up times of the crystals/resonators are around 2 ms, while the high-speed internal oscillator has a wake-up time of only 40 µs (RX111), 50 times faster and saving 50 times the starting power used.

Slow speed clocks or “sub” clocks may also require the use of an external crystal/resonator, if the internal clock is of the wrong frequency or insufficiently accurate for the application.

The choice of crystal/resonator can make a big difference, especially where a variety of power options are available in the oscillator cell.

It is important to check the compatibility of a crystal resonator with the MCU manufacturer to ensure correct operation, especially when using an oscillator in Ultra Low Power (ULP) mode. For example the comparison between the normal RL78 and the “ultra” low power with sub-clock is that the current consumption of “ULP” is less than half of the normal oscillator configuration (Normal = 380 nA and ULP = 180 nA) . While this doesn't sound like much, when you consider that standby currents can be on the order of 560 nA (depending on configuration and what's running), then 200 nA is 36%, so there can be savings. 36% more current.

 

MCU Peripheral Operation

 

Peripheral operation is another area considered “no-brainer” in which any unused peripherals should be turned off to prevent loss of power. It's normal to say that it's “off” since that's generally the peripheral's default state, but it's worth checking the datasheet to make sure.

It is important that to achieve very low standby currents where the secondary clock is running, any peripherals not required, in the idle state, should be suspended, unless configured to operate from this sub-clock (15 KHz or 32 KHz) otherwise. , it will not work properly and consume power.

An additional software process is needed to enter and exit the timeout, so consider carefully how to disable some peripherals as they can reset your configuration options.

This requires more processing time and consumes more execution power, so not all peripherals may be turned off in the sleep period. This should be analyzed during the design phase to determine the best option. Obviously if all the clocks are stopped, then it is not a problem, since both the MCU and the peripherals will be forced to stop in a static state by keeping the current state of the registers.

Some advanced peripherals such as USB may require a separate external clock that can continue to run during standby modes. This is not ideal, so the owner's manual should be consulted to see if it can be stopped.

Care should also be taken with the watchdog if it is being used as a security feature, as these still work during standby modes. Without “service required” access, the watchdog can overflow and cause an interrupt or hard reset, so a careful review of the standby watchdog operation should be done in the user manual.

The use of standby and stop modes can generally be configured so that the watchdog is serviced on entry and exit from low power mode, thus avoiding a hasty reboot. It is difficult to quantify the exact effect on current draw as all applications are different in standby and run, although any "analog" function (ADC, DAC, LCD, temperature sensor etc.) will consume more power than most functions. digital, since they include static energy drains (resistors, references, etc.) that are independent of the clock speed. For optimal low power, the suggested technique is to turn them on, use them quickly, and turn them off. However, due to the settling time of many analog peripherals, it is prudent to determine the best time to enable and disable them, to ensure that it is ready when needed, and if possible, use the settling time to perform other CPU tasks. Finally we have considered “internal” peripherals, but sometimes it will be necessary to use external functions especially analog devices such as sensors. It is recommended that all external peripherals can also be “powered off” or disabled when not in use.

 

Using MCU I/O Pins

 

This section remembers little things, to avoid unnecessary and unexpected consumption.

Try to avoid low impedance units, as this will increase the switching currents in the output driver.

Make sure there are no floating pins as they can increase design leakage currents and can set indeterminate levels that trigger a valid input state on an input pin.

Pull up or pull down resistors should be avoided unless absolutely necessary. If you use an external resistor, try setting the value high enough to reduce current during operation, but low enough to ensure proper operation.

For example an internal pull up resistor can have a value as high as 100KΩ, so any external one can also have this value, whereas for an open drain (typically used for I2C interface) it will have to be considerably smaller (as as low as 1 KΩ) to correctly maintain the specified rise and fall times.

Most MCUs include internal programmable pull up resistors on the pins, so it can be used if needed. During standby mode you have to test and ensure that no pins go to the pull up/down level (ie logic 0 for pull down and logic 1 for pull up) normally in idle state.

To avoid using pull up/down resistors on any unused I/O pins, it can be configured as “output” since a defined level is always set and no pull up/down resistors are required.

A side benefit that low impedance to the outside world offers is that it helps with noise immunity.

 

System Integration

 

The interfaces for external peripherals are one of the factors to consider in large systems, since all of these require control and data signals, so all these I/O pins will consume a switching current defined by the equation:

½ C * V2 * f (Capacitive Load * Switching Voltage2 * Switching Frequency).

By integration we mean an MCU family that has some or all of the peripherals built into the chip, including features such as USB, Ethernet, and E2ROM (using Flash data) plus a growing number of analog features such as analog temperature sensor, comparator, etc. and programmable gain amplifier etc.

The benefits of providing peripherals on a chip aside from cost savings, is that while the peripheral still consumes power (when used) the data interfaces and control interfaces use much lower switching currents (lower voltage (V2) and lower capabilities (C)) with not very high currents on the used I/O pins and functions can be easily turned off when not needed.

Power Supply Options

 

The choice of power supply seems to be a simple choice, “the lower the voltage the lower the power” and to some degree this is true, but not necessarily as you might think. Many current MCUs include an internal regulator that lowers the internal operating voltage and offers constant power consumption over most of the operating voltage range, running the device at 3V or 5V (in some cases up to 1.8V). without any difference in the consumption of the MCU.

Obviously running the system at 3V can make a difference in total power used, but this is a choice of the designer and interfaces outside of the MCU.

However, many devices now operate below very low voltages, for example the RL78/L12 can operate at 1.6 V and the RX111 at 1.8 V, making low voltage operation possible. With this wide range of possible voltages, battery life is extended before it needs to be charged or replaced. Just keep in mind that the maximum clock frequency is normally reduced when operating at very low voltages, so be careful when setting the clock frequency in the 3 V to 1.8 V supply range to ensure that the frequency of the main clock is suitable for the voltage range used.

The RL78/L12's 1.6V high-speed internal oscillator frequency can go up to 4MHz, the RX111's 1.8V maximum internal oscillator frequency is 8MHz.

It is possible to reduce the power supply during standby times where the minimum voltage is used to maintain the configuration of the registers and the contents of the RAM. However this can be a complicated procedure and care must be taken in sequencing the system “download” and “powerup” so that it does not affect any external peripherals connected to the MCU. Most likely, this will also affect the “shutdown” and “wakeup” time of the system.

 

Conclusion

 

The theme of this document has been to find the "tricks" that help reduce energy consumption. While the previous sections provide an overview where each application may have varying requirements, it is recommended that you use an “Energy Usage Profile” in your design, to analyze current consumption and highlight areas that are not meeting your design goals or where there is unexpected consumption and allow the implementation analyzed and adjust it to the life of the used battery.

For more information, it is recommended that you read the other documents highlighted in this series and visit the Renesas resource design center.

Document 1: Design with the strength of a lemon

An example of what can be achieved with the right product and modes of operation.

White Paper 3: Reducing the clock vs. standby mode of the MCU, for low power designs.

Reduce the MCU clock speed during up and down times and the effects of combining them with timeouts.

Document 4: Maximize your battery life.

Analysis of systems that are designed to work in long periods of waiting time.



Tags
mcu period