What are the MCU low-power design and implementation of MCU energy consumption factors?

one. MCU energy dissipation factor

Modern MCUs generally use CMOS technology. Energy consumption includes two aspects:

Static consumption is mainly consumed by transistors;

Dynamic consumption formula = C & TImes; V2 & TImes; f, where C is the CMOS load capacitance, V is the supply voltage, f is the clock frequency;

The total power consumption is the sum of static consumption and dynamic consumption, ie: IDD=f&TImes; IDynamicRun[uA/MHz]+IStaTIc[uA].

Therefore, the power consumption depends on:

MCU chip size or number of transistors;

Lowering the voltage of the MCU supply voltage can reduce the power consumption in squares;

The clock frequency can reduce the clock frequency to just meet the application needs;

The more peripherals enabled the number of peripherals, the greater the energy consumption;

A reasonable choice of operating mode for the operating mode can significantly save energy, such as entering sleep mode after working at full speed for a very short time.

two. Energy saving method

1. Turn off unused peripherals

2. All unused pins must be connected to a certain logic level;

3. Use the Wait mode to achieve low power consumption when peripherals must remain active.

4. Use the appropriate VDD value;

5. Use low-power operation mode as much as possible;

6. If the low power mode cannot be used, then reduce the main frequency to the minimum value for the application;

7. If possible, use the pull-up function of the dynamic control I/O pin.

three. Low power mode

MCUs supporting low power consumption generally have several operation modes. Take ST's STM8L as an example, it supports five low-power modes: waiting, low-power operation, low-power standby, active stop, and stop. The entry mode of each mode, energy-saving level and peripheral work requirements, summarized in Table 1:

Table 1 STM8L low-power operating mode

What are the MCU power consumption factors?

The above low-power operation mode is a bit more for developers, especially the STM8L processor. We need general guidelines, and Table 2 is experience from practice.

Table 2 Choosing a Reasonable STM8L Energy Saving Mode

What are the MCU power consumption factors?

four. Little-known skills

1. Use Wait to replace the query to save energy

The common query method is as follows. At this time, the CPU has nothing to do and consumes power in vain.

ADC_CR1 = ADC_START; /* start conversion */

While (!(ADC_SR & ADC_SR_EOC)) ; /* wait for EOC bit set */

You can use wait events to save power.

First configure the ADC as an event source and enable the corresponding interrupts:

WFE_CR2 = ADC_COMP_EV; /* enable ADC as a source of event */

ADC_CR1 = ADC_EOCIE; /* enable interrupt for end of conversion */

When the ADC conversion is complete, wake up the waiting CPU:

ADC_CR1 = ADC_START; /* start conversion */

_asm(“wfe”); /* enter wait mode until waked by ADC_EOCIE*/

2. Interrupt mode without context switching

When the application is designed, if all interrupt events are completed by the ISR, power can be saved by setting the AL bit in the CFG_GCR register: Avoid saving/restoring the context, no main program operation (return to WFI mode), as shown in Figure 1 below.

What are the MCU power consumption factors?

Figure 1 Interrupts without context switching in WFI mode

Setting the AL bit to save power can also be used in the HALT mode. The principle is shown in Figure 2 below.

What are the MCU power consumption factors?

Figure 2 Interrupts in HALT mode without context switching

3. Dynamically set the pull-up function of the I/O port

Many applications require a button as a human interface, and the buttons are usually connected to the I/O. When the button does not operate, the I/O port is internally pulled up to obtain a defined logic level; once the button is pressed, the I/O port is grounded to generate an additional 40-70 uA current, which is low power for the battery power supply. Consumption is very important.

You can dynamically control the pull-up of the I/O port to save power: once the button is pressed, the interrupt service routine will disable the pull-up function of the I/O port; then the software will execute the timing-enable pull-up function first, and then I/O port status. If the button is pressed, the pull-up function is disabled again. Otherwise, the I/O port pull-up function is enabled. The entire logic is shown in Figure 3 below:

What are the MCU power consumption factors?

Figure 3 Dynamically setting the I/O port pull-up to save energy

4. CPU idle energy saving strategy

The idle energy of the CPU is shown in Figure 4 below. Its logic includes the following steps:

(1) The CPU is found idle: With OS system, there is no event that the task needs to respond to, or enter the idle process; no OS system, the end of the program execution.

(2) Select a suitable CPU power-saving mode: chip_EnterLowPower() completes the preparation before entering the power-saving state, including: turning off the peripherals and switching the I/O pin to the power-saving state.

(3) Exiting the energy-saving mode requires calling chip_ExitLowPower(), which may happen in the following two situations:

a. ISRs that require the use of shutdown peripherals:

b. directly exit from the process;

The work of chip_ExitLowPower() includes enabling peripherals and switching I/O pins to working state. At the same time, in order to avoid ISR and process operating chip_ExitLowPower() twice, this function sets state variables to avoid repeated exits.

What are the MCU power consumption factors?

Figure 4 CPU idle energy saving policy

Linear Array Sensor

Linear Array Sensor,Infrared Light Detector Device,Swir Linear Detector,Infrared Ingaas Sensor

Ningbo NaXin Perception Intelligent Technology CO., Ltd. , https://www.nicswir.com