LCE12: How to measure SoC power
Upcoming SlideShare
Loading in...5
×
 

LCE12: How to measure SoC power

on

  • 671 views

Resource: LCE12

Resource: LCE12
Name: How to measure SoC power
Date: 01-11-2012
Speaker: Andy Green

Statistics

Views

Total Views
671
Views on SlideShare
671
Embed Views
0

Actions

Likes
0
Downloads
18
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

LCE12: How to measure SoC power LCE12: How to measure SoC power Presentation Transcript

  • EUROPE 2012 (LCE12) How to measure SoC power Andy Green, TI Landing Team lead, Linaro
  • EUROPE 2012 (LCE12) www.linaro.org Introduction I lead Linaro TI Landing Team at Linaro Mainly been working on hardware the last 25 years TI very interested in power optimization SoCs have a lot of schemes needing software support So there's a lot of things we work with that might, or should impact system power We need to observe and measure those expected impacts Many people working in different areas can benefit from looking at exact detail of where power is going in the system...
  • EUROPE 2012 (LCE12) www.linaro.org Sections 1: Minimum Electronics Primer 2: Measuring voltage and current 3: Arm Energy Probe hardware 4: Practical Board instrumentation 5: Error Sources 6: Commandline Linux AEP app 7: aepd and HTML5 UI } } }Hardware Software
  • EUROPE 2012 (LCE12) www.linaro.org Section 1: Minimum Electronics primer
  • EUROPE 2012 (LCE12) www.linaro.org [1/7] What is voltage? Voltage is like the “pressure” electrons have to go somewhere They might not be going anywhere at any particular time, but the pressure is still there In a battery, electrons are chemically separated out to the – side and prevented from leaking on to the + side through the inside So there's “pressure” built up for electrons on the – side to want to go to the + side
  • EUROPE 2012 (LCE12) www.linaro.org [2/7] What is voltage? Voltage is measured in Volts / V In SoCs we usually deal with 0.9 – 5V range Typical transistors want to switch around 700mV USB = 5V SoC IO = 1.8V LED = 1.2V DDR = 1.29V ARM Vcore = 0.9 – 1.6V (DVFS) L-ion battery cell = 3.7V We can measure voltage using a voltmeter of some kind
  • EUROPE 2012 (LCE12) www.linaro.org [3/7] What is load? Load is the thing we put between a voltage to make current flow and get work done. Your dev board is a “load”. It has a resistance, measured in Ohms / R
  • EUROPE 2012 (LCE12) www.linaro.org [4/7] What is current? Current is a measure of electrons flowing through the circuit It's measured in Ampere / A Sometimes the symbol I is used to talk about current How much current flows is a function of voltage and load resistance (I = V / R) A “short circuit” is ~0R load, max current flows Examples USB2 device Max current = 500mA, USB3 = 900mA Typical max 5V adapter current = 2A LED current = 1 – 10mA L-ion battery cell = 2.5A (cf Capacity 2.5A/h)
  • EUROPE 2012 (LCE12) www.linaro.org [5/7] So...what is power? Power = current x voltage... P=IV Voltage or current tends to increase or decrease == power is increasing or decreasing accordingly P=IV == V2 /R so V / 2 --> P / 4 This is why DVFS is so interesting... Measured in Watts / W Examples: USB device max power 5V x 500mA = 2.5W Typical AC adapter: 5V x 2A = 10W LED: 1.2V x 1 – 10mA = 1.2 – 12mW L-ion battery cell: 3.7V x 2.5A = 9.25W Cf Capacity 9.25W/h
  • EUROPE 2012 (LCE12) www.linaro.org [6/7] Why talk about power and not current? There are usually many different power domains in a system, each supplied by its own “power rail” at different voltages By converting voltage & current measurements to power, you can compare power from different voltages or parts of the system For that reason, although V and A may be interesting all power reporting should be done in W, so the numbers are comparable In the end you always want to compare individual rail power to overall system power, which is definitely at a different voltage... Watts only!
  • EUROPE 2012 (LCE12) www.linaro.org [7/7] Summary Voltage (V) is “pressure” for electricty to flow Current (A) measures the flow of electricity Load (R) is what the current flows through Power (W) is the Voltage x the Current, or pressure x flow We need to measure rail voltage and current, to end up with a power figure in W
  • EUROPE 2012 (LCE12) www.linaro.org Section 2: Measuring voltage and current
  • EUROPE 2012 (LCE12) www.linaro.org Common-mode voltage measurement Voltage is relative between two points (it's also known as “potential difference”) One side of the input voltage is decreed the “0V” reference to which all the other system voltages are compared (it's the – side of the DC input by convention). Common-mode voltage is the voltage difference between your rail and “0V”
  • EUROPE 2012 (LCE12) www.linaro.org Measuring current with an Ammeter An Ammeter (current meter) can be implemented as a sensitive voltmeter measuring the difference in voltage across an internal series shunt resistor You interrupt the circuit to add the meter in series, so the current passes through the meter This is how your multimeter works in A range
  • EUROPE 2012 (LCE12) www.linaro.org Measuring current with a voltmeter Actually you could just add the shunt resistor yourself and use a sensitive voltmeter That has advantages that the high current path does not go via the meter cables any more, just straight through the shunt resistor When you're not measuring, the shunt resistor stays there and things work as normal
  • EUROPE 2012 (LCE12) www.linaro.org So to measure power in a rail You have to break or interrupt the rail Often there's a convenient way to do that without cutting Insert a shunt resistor in series Wire up one voltmeter to measure rail voltage vs 0V Wire up another voltmeter to measure the voltage across the shunt to find the current (knowing the shunt resistance, I=V/R) Multiply the common-mode voltage and current together to get power
  • EUROPE 2012 (LCE12) www.linaro.org Shunt Resistance Selection The main criteria is voltmeter sensitivity For AEP, its sensitive voltmeter for shunt measurements tops out at 165mV, so that is the voltage drop over the shunt we want for worst case current For larger currents, we also have to take care that the shunt can cope with the power it dissipates as heat Next is the shunt selection chart for 165mV drop at various maximum currents
  • EUROPE 2012 (LCE12) www.linaro.org Shunt power dissipation selection for 165mV Eg, 1.5A max --> 100mR shunt, 1/4W rated
  • EUROPE 2012 (LCE12) www.linaro.org Rule of thumb for shunts For AEP usage (165mV shunt range) Many Watts like DC jack, or high power rails 0.22R or 0.1R, 1W or more For normal rails 0.47R 0.25W - 0.5W
  • EUROPE 2012 (LCE12) www.linaro.org Choosing lower value shunt than necessary For some rails, like CPU DVFS rails, shunt loss at full scale of voltmeter may be too much to lose Eg, 165mV of 900mV rail is 18% loss You can select a shunt that drops less than full scale at the highest expected current Eg, only drop 50mV of 900mV rail worst case It works, but because you only use part of the range the measurement ADC step size is larger, noise goes up and precision goes down Trick... if you didn't plan on lower value shunt needed, you can double-up two or more in parallel to get R/n
  • EUROPE 2012 (LCE12) www.linaro.org Unipolar vs Bipolar voltmeters Unipolar or “1-quadrant” can just measure positive voltage or current Bipolar or “4-quadrant” can measure +/- common-mode voltage and +/- current +/- current very useful for battery, +/- voltage less so Bipolar may have problems determining what “zero” looks like Unipolar should do better with “zero” but doesn't always
  • EUROPE 2012 (LCE12) www.linaro.org How regulators work (or not) Regulators operate in a loop They allow more or less input to the output according to what it senses at the output They have an internal or external “sense” pin which lets them watch the output and then act to make sure it stays at the right voltage
  • EUROPE 2012 (LCE12) www.linaro.org Difficulties with regulation Wiring has “inductance” which affects the signal or power as the load changes Additional inductance of meter and wiring mean the regulator cannot sense load changes properly SoC will crash
  • EUROPE 2012 (LCE12) www.linaro.org Modern Regulation strategies help For high power, dynamic loads, SoCs provides a separate “sense” pin for the regulator connected right at the load, on the die Regulator does what's needed to keep that regulated
  • EUROPE 2012 (LCE12) www.linaro.org Input-side measurements The extra impedence is one problem Another is the voltage drop from the shunt, 150mV is not much but on a 900mV DVFS rail, it will stop the SoC working Both problems can be avoided by measuring the input side of the regulator instead You don't see output voltage then though Your power measurement include regulator losses
  • EUROPE 2012 (LCE12) www.linaro.org Regulator efficiency Switching regulators are designed for peak efficiency (up to 95%) at a particular load For different loads, efficiency may decline below 50% Linear regulators are simpler but can be grossly inefficient Current at input side same as the output side If input side voltage is much higher than output, large power losses as heat result Input – output delta is called “dropout voltage” Only useful at low dropout voltage and low currents Used in sensitive analogue circuits though, since they do not introduce switching noise
  • EUROPE 2012 (LCE12) www.linaro.org Measurement bandwidth How many samples per second do you need to analyze current used by an SoC regulator? Modern regulator switching frequency tends towards a few MHz, if you measure input of regulator this is its “clock frequency” Higher switching frequency allows use of smaller inductors Load only visible at input for part of switching cycle --> load is typically modulated at a few MHz. So sample rate > ~5Msps not useful Spread spectrum and duty-cycle modulation also in use Smoothing and reservoir capacitors hide short load bursts, but all output load must appear at input, perhaps delayed You can see plenty at 10ksps
  • EUROPE 2012 (LCE12) www.linaro.org Power tree The DC input jack and each regulator supplies a “rail” Some designs still use a metal “rail” or “bus bar” to distribute the power around the circuit, hence the name One or more device connects to the rail to consume power from it Sometimes it is other regulators to produce a new rail supplied by the parent one, ie, a power tree
  • EUROPE 2012 (LCE12) www.linaro.org Power tree vs regulator efficiency Ideally you add shunts and measure power on all rails If rails go to several interesting places, you would want to add individual shunts for power to each device You can also measure the input side of the regulator that supplies the rails If you have power measurements on both sides of the regulator, you can easily see its efficiency
  • EUROPE 2012 (LCE12) www.linaro.org Four measurement strategies Here are four common measurement strategies DC IN Indirect output-side regulator measurements Shunts on all SoC rails Shunts on all board assets
  • EUROPE 2012 (LCE12) www.linaro.org 1/4: DC input Easiest rail to instrument Doesn't need changes to board itself Ultimately everything that consumed power got it from the power input, by one route or another Every activity on the board consumes power But it can be hard to interpret “why” or where the power was used if all you can see is one total number If multiple activities are ongoing, you can't tell between them But it's an easy and quick way to start You can use it for “delta” comparison, same setup before and after a change you want to test There's uncertainty any changes are down to your delta Take note of the error sources section later
  • EUROPE 2012 (LCE12) www.linaro.org 2/4: Indirect output-side measurements Some SoC rails under DVFS control are interesting, but it might not be possible to instrument them directly Instead you can instrument the input side of their regulator as discussed, and find the current (including regulator overhead) You can use a second channel then to monitor just the common-mode voltage on the output side (not current) In that way you can infer output-side current and voltage information without changing the output side
  • EUROPE 2012 (LCE12) www.linaro.org 3/4: shunts on all SoC rails (input side) SoC vendor primarily interested in SoC power consumption Insight into exact path for extra power consumption (eg DDR)
  • EUROPE 2012 (LCE12) www.linaro.org 4/4: shunts on all board assets Most ideal scenario, shunts on all power consumption in exact detail, using many channels Samsung Origen breaks power tree into 14 shunts... perfect Individual shunts for GPS unit, for example This lets you answer questions like, “exactly how much power is consumed by xxx?”, where XXX might be GPS in standby 3G module when connected to tower but not in use WLAN module over various power modes HDMI PHY in use and standby USB PHY, USB 5V generator etc etc The more rails you have numbers for, the less uncertainty in the remaining unknown power
  • EUROPE 2012 (LCE12) www.linaro.org Pandaboard ES with 9 rails instrumented
  • EUROPE 2012 (LCE12) www.linaro.org Section 3: Arm Energy Probe hardware
  • EUROPE 2012 (LCE12) www.linaro.org Scaleable USB connectivity 3 channels per probe As many probes as you need Appear as ttyACM serial ports automatically No built-in serial number or other way to tell them apart... care needed to make sure the right probe maps to the right ttyACM number Has a known serial protocol
  • EUROPE 2012 (LCE12) www.linaro.org Arm Energy Probe architecture Three channels of 2 voltmeters each 0 – 30V range Common-mode voltage 0 – 165mV range Amplified (x20) to increase sensitivity cross-shunt voltage measurement To turn into current value, need to know Rshunt
  • EUROPE 2012 (LCE12) www.linaro.org Section 4: Practical board instrumentation
  • EUROPE 2012 (LCE12) www.linaro.org Steps to instrument a board Study schematic to find where to place shunts Estimate correct shunt size and resistance Place one 7-pin header per AEP Wire up ground pins Place shunts Wire up shunts to header pins
  • EUROPE 2012 (LCE12) www.linaro.org Reading Schematics Schematics are drawings of how the components of the electronic design are connected Boxy things might be a chip, or part of a chip Boxy things have a name, like U5 (IC 5) or R7 (Resistor 7) On the PCB, the device will have the matching name nearby Lines are connections, made into copper lines on the PCB Lines can be named, wherever the same name is seen will be connected together on the PCB If you provide the board schematic to an EE, he can tell you where it's possible to place your shunts
  • EUROPE 2012 (LCE12) www.linaro.org Input-side inductors Usually possible to replace these with shunt without cutting Used to attenuate regulator RF switching emissions leaking on to power cable, not critical for operation
  • EUROPE 2012 (LCE12) www.linaro.org AEP connector 7-pin: 3 x 2 sense leads, 1 x 0V reference lead Orientation of sense leads on shunt matters Doesn't break if it's wrong, but numbers will be wrong (near 0) White lead needs to go on “before” side of shunt
  • EUROPE 2012 (LCE12) www.linaro.org Adding shunt to DC jack externally
  • EUROPE 2012 (LCE12) www.linaro.org Adding shunt to DC jack internally Usually your DC jack exposes the + power You can cut it and bridge the cut with your shunt
  • EUROPE 2012 (LCE12) www.linaro.org Preparing your board for measurements Use a 7-way 0.1” header for each probe (3 channels)
  • EUROPE 2012 (LCE12) www.linaro.org Fix headers to your board Superglue the back to a spare region of the board
  • EUROPE 2012 (LCE12) www.linaro.org Wire headers to your shunts and 0V Add 0V connection Add twisted pairs back to the shunt
  • EUROPE 2012 (LCE12) www.linaro.org Adding SMT shunts Remove old inductor, solder the shunt in place Add the other end of the wires to the shunt
  • EUROPE 2012 (LCE12) www.linaro.org Adding high power shunt on high current path Same deal just bigger resistor
  • EUROPE 2012 (LCE12) www.linaro.org Section 4: Error sources
  • EUROPE 2012 (LCE12) www.linaro.org Error sources All measured numbers are just bullshit until: You know what they are supposed to measure / mean You can repeat the meaurements Different day / test channel / board / temperature They are sane If you measure total system power and one rail measurement is higher, something is broken If you know zero power is in use, does it say 0.000W? You have a rough error budget for how the numbers were arrived at Even when the numbers have a pedigree, +/- 10 - 20% vs absolute accuracy is a reasonable assumption If you have access to lab-calibrated, absolutely accurate equipment to compare them with, you can trust them more
  • EUROPE 2012 (LCE12) www.linaro.org Concept of repeatability Numbers that cannot be repeated under similar test conditions contain error Need to understand why and how much, can still be usable Ultimately if it's not repeatable, it's not measuring what you thought it was
  • EUROPE 2012 (LCE12) www.linaro.org Zero offset Bits of the circuit, the shunt, the measuring device drift with age and temperature Here's what happened to “0mA” when I turned the air conditioning on, over 15 minutes
  • EUROPE 2012 (LCE12) www.linaro.org Effect of temperature on measuring device Shunt resistance is sensitive to temperature Take care about self-heating at high currents too Different resistor chemistries act different, SMT ones seem better Adc Shunt voltage amplifier Resistor reaction to temperature Ntc / ptc networks
  • EUROPE 2012 (LCE12) www.linaro.org Measurement bandwidth The rate of sampling can also impact results At 10Ksps, events significantly faster than 100uS may be missed or under-reported If you're unlucky load changes at a rate that is a multiple of the sample rate can lead to aliasing When measuring at the input side of the regulator, these load changes are themselves sampled by the switching action of the regulator Generally even fast load changes are averaged fairly well
  • EUROPE 2012 (LCE12) www.linaro.org Linearity of ADC + shunt amp Supposed to ignore common-mode voltage Measure the same 2mA for 2mA at 1V, as 2mA at 5V But this is “0mA” measured at different common-mode voltages...
  • EUROPE 2012 (LCE12) www.linaro.org Silicon power consumption over temperature Silicon switching efficiency is a function of temperature 23% (1.9W – 2.34W) increase in consumption for same cpuburn just from die temperature rise from 30°C – 60°C Repeatability...
  • EUROPE 2012 (LCE12) www.linaro.org Differences between channels Uncorrected (except zero offset) measurement of same 3.8mV shunt voltage (red line) using 12 channels in turn Huge variation of reported numbers by channel
  • EUROPE 2012 (LCE12) www.linaro.org Channel correlation correction effectiveness After software correction (blue X) Error less than -13%/+9% at 3.8mV
  • EUROPE 2012 (LCE12) www.linaro.org AEP-specific problems with low voltage range I mapped out the measured vs real results for different common-mode voltages and currents in “2D” These correction tables are applied in the GPL software
  • EUROPE 2012 (LCE12) www.linaro.org Error budget estimation Actual resistance of shunt is not what is marked on the resistor due to manufacturing process spread Typ +/- 5%, +/- 1% available ...and it varies by temperature... Typical SMT (Yaego RL0805) 470mR changes by +300ppm / °C 10°C change is +1.4mR (0.3%) ... so conversion of shunt voltage to current has ~+/- 6% (2% for 1% resistors) uncertainty Channel current differences are around +/- 10% (at 10mA) even after correction Unknown ADC offset and linearity errors In AEP case, numbers below a few mA are almost certainly wrong due to linearity problems...
  • EUROPE 2012 (LCE12) www.linaro.org Section 5: Commandline Linux AEP app
  • EUROPE 2012 (LCE12) www.linaro.org Arm-probe architecture
  • EUROPE 2012 (LCE12) www.linaro.org Architecture Synchronizes sampling across multiple energy probes Has a text config file defining information about each probe channel (Rshunt etc) Outputs ascii numbers in column format Appends columns to stdin if present Gnuplot-friendly output Autozero support Trigger support to synchronize capture to interesting events Probe sample capture happens in forked process decoupled from sample consumer code
  • EUROPE 2012 (LCE12) www.linaro.org Section 6: aepd and HTML5 UI
  • EUROPE 2012 (LCE12) www.linaro.org aepd and HTML5 UI
  • EUROPE 2012 (LCE12) www.linaro.org Aepd architecture
  • EUROPE 2012 (LCE12) www.linaro.org Websockets advantages Realtime, immediate graphical update from aepd link 600px, up to 24fps == see all 10Ksps samples “power scope” Local or remote network link for browser
  • EUROPE 2012 (LCE12) www.linaro.org Generic sample interface Allows integration of alternate measurement hardware Floating-point voltage and current Posix semaphore and shared memory sample buffer architecture Arm Energy Probe support provided
  • EUROPE 2012 (LCE12) www.linaro.org All samples captured All samples of all channels captured to a spool file 120s buffer by default Lot of storage involved Browser views individually view the spool buffer at different timescales and positions in time Different from oscilloscope etc with only short display buffers Doesn't matter if you “miss” an event, you can just scroll back
  • EUROPE 2012 (LCE12) www.linaro.org Averaging scheme in the storage ringbuffer Spool buffer is arranged so it's possible to get an instantaneous average for any range of samples Every sample always contributes to the average Allows immediate changes to “time zoom” in the UI
  • EUROPE 2012 (LCE12) www.linaro.org Smart comparing of power tree Understands parent / child (supply / consumer rail) relationship of monitored rails By default, “top parent” supply shown “in the background”, and the child rails on top of each other in the foreground At high zoom, you can see noise on top of noise... This lets you see any delta between the known total power and the known child supply power Stuff you are not capturing Regulator efficiency loss Can also see individual rails by clicking on the key This is useful to see minimal noise on the rail
  • EUROPE 2012 (LCE12) www.linaro.org Calipers At the top of the canvas are two slideable “calipers” What's between these calipers is averaged and reported in the stats table at the right Updated at 10Hz Accurate time measurement of power events Accurate averages across selected power events
  • EUROPE 2012 (LCE12) www.linaro.org “Search” (This is not finished yet...) Different paradigm than oscilloscope, since operates on deep, complete buffer post-capture “fades out” different parts of dataset based on power level search criteria Determine duty cycle of matching / non-matching regions Get power averages just for matching regions
  • EUROPE 2012 (LCE12) www.linaro.org Uses of deep buffer 100% capture True analysis of boot timing from first power to various activities in boot, in addition to power involved Can't be replicated by “from inside” measurements
  • EUROPE 2012 (LCE12) www.linaro.org All software GPL'd and available today git://git.linaro.org/tools/arm-probe.git Need AEP Instrument your board with shunts Linux box to host AEPs on USB and aepd Google Chrome (best HTML5 implementation) Works on Android Chrome as well Expected to be useful as basis for vendor in-house power monitoring tools in future GPL project...
  • More about Linaro Connect: connect.linaro.org More about Linaro: www.linaro.org/about/ More about Linaro engineering: www.linaro.org/engineering/ EUROPE 2012 (LCE12)