squeezing the most out of - arm community the most out of ... freescale kinetis-l freedom board...

53

Upload: doantruc

Post on 11-Mar-2018

215 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo
Page 2: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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.

Page 3: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Lecturer

Contact Info

Jacob Beningo Principal Consultant

P.O. Box 400

Linden, Michigan 48451

: [email protected]

: 248-719-6850

: Jacob_Beningo

: Beningo Engineering

: JacobBeningo

: Embedded Basics

Page 4: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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

Page 5: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Introduction

Proliferation of Low-Power Devices

Page 6: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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

Page 7: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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

Page 8: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Understanding Energy and Current

3.7 V

Page 9: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Understanding Energy and Current

Page 10: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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

Page 11: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Energy Profiling Technique

Using External Tools and Software

– IAR I-Scope probe (Real-time profiling)

– 200 uA Resolution

– 200 KHz sample rate

Page 12: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Calculating System Average Power Consumption

Fundamentals of Low Power Systems

Operating Time

Curr

ent

Dynamic Power

Power Down Wake-Up

Static Power Avg Current

Page 13: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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

Page 14: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

ST Microelectronics STM32CubeMx MCU Battery Calculator

Fundamentals of Low Power Systems

Page 15: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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

Page 16: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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

Page 17: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Baseline Energy Profile

– No sleeping

– Peripherals on

Example Application Problem

Page 18: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

System Duty Cycle

– MCU awake for short period of time

– Maximize MCU sleep time

Design Goals to Minimize Energy Profile

Page 19: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Power Modes

Page 20: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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

Page 21: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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

Page 22: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Entering Wait Power Mode

Power Modes Example

Page 23: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Entering Deep Sleep Power Mode

Power Modes Example

Page 24: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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

Page 25: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Entering Stop Power Mode

Power Modes Example

Page 26: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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

Page 27: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Entering VLLS1 Power Mode

Power Modes Example

Page 28: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Don’t forget to initialize!

Power Modes Example

Page 29: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Power Modes Example

Page 30: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Power Modes Example

Page 31: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Power Modes Example

Page 32: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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

Page 33: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Software Architecture Effects

Energy Savings Start with your Architecture!

Page 34: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Software Architecture RTOS

OSTick Suppression

Page 35: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Software Architecture Effects (ISR’s)

Wait for Interrupt (WFI) instruction

Page 36: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Software Architecture Effects (ISR’s)

Sleep on Exit

Page 37: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Software Architecture Results

Sleep on Exit

Page 38: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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

Page 39: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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

Page 40: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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

Page 41: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Tips for Energy Conservation

Tips # 4 – Throttle the System Clock (48 -> 24 MHz)

– Do you really need to execute all those cycles?

Page 42: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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

Page 43: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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

Page 44: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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!

Page 45: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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

Page 46: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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

Page 47: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Tip #9 – Use Compiler Optimizations

Tips for Energy Conservation

Page 48: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Tips for Energy Conservation

Tip #10 – Use Energy Profiling Tools

Page 49: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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

Page 50: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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

Page 51: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Conclusions

How much energy was able to be saved by using these techniques?

Page 52: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

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

Page 53: Squeezing the Most Out of - Arm Community the Most Out of ... Freescale Kinetis-L Freedom Board Overview ... Contact Information Contact Info Jacob Beningo

Contact Information

Contact Info

Jacob Beningo Principal Consultant

P.O. Box 400

Linden, Michigan 48451

: [email protected]

: 248-719-6850

: Jacob_Beningo

: Beningo Engineering

: JacobBeningo

: Embedded Basics