LCE12: How to measure SoC power


Published on

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

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

LCE12: How to measure SoC power

  1. 1. EUROPE 2012 (LCE12) How to measure SoC power Andy Green, TI Landing Team lead, Linaro
  2. 2. EUROPE 2012 (LCE12) 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...
  3. 3. EUROPE 2012 (LCE12) 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
  4. 4. EUROPE 2012 (LCE12) Section 1: Minimum Electronics primer
  5. 5. EUROPE 2012 (LCE12) [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
  6. 6. EUROPE 2012 (LCE12) [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
  7. 7. EUROPE 2012 (LCE12) [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
  8. 8. EUROPE 2012 (LCE12) [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)
  9. 9. EUROPE 2012 (LCE12) [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
  10. 10. EUROPE 2012 (LCE12) [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!
  11. 11. EUROPE 2012 (LCE12) [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
  12. 12. EUROPE 2012 (LCE12) Section 2: Measuring voltage and current
  13. 13. EUROPE 2012 (LCE12) 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”
  14. 14. EUROPE 2012 (LCE12) 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
  15. 15. EUROPE 2012 (LCE12) 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
  16. 16. EUROPE 2012 (LCE12) 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
  17. 17. EUROPE 2012 (LCE12) 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
  18. 18. EUROPE 2012 (LCE12) Shunt power dissipation selection for 165mV Eg, 1.5A max --> 100mR shunt, 1/4W rated
  19. 19. EUROPE 2012 (LCE12) 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
  20. 20. EUROPE 2012 (LCE12) 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
  21. 21. EUROPE 2012 (LCE12) 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
  22. 22. EUROPE 2012 (LCE12) 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
  23. 23. EUROPE 2012 (LCE12) 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
  24. 24. EUROPE 2012 (LCE12) 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
  25. 25. EUROPE 2012 (LCE12) 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
  26. 26. EUROPE 2012 (LCE12) 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
  27. 27. EUROPE 2012 (LCE12) 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
  28. 28. EUROPE 2012 (LCE12) 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
  29. 29. EUROPE 2012 (LCE12) 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
  30. 30. EUROPE 2012 (LCE12) 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
  31. 31. EUROPE 2012 (LCE12) 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
  32. 32. EUROPE 2012 (LCE12) 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
  33. 33. EUROPE 2012 (LCE12) 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)
  34. 34. EUROPE 2012 (LCE12) 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
  35. 35. EUROPE 2012 (LCE12) Pandaboard ES with 9 rails instrumented
  36. 36. EUROPE 2012 (LCE12) Section 3: Arm Energy Probe hardware
  37. 37. EUROPE 2012 (LCE12) 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
  38. 38. EUROPE 2012 (LCE12) 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
  39. 39. EUROPE 2012 (LCE12) Section 4: Practical board instrumentation
  40. 40. EUROPE 2012 (LCE12) 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
  41. 41. EUROPE 2012 (LCE12) 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
  42. 42. EUROPE 2012 (LCE12) 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
  43. 43. EUROPE 2012 (LCE12) 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
  44. 44. EUROPE 2012 (LCE12) Adding shunt to DC jack externally
  45. 45. EUROPE 2012 (LCE12) Adding shunt to DC jack internally Usually your DC jack exposes the + power You can cut it and bridge the cut with your shunt
  46. 46. EUROPE 2012 (LCE12) Preparing your board for measurements Use a 7-way 0.1” header for each probe (3 channels)
  47. 47. EUROPE 2012 (LCE12) Fix headers to your board Superglue the back to a spare region of the board
  48. 48. EUROPE 2012 (LCE12) Wire headers to your shunts and 0V Add 0V connection Add twisted pairs back to the shunt
  49. 49. EUROPE 2012 (LCE12) Adding SMT shunts Remove old inductor, solder the shunt in place Add the other end of the wires to the shunt
  50. 50. EUROPE 2012 (LCE12) Adding high power shunt on high current path Same deal just bigger resistor
  51. 51. EUROPE 2012 (LCE12) Section 4: Error sources
  52. 52. EUROPE 2012 (LCE12) 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
  53. 53. EUROPE 2012 (LCE12) 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
  54. 54. EUROPE 2012 (LCE12) 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
  55. 55. EUROPE 2012 (LCE12) 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
  56. 56. EUROPE 2012 (LCE12) 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
  57. 57. EUROPE 2012 (LCE12) 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...
  58. 58. EUROPE 2012 (LCE12) 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...
  59. 59. EUROPE 2012 (LCE12) 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
  60. 60. EUROPE 2012 (LCE12) Channel correlation correction effectiveness After software correction (blue X) Error less than -13%/+9% at 3.8mV
  61. 61. EUROPE 2012 (LCE12) 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
  62. 62. EUROPE 2012 (LCE12) 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...
  63. 63. EUROPE 2012 (LCE12) Section 5: Commandline Linux AEP app
  64. 64. EUROPE 2012 (LCE12) Arm-probe architecture
  65. 65. EUROPE 2012 (LCE12) 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
  66. 66. EUROPE 2012 (LCE12) Section 6: aepd and HTML5 UI
  67. 67. EUROPE 2012 (LCE12) aepd and HTML5 UI
  68. 68. EUROPE 2012 (LCE12) Aepd architecture
  69. 69. EUROPE 2012 (LCE12) 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
  70. 70. EUROPE 2012 (LCE12) 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
  71. 71. EUROPE 2012 (LCE12) 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
  72. 72. EUROPE 2012 (LCE12) 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
  73. 73. EUROPE 2012 (LCE12) 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
  74. 74. EUROPE 2012 (LCE12) 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
  75. 75. EUROPE 2012 (LCE12) “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
  76. 76. EUROPE 2012 (LCE12) 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
  77. 77. EUROPE 2012 (LCE12) All software GPL'd and available today 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...
  78. 78. More about Linaro Connect: More about Linaro: More about Linaro engineering: EUROPE 2012 (LCE12)