Analysis of the EFR32 module in low power applications
Posted by tracyyun
In battery-powered microcontroller applications, energy savings are critical. Reduce battery charging times and replacement time by reducing current consumption. Microcontroller software design should follow these guidelines to reduce current consumption:
1、Using the appropriate energy model
Utilize low-energy peripherals
Close unused modules/peripherals
Disable clock to unused modules/peripherals
Reduce the clock frequenc
Operating voltage reduction
Optimize the code
2、Using the appropriate energy model
The most effective way to save energy is to spend as little time as possible in active mode.
Five custom energy modes allow the microcontroller to operate in an energy-optimal state at any given time.
3、Utilize low-energy peripherals
All peripherals are built on energy consumption and can be used in a variety of energy modes. Whenever possible, select the appropriate peripheral to let it work while the CPU is sleeping (or performing other tasks).
A few examples:
Use RTC and sleep instead of waiting for a certain loop
Transfer data between memory and U(S) using DMA
Monitor sensors with low energy sensor interface (LESENSE) instead of wake up and poll
4、Close unused modules/peripherals
There are modules/peripherals that are not in use at any given time for each microcontroller application. Turn these off and save energy. This also applies to the CPU itself. If the core is idle (for example, waiting for data reception), you can turn it off and save energy. This is one of the main features of the different EFM32 energy modes. Remember to consider start and stop conditions when disabling peripherals. For example, if it is completely turned off, the ADC needs some time to warm up before the conversion can be initiated. Similarly, USART simultaneous transmissions should be allowed on the progress. Thus, the receiver's shift register will not be in an indeterminate state.
5、Disable clocks to unused modules/peripherals
Even if a module/peripheral device is disabled (for example, TIMER0 stops), the various circuits in the module will still consume energy if its clock is running. Therefore, it is important to turn off the clocks of all unused modules.
6、Reduce clock frequency
Current is plotted at clock frequency. Generally speaking, a task or peripheral device should run at the lowest possible frequency.
For example, if a timer requests interruption every few milliseconds, it should be locked at several kHz instead of several MHz. This can be easily achieved by pre-scaling in CMU. Similarly, one way to choose CPU frequency is that it should be so low that the CPU will not be idle (some blanks should be added). However, in many cases, it is best to complete the current task quickly and then enter the appropriate energy model until new tasks have to be addressed.
7、Reduce working voltage
By reducing the working voltage, the energy consumption is further reduced. The Gecko series of microcontrollers can operate at low voltage.
There are absolute minimum values in the data table of each device
8、Optimization code
Optimizing code usually reduces energy consumption byincreasing the speed and efficiency of programs.A faster program spends less time in active mode, and in amore efficient program, each task executes fewer instructions. A simple way tooptimize code is to build it in release mode with the highest optimizationsettings rather than in debug mode.
9、Energy model
The EFR32 provides features that make it easier to configurelow-power peripherals and switch between energy modes. The EFR32 providesfeatures that make it easier to configure low-power peripherals and switchbetween energy modes.
Let's take a look at several modes
9.1 Operation mode (EM0)
This is the default mode. In this mode, the CPU fetches and executesinstructions from flash or RAM, all peripherals may be enabled, and theoperating power consumption is only 63 μA/MHz.
9.2 Sleep mode (EM1)
In sleep mode, the CPU's clock is disabled. All peripherals, as wellas RAM and flash memory, are available. Automated execution of multipleoperations can be achieved by using a Peripheral Reflection System (PRS) andDMA. For example, a timer can trigger an ADC conversion at regular intervals.When the conversion is complete, the result is moved to RAM by the DMA. When agiven number of conversions are performed, the DMA can request and interrupt towake up the CPU. Enter the sleep mode or the "Wait for Event (WFE)"instruction by executing "Wait for Interrupt (WFI)". Use the functionEMUILATEMEM1 () to enter sleep mode
9.3 Deep sleep mode (EM2)
In deep sleep mode, no high frequency oscillator is running, whichmeans only asynchronous and low frequency peripherals are available.This model further increases energy efficiency while still allowing arange of activities, including:
Low energy sensor interface(LESENSE) monitoring sensor,
LCD monitor drives LCD monitor,
LEUART that receives ortransmits one byte of data,
Perform address matching check.
RTC wakes up the CPU after theprogram is coded.
Analog Comparator (ACMP) tocompare voltage to programmed threshold
A GPIO to check the conversionon the I/O line.
The deep sleep mode isto first set the sleep depth in the system control register (SCR), and thenexecute the "Wait for Interrupt (WFI)" or "Wait for Event(WFE)" instruction. Use the function EMU_EnterEM2() to enter the deepsleep mode.
9.4 Stop mode (EM3)
The stop modediffers from the deep sleep mode in that no oscillator (except ULFRCO orAUXHFRCO) is running.
Modules/functions, if present on the device, canstill be used in stop mode when the appropriate clock source remains active:
I2C address
Supervision
GPIO interrupt
Pulse counter (fund)
Low energy timer (LETIMER)
Low energy sensor interface (LESENSE)
Real-time counter and calendar (RTCC)
Analog comparator (ACMP)
Voltage monitoring (VMON)
Ultra-low energy timer/counter(CRYOTIMER)
TemperatureSensor
Stop mode is the same as deep sleepmode, except that the low frequency oscillator must be manually disabled
9.5 Sleep mode (EM4H)
This feature is called EFM32'shibernate mode and wireless SoC Series 1, and is enabled using dedicatedcontrol register logic. Write the sequence 0x2, 0x3, 0x2, 0x3, 0x2, 0x3, 0x2,0x2, 0x2, 0x2, 0x2 to the EM4ENTRY bit field in the EMU_EM4CTRL register, andplace the device in hibernate mode when the EM4STATE bit is set; otherwise, Thedevice enters shutdown mode as usual. In sleep mode, most peripherals areturned off to reduce leakage power. There are some selected peripheralsavailable. System memory and registers do not retain values. The GPIO PADstatus and RTCC RAM are reserved. Wake up from EM4 sleep requires a reset tothe system and return to the EM0 activity. Sleep mode wake-up is possible, fromthe same shutdown mode to the power loop, nRESET, and the user-specified pinsource, as well as:
RTCC
CRYOTIMER
Measuretemperature outside the defined range (TEMPCHANGE)
9.6 Shutdown mode (EM4S)
The shutdown mode is the lowest energystate of the EFM32 Series 0, EFM32 or Wireless SoC Series 1 microcontroller.
The power is turned off to most devices, includinginternal RAM, and all clocks are disabled. Only recovery logic, if the GPIO padstatus is explicitly enabled, is retained. Wake up from off mode alwaysrequires a reset. When resetting from a RESETn pin or through one of a set ofdevice-specific pins explicitly enabled for this purpose, the current drawingin off mode can be as low as 20na. Some devices can replace pin-based wakeups;however, waking up from these sources requires a low-frequency oscillator toremain active, increasing the current attractiveness.