squeezing the most out of - arm community the most out of ... freescale kinetis-l freedom board...
TRANSCRIPT
Squeezing the Most Out of Battery Life using ARM®
Cortex®-M Series Processors Jacob Beningo, CSDP
Beningo Engineering
Place company logo here.
Recommend a white
transparent GIF logo which
cannot be larger than the
ARM TechCon logo at right.
Lecturer
Contact Info
Jacob Beningo Principal Consultant
P.O. Box 400
Linden, Michigan 48451
: 248-719-6850
: Jacob_Beningo
: Beningo Engineering
: JacobBeningo
: Embedded Basics
Session Overview
Introduction to Low Power Systems
Understanding Energy, Current and Power
Fundamentals of Low Power Systems
Example Application w/ Baseline
Minimizing Energy
– Low Power Modes
– Software Architecture Design
– Tips for Energy Conservation
– Practical Considerations
Introduction
Proliferation of Low-Power Devices
ARM® Cortex®-M Series – Upwards Upgradeable
– M0, M0+, M3, M4
– 32 bit Architecture
– Low Cost
– Connectivity
– Code Reuse
– Energy Efficient
Introduction
http://www.arm.com/products/processors/cortex-m/index.php
STM Family of Microcontrollers
Introduction
So what is the problem?
• Demand for longer battery lives
• Devices are used more often for longer periods of time
• Sensors are being deployed with no end in sight
• Batteries cost $$$
• Requires time and effort to swap them out
Understanding Energy and Current
3.7 V
Understanding Energy and Current
Understanding Energy and Current
Energy Profile Key Points
• Power profile can be calculated from A x V
• Energy Profile can be approximated by current only!
• Integrating the energy profile will provide mAh used
• Derivative of the energy profile provides instantaneous
power
• Can be used to identify heavy energy usage periods
• Can be used to estimate battery discharge time
Energy Profiling Technique
Using External Tools and Software
– IAR I-Scope probe (Real-time profiling)
– 200 uA Resolution
– 200 KHz sample rate
Calculating System Average Power Consumption
Fundamentals of Low Power Systems
Operating Time
Curr
ent
Dynamic Power
Power Down Wake-Up
Static Power Avg Current
Introduction
Function MCU
Mode
Execute
Period
Execute
Time
Current
Duty
Cycle
Average
Current
Send Data Run,
48 MHz
1 s 0.005 s 15.2 mA 0.5 % 0.076 mA
Receive
Data
Run,
32 MHz
1 s 0.005 s 10.5 mA 0.5 % 0.0525 mA
Drive LED Run,
1 MHz
1 s 0.009 s 5 mA 0.9 % 0.045 mA
Battery
Monitor
Run,
1 MHz
1 s 0.001 s 2.1 mA 0.1% 0.0021 mA
Sleep Standby 1 s 0.98 s 0.5 mA 98 % 0.49 mA
Total 0.6656 mA
Expected Battery Life = Battery mAh Rating / Avg Current
1000 Hours = 680 mAh / 0.6656 mA
Computing Average Current
ST Microelectronics STM32CubeMx MCU Battery Calculator
Fundamentals of Low Power Systems
Example Application Problem
– Mobile Medical Sensor Device
– Read Sensor Data
– Analog Sensors
– Blink System Status
– Blink blue when reading data
– Blink red when battery low
– Send data over UART once per second
– Simulates radio connectivity
Example Application Problem
Freescale Kinetis-L Freedom Board Overview
Example Application Problem
Expansion Header
Expansion Header
Kinetis-L
Capacitive
Touch
Tri-Color
LED
Accelerome
ter
Reset
Open
SDA
USB
SWD
Baseline Energy Profile
– No sleeping
– Peripherals on
Example Application Problem
System Duty Cycle
– MCU awake for short period of time
– Maximize MCU sleep time
Design Goals to Minimize Energy Profile
Power Modes
Run Mode
– CPU clocks enabled
– All peripherals enabled
– Code executing out of flash
– Internal references on
– Voltage Throttling STM32L (3 modes)
– Typical datasheet current at 3 volts is 6.4 mA
Power Modes
Wait Mode
– CPU clocks disabled
– All peripherals clocks disabled
– Code executing out of flash
– Flash doze mode enabled
– Typical datasheet current at 3 volts is 3.7 to 5.0 mA
Power Modes
Entering Wait Power Mode
Power Modes Example
Entering Deep Sleep Power Mode
Power Modes Example
Stop Mode
– CPU clocks disabled
– All peripherals clocks disabled
– Code executing out of flash
– Core and system disabled
– Typical datasheet current at 3 volts is 2.5 to 3.7 mA
Power Modes
Entering Stop Power Mode
Power Modes Example
VLPW Mode
– CPU clocks disabled
– All peripherals clocks disabled
– Low power wait mode for flash
– Flash doze enabled
– Typical datasheet current at 3 volts is 135 to 496 uA
Power Modes
Entering VLLS1 Power Mode
Power Modes Example
Don’t forget to initialize!
Power Modes Example
Power Modes Example
Power Modes Example
Power Modes Example
What can be saved by using Power Modes?
Power Modes Example
Power Mode Current Draw (mA) % Savings Runtime (hrs)*
Run 18.0 - 37.8
Wait Mode 15.9 11.6% 42.8
Deep Sleep 14.8 17.8% 46
Software Architecture Effects
Energy Savings Start with your Architecture!
Software Architecture RTOS
OSTick Suppression
Software Architecture Effects (ISR’s)
Wait for Interrupt (WFI) instruction
Software Architecture Effects (ISR’s)
Sleep on Exit
Software Architecture Results
Sleep on Exit
Tips for Energy Conservation
Tip #1 – Turn Off Unused Module and Clocks
– If it is not being used then don’t let it consume energy!
– Clock gating stops the peripheral from causing logic to switch which uses energy
Tips for Energy Conservation
Power = Energy / Time = A x V / t
A x V / t = C x F x V2 + IL * V
A / t = C x F x V + IL
Dynamic Current ~ C x F x V
Tip #2 – Lower the MCU Voltage
Tips for Energy Conservation
Tip #3 – Configure Unused I/O
– Put them in their lowest energy state
– Unused pins as inputs and pulled high or low?
– Drive unused pins high or low?
– The Cortex M0+ recommends
– Float the physical pin
– Drive low
– Or pull low with 10k pull-down
Tips for Energy Conservation
Tips # 4 – Throttle the System Clock (48 -> 24 MHz)
– Do you really need to execute all those cycles?
Tips for Energy Conservation
Stop
Peripherals
Clocks
Updated
CPU +
Peripherals
Resume
Considerations for Selecting an Optimal Frequency
– Communication Device Requirements
– Processing Performance
– Maximum peak current allow by the system
Steps for frequency throttling
Tips for Energy Conservation
Tip #5 – Use Autonomous Intelligent Peripherals
– ATMEL sleepwalking
– Setup a peripheral to monitor an event
– Periodic ISR not necessary
– Energy Micro Reflex System
– Peripherals monitor event
– Peripherals directly communicate with each other
– Can trigger other peripherals
Tips For Energy Conservation
Tip #6 – Execute the Program from RAM
– Copy Flash -> RAM on start-up
– Functions should be small
– Computationally intensive
– Beware of bus contention!
Tip #7 – Beware of Communication Channels
– Can be power hungry peripherals
– May require periodic waking
– Use DMA to lighten the Load
– Can keep the CPU asleep
– Transfer data from peripheral to memory
– Uart Serial Wake-Up
– Peripheral Sleeps until data is received
– Wakes up and then performs functions
Tips for Energy Conservation
Tips for Energy Conservation
Tip #8 – Use a Low Power Timer or RTCC
– Lower Energy Usage due to slower OSC
– Used to interrupt system and wake up from extremely
low power state
Tip #9 – Use Compiler Optimizations
Tips for Energy Conservation
Tips for Energy Conservation
Tip #10 – Use Energy Profiling Tools
Conclusions
Power Mode Current Draw (mA) % Savings Runtime (hrs)*
Run 18.0 - 37.8
Wait Mode 15.9 11.6% 42.8
Deep Sleep 14.8 17.8% 46
Deep Sleep + Peripherals Off 14.15 21.4% 48
Deep Sleep + Peripherals off +
24 MHz
13 27.8% 52.3
Deep Sleep + Peripherals off +
24 MHz + Speed Optimized
12.8 28.9% 53.2
Deep Sleep + Peripherals off +
24 MHz + Speed Optimized +
Sleep on Exit
12.8 28.9% 53.2
Optimization Table Results
Conclusions
Power Mode Current Draw (mA) % Savings Runtime (hrs)*
Run 18.0 - 37.8
Wait Mode 15.9 11.6% 42.8
Deep Sleep 14.8 17.8% 46
Deep Sleep + Sleep on Exit 13.45 25.3% 50.5
Deep Sleep + Sleep on Exit +
Peripherals off
13.40 25.5% 50.7
Deep Sleep + Sleep on Exit +
Peripherals off + 24 MHz
12.8 28.9% 53.2
Deep Sleep + Sleep on Exit +
Peripherals off + 24 MHz +
Speed Optimized
12.8 28.9% 53.2
Optimization Results Take 2
Conclusions
How much energy was able to be saved by using these techniques?
Going Further
Free 52 Low Power Design Techniques Newsletter – Weekly Session
– Tips and Tricks
– Hands-on Experiments
– Audio and Video Commentary
– Sign-up at http://eepurl.com/2xJFr
Do It Yourself
– Duplicate the Results
– Perform Experiments
– Self-Paced Workshops
– Webinars
Contact Information
Contact Info
Jacob Beningo Principal Consultant
P.O. Box 400
Linden, Michigan 48451
: 248-719-6850
: Jacob_Beningo
: Beningo Engineering
: JacobBeningo
: Embedded Basics