The power consumption design is unqualified? The power consumption of the designed product is too high? Does not meet the requirements of low power consumption? It’s all right. In this article, the editor will introduce 5 points of attention for low power consumption in MCU design. If you are struggling with how to implement low-power design or you are interested in the content of this article, you may wish to draw some inspiration from this article.
Microcontroller Unit (MCU), also known as Single Chip Microcomputer (Single Chip Microcomputer) or single chip microcomputer, is to appropriately reduce the frequency and specifications of the central processing unit (Central Process Unit; CPU), and store the memory. , Counter (Timer), USB, A/D conversion, UART, PLC, DMA and other peripheral interfaces, and even the LCD drive circuit are integrated on a single chip to form a chip-level computer, which can be controlled in different combinations for different applications. Such as mobile phones, PC peripherals, remote controls, automotive electronics, industrial stepper motors, robotic arm control, etc., MCU can be seen.
The power consumption of the MCU should be only 176nA, but the measured value is 700mA! It is simply unbearable, and I want to die.
Usually, when we use MCU low power consumption, there is often a large deviation between the actual power consumption and the theoretical power consumption, such as in some power consumption modes as low as microamps, and the low power consumption we design is measured in milliamps. The current can be hundreds to thousands of times higher than the theoretical level. Don’t be afraid in this situation, as long as you are serious, you will win.
Listed below are five points to be aware of when designing for low power consumption.
1. Cut off the peripheral lifeline – turn off the peripheral clock
First of all, the most intuitive, and the aspect that we all pay more attention to, is to turn off the peripheral clock of the MCU. For most MCUs now, the peripheral module corresponds to a clock switch. As long as the peripheral clock is turned on, the peripheral can be used normally. Of course, the peripheral will also generate corresponding power consumption; otherwise, If you want to make this peripheral do not consume power, you generally only need to turn off the peripheral clock.
2. Slow down the pace of work – don’t double the clock
In addition to the power consumption of peripheral modules, there is also a large power consumption, that is, PLL and FLL modules. PLL and FLL are mainly used to multiply the original clock signal, thereby improving the overall clock of the system, and the corresponding power consumption will also be raised. Therefore, before entering low power consumption, it is necessary to switch the clock mode, bypass the PLL and FLL modules, and switch the clock back after the MCU wakes up.
3. Containing the trickle – pay attention to the level status of the IO port
If you think that just shutting down the peripheral clock will ensure that the peripheral is not draining power, then you are really too young. If the IO port is not properly handled, it will steal power consumption secretly without you knowing it. The specific reason is this. Generally, there will be pull-up and pull-down resistors inside or outside the IO. For example, as shown in the figure below, if an IO port has a 10KΩ pull-up resistor, according to Ohm’s law, this pin will consume 3.3V. /10K=0.33mA current, if there are four or five such IO ports, then a few mA currents are just pasted in, which is a pity.
So before entering low power consumption, please check the status of IO one by one:
If the IO port has a pull-up, please set it as a high-level output or a high-impedance input;
If the IO port has a pull-down, please set it as a low-level output or a high-impedance input;
4. Good-neighborly and friendly cooperation – pay attention to the overall planning of IO and peripheral IC
The factor of the current consumption of the pull-up and pull-down resistors of the IO port is relatively obvious. Let’s talk about an insignificant factor: the current consumption when the IO port is connected to an external IC. If an IO port has its own pull-up, and the IC pin connected to this IO has its own pull-down, then no matter what level output this pin is at, it will inevitably generate a certain current consumption. So if you encounter this kind of situation, you first need to read the manual of the peripheral IC, determine the state of this pin, and know what you have in mind; then before controlling the MCU to sleep, set the MCU’s IO up-down mode and input In the output state, it is necessary to ensure that no current is consumed by it.
5. Disconnect the debugger – don’t be fooled by illusions
There is another kind of strange, the detected current consumption is very large, but the actual result is unfounded. What is the reason? It is because the MCU is still connected to the debugger when testing the power consumption! At this time, most of the current will be debugged The weapon was taken away, which made us feel extremely depressed for no reason. Therefore, when testing low power consumption, be sure not to connect the debugger, let alone measure the current while debugging.