Sleep, stop and standby modes in MCU

Each ECU on the vehicle is powered by the low-voltage battery. The capacity of the battery is limited. After the vehicle is turned off, if the ECU continues to work for a long time, the battery power will be exhausted, resulting in battery power loss, resulting in the vehicle can not start.

Therefore, the ECU in the vehicle has a relatively high requirement for the quiescent current (also known as the sleep current), which is usually several mA.

The essence of ECU entering sleep is that the main chip MCU enters the low power consumption mode. There are three common low power consumption modes of MCU: sleep, stop and standby. What are the differences between these three modes? Which mode is more suitable?

 

  1. Low power consumption

First of all, the power consumption of the chip is related to the supply voltage. When the MCU works, the dynamic power consumption is proportional to the square of the operating voltage, so reducing or reducing the voltage can significantly reduce the power consumption.

When the MCU is not working, there is no dynamic power consumption, but it will produce continuous static power consumption caused by leakage current. This power consumption is not only affected by the process and temperature, but also related to the supply voltage. The lower the voltage is, the smaller the static power consumption is.

The power consumption is not only related to the voltage, but also related to the working clock frequency. The power consumption is generated when the transistor in the MCU jumps. The power consumption is proportional to the signal inversion frequency. When the MCU runs at high frequency, the power consumption will increase significantly. Therefore, reducing the main frequency or using a low-speed clock source can effectively save energy if the performance permits.

In short, for the main chip, there are two basic points to consider to reduce power consumption: voltage and clock. Power consumption can be reduced by lowering or turning off the voltage and clock.

When the working voltage VDD is fixed, the CPU has the highest working frequency in the MCU. Because the CPU needs to execute instructions at a high speed when it runs, even the idle cycle power consumption is high.

After the MCU enters the low-power state, the main program does not need to run again, so the CPU clock should be turned off first to suspend the CPU, which will save a large part of the power consumption.

 

  1. Sleep Mode

Taking STM32 as an example, Sleep mode is the basic mode in low-power mode. The design goal of Sleep mode is to significantly reduce power consumption while still maintaining the ability to respond quickly to external events.

Therefore, after entering Sleep mode, although the CPU clock is turned off, that is, the Cortex-M core stops executing instructions, the system clock HCLK, the AHB/APB bus clock, and the peripheral clock remain on.

At this point, the memory and peripheral components are still operational, so the peripherals such as SRAM, UART, TIM, ADC, DMA, etc. Continue to operate normally, so that background tasks such as continuous sampling, serial communication, PWM output, etc. Can be performed.

Sleep mode can be awakened by any interrupt or event. Any interrupt source includes external/internal hardware interrupt, software interrupt, operation exception, etc.

After entering the Sleep mode, the main program is suspended until the interrupt or event wakes up, and the CPU continues to work after waking up.

Because all peripheral States and SRAM contents are not cleared in Sleep mode, there is no need to initialize any modules after wake-up. Therefore, the wake-up delay is very short, and it usually takes only a few clock cycles for the system to resume execution immediately from the pause.

From the above features, we can see that the biggest advantage of Sleep mode is the fastest wake-up speed. This feature is suitable for scenarios that require frequent response to external events such as key presses, sensor data arrivals, etc.

Sleep only shuts down the CPU and retains the characteristics of other peripherals. It is also suitable for continuous sampling of ADC and pulse output of GPIO after sleep. For example, ADC stores data into SRAM through DMA, and GPIO pulse output can still automatically generate pulse signals through timers (such as PWM). These two scenarios do not require CPU intervention.

Although Sleep mode has many conveniences, its power consumption is also the largest because the system clock, AHB/APB bus clock and peripheral clock are still on. The power consumption of the chip is at ma level, while Stop and Standby are at ua level.

 

  1. Stop Mode

In Sleep mode, most of the peripherals are active, which is equivalent to light sleep, suitable for scenes that require fast response and the peripherals can not be stopped. But after the MCU adds the peripheral circuit, the total power consumption is quite big.

Many controllers have high quiescent current requirements and do not require many peripherals to operate after sleep. When further hibernation is required, Stop mode is required.

The faster the clock speed, the higher the power consumption. The system clock is a high-speed clock, so its power consumption is very high. Stop mode will turn off the high-speed system clock, and only keep the low-speed clock (LSI/LSE), the power consumption will be greatly reduced. The low-speed clock here is mainly used for RTC real-time clock.

In this way, in addition to the suspension of the CPU, most of the peripherals also stop working, but the memory is still running, that is, the RAM and register contents remain unchanged, responsible for recording the working status of the CPU and peripherals.

Stop mode can also resume execution from where it was paused after waking up.

The power consumption of Stop mode and Sleep mode is very low, only tens of uA, which is much lower than Sleep mode.

Because Stop mode shuts down most peripherals, there are fewer wake-up sources, mainly external interrupts and RTC alarms.

Because Stop mode turns off the system clock, which is also the clock source of most peripherals, the CPU needs to re-initialize the clock system, power management, peripheral components and other modules after waking up.

It should be noted here that if the system clock is not re-initialized, the software will run according to the default configuration. The default configuration is not to turn on the PLL and use the internal high-speed clock HSI, so the running clock frequency is 8 MHz. If the original system clock is 72 MHz, the wake-up clock will be completely out of order.

Therefore, the power consumption of Stop mode is much lower than that of Sleep mode without losing RAM data, but its wake-up speed is relatively slow due to the need to reinitialize the system clock.

 

  1. Standby Mode

The power consumption of Stop mode has been reduced to a very low level, but some devices need to pursue extreme power saving, such as battery-powered car keys. If the power consumption requirements are not strict, but the wake-up is faster, Stop mode can be used.

But if you’re looking for the ultimate in battery life, Standby is a better choice. Before we look at Standby standby mode, let’s familiarize ourselves with the power supply structure.

The power supply for the MCU is VDD, which is typically 3.3 V. Since the CPU core consumes the most power when running at high frequencies, the core does not use the VDD power supply directly, but uses a lower 1.8 V power supply than VDD to reduce power consumption.

The MCU uses an internal voltage regulator to convert 3.3 V to 1.8 V before supplying it to the core. Therefore, the interior of the MCU is divided into two power supply areas, and the GPIO and the standby circuit are in the VDD power supply area; The key circuits such as CPU, memory and some built-in digital peripherals are all in the 1.8 V power supply area and run at a low voltage of 1.8 V.

The previous sleep and stop modes are mainly adjusted on the clock. For example, sleep turns off the CPU clock, and stop turns off the system clock.

When the CPU clock is turned off, computation and operations involving timing are suspended, but the data stored in registers and memory can be maintained because the 1.8 V power supply is still present.

In Standby mode, in order to further reduce the power consumption, the 1.8 V power supply of the core is also turned off, so that not only the CPU can not work, but also the memory and built-in peripherals have no power supply, that is, the data in SRAM and registers will be lost, which can save more power.

However, this has a disadvantage, that is, due to the loss of SRAM and register data, the wake-up is not only to reinitialize the system clock, but also to reinitialize the whole system, and the program does not resume execution from the stop point (such as WFI), but restarts from the reset vector, that is, the program reexecutes from main ().

The wake-up source of Standby mode is further reduced. It can only be woken up by specific interrupt sources, such as WKUP pin (corresponding to PA0), RTC alarm clock, NRST reset pin and IWDG reset. After waking up, it is equivalent to the “restart” of the whole system, and the previous working state will be lost.

Standby mode is the most closed to clock and voltage of the three modes, so power consumption is the lowest. Of course, it is also the slowest to wake up (a few ms) because it has to be re-initialized and re-run after reset.

 

Comparison of three modes

The total power consumption of a real product is not only the current consumed by the MCU in low power mode, but also the current consumed by peripheral devices and circuits, which often consume more current. In addition, avoid having the GPIOs in a Floating state, and it is best to configure unused GPIOs in analog input mode to further reduce power consumption.

 

There are three main low-power modes of the main chip: Sleep, Stop, and Standby. Sleep sleep mode is light sleep, which has the fastest wake-up speed but the highest power consumption. Stop mode is a medium sleep with a medium wake-up speed and low power consumption. Standby standby mode is deep sleep and has the slowest wake-up speed, but the lowest power consumption. Generally speaking, Stop mode is suitable for more scenarios, and the specific choice of mode needs to be considered in combination with quiescent current requirements, start-up time requirements and wake-up source.

Previous Post

Key points of EV PDU design

Next Post

CMVTE:Your one-stop electric vehicle drive system solution partner

图片

Leave a Reply

Shopping cart