AVR1010: Minimizing the power consumption of Atmel AVR XMEGA devices Features • • • • • • • • Sleep modes Clock prescaling and source switching Power Reduction Registers RTC clock source State of digital I/O Watchdog Brown Out Detector JTAG interface 8-bit Microcontrollers Application Note Preliminary 1 Introduction The Atmel® AVR® XMEGA® devices are capable of achieving extremely low power consumption, which is required by both portable electronics and other batterypowered applications.
Reducing the power consumption to a minimum Though many factors affect the power consumption, some will naturally affect more than others. Listed below are the most important factors, with recommendations and considerations. 2.1 Operating voltage The power consumption is proportional to the square of the device’s supply voltage, which should therefore be kept as low as possible.
AVR1010 Table 2-1: Available sleep modes for XMEGA. The three most POWER-DOWN: commonly used modes are IDLE, POWER-SAVE and • In IDLE, most peripherals are still operating – only the Atmel® AVR® CPU core and non-volatile memories (Flash and EEPROM) are stopped. The DMA controller and Event system are still active in this mode, allowing for e.g. AD conversions and transfers via the USART to continue, even though the CPU is not operating. The device can be woken up by all interrupts.
Minimize power consumption by using the deepest allowable sleep modes at any time, and running as fast as possible to minimize time spent in ACTIVE mode. 2.4 Clock Prescaling Although it is recommended to run the CPU as fast as possible to minimize the time spent in ACTIVE mode, there are situations where it is better to reduce the clock rate. These situations commonly involve waiting in ACTIVE or IDLE mode for something that takes a fixed amount of time, e.g. serial communication.
AVR1010 Minimize power consumption by switching clock sources rather than relying on prescaling alone for reducing clock rates. 2.6 Wake-Up Delays When the device wakes up from sleep modes deeper than IDLE (with the exception of the two STANDBY-modes), the system clock source must stabilize before the CPU starts to operate. This introduces a short delay which depends on the selected clock source. If an internal RC oscillator or external clock is used, the start-up delay is 6 cycles.
It is recommended to use an external 32kHz crystal with X32KLPM enabled. This gives lower power consumption than the ULP, yet greater accuracy than the internal RC oscillator. This oscillator may also be used as the system clock source, if such a low frequency is acceptable. Table 2-2. Examples of accuracy and current consumption for RTC w/ clock sources. Oscillator Accuracy3 Current consumption1,3 ULP +/- 30% 1µA +/- 1% 30µA +/- 0,001% (10 ppm) 0.6µA RC32k 2 TOSC (32 kHz XTAL) Notes: 1.
AVR1010 Note that the GPIO registers are defined as volatile, so temporary variables should in some cases be used when manipulating variables stored in these registers: Otherwise, the performance gain will be lost. Use the General Purpose I/O registers for variable storage to minimize power consumption. 2.12 Watchdog The Watchdog is basically a timer with a separate clock source. It will, if enabled, contribute to the power consumption in sleep.
are powered down in ACTIVE mode, just as they are in any sleep mode. These power reduction modes will not affect power consumption in sleep. If the CPU attempts to access a non-volatile memory with power reduction mode on, the CPU is halted for a time interval corresponding to wake-up from IDLE sleep while the memory is re-activated. NB: There is an errata regarding Flash power reduction mode and sleep.
AVR1010 consumption for the different Atmel® AVR® XMEGA® devices. The code steps through the following modes, staying for 8 seconds in each: • ACTIVE • IDLE • POWER-SAVE • POWER-DOWN Note that the device will stay in POWER-DOWN, since an external interrupt is required to wake the device up from this sleep mode. 3.2 Sleep Example All the sleep_example.c examples are meant as “code skeletons”.
Note that the main loop of the application should be responsible for requesting the sleep manager to put the device to sleep, as shown in Figure 4-1. Figure 4-1: Suggested use of the sleep manager in main(). main() SLEEPMGR_Init() Other initialization and setup. Handle pending data/events. Main loop SLEEPMGR_Sleep() If an interrupt occurs while the sleep manager is about to put the device to sleep, it will instantly wake up again and execute the corresponding ISR.
AVR1010 The list of sleep modes is defined in config_sleepmgr.h. By default, the sleep manager supports the following modes (in the order listed): • Idle – SLEEPMGR_IDLE • Extended standby – SLEEPMGR_ESTDBY • Power-save – SLEEPMGR_SAVE • Standby – SLEEPMGR_STDBY • Power-down – SLEEPMGR_DOWN If your application does not need all sleep modes, the list should be modified to save both memory and execution time. Refer to the configuration file (config_sleepmgr.h) for information on how to modify the list.
Figure 6-1: Location of IXM and shunt on Xplain board. 6.2 XMEGA with 32-Bit RTC Atmel® AVR® XMEGA® with the battery backup module and 32-bit RTC only allow for the external 32kHz crystal oscillator to be used as clock source for the RTC. This crystal must therefore be connected for wake-up at timed intervals to be possible.
Atmel Corporation 2325 Orchard Parkway San Jose, CA 95131 USA Tel: (+1)(408) 441-0311 Fax: (+1)(408) 487-2600 www.atmel.com Atmel Asia Limited Unit 01-5 & 16, 19F BEA Tower, Milennium City 5 418 Kwun Tong Road Kwun Tong, Kowloon HONG KONG Tel: (+852) 2245-6100 Fax: (+852) 2722-1369 Atmel Munich GmbH Business Campus Parkring 4 D-85748 Garching b. Munich GERMANY Tel: (+49) 89-31970-0 Fax: (+49) 89-3194621 Atmel Japan 9F, Tonetsu Shinkawa Bldg.