For novel ideas about building embedded systems (both hardware and firmware), join the 35,000 engineers who subscribe to The Embedded Muse, a free biweekly newsletter. The Muse has no hype and no vendor PR. Click here to subscribe.
MPLAB REAL ICE Power Monitor
Summary: Microchip's new Power Monitor is my PICk for working with their MCUs.
Microchip is one of the pioneers in developing MCUs that sip tiny amounts of current. They are also well-known for the huge number of development kits shipped each year. One of these products is the REAL ICE, a $500 tool that gives engineers a number of ways to develop and debug code for Microchip's processors.
They recently introduced an add-on for the REAL ICE. The Power Monitor is a $380 circuit board that goes between the ICE and the target board, and it eponymously measures the power used by either the target board or just the board's MCU. (Like so many such tools, the name is a misnomer. The unit measures current, not power.)
The Power Monitor is between the REAL ICE and the target board.
Specs are scarce. The datasheet indicates that it can monitor up to an amp, but is silent about the low end. When I configured the MPLAB X IDE to use the Power Monitor, it gave me two options for power ranges: 1 mA to 1 A, and 1 uA to 9 mA. That's a huge range, but it will not be of much help for profiling the low-power sleep modes available on Microchip's XLP MCUs.
The company tells me the accuracy varies between 1 to 5%, the latter being for low-end measurements. They are apparently tweaking the software to add filters to improve those numbers, but I don't see the need. Most people will use the product to find where the code consumes the most current; 10 or even 20% errors probably aren't that important.
Microchip also tells me that there are no bandwidth-limiting filters. The ADC samples at 500 KSPS, which is fabulous resolution compared to many other similar products.
The Current Monitor unsurprisingly feeds Vdd to the board being tested, and lets you select a voltage from 1.25 to 5V in 0.125 increments, all under software control. I like that fine-grained control since in battery-powered applications one must account for the varying battery voltage vs. state of charge.
Unlike the other current-measuring devices I've reviewed, this only works with Microchip's MCUs. However, it handles every one of those.
There's no manual, but the help file has a reasonable amount of (poorly-written) documentation. It's impossible to navigate unless one enters via Help's "Contents" tab, and then selects "MPLAB REAL IDEA In-Circuit Emulator/Reference/Emulator Accessories/MPLAB REAL ICE Power Monitor." The unit does come with a single-page sheet that takes one through the setup process. Don't read it; the help file has useful screen shots that makes setup a breeze.
The Power Monitor, when installed, cuts the ICE's feature set down. You can run, halt, and single-step, but advanced features like runtime watches, instrumented trace, and the like disappear. So it's really meant for use just during power analysis of a target system.
Near as I can tell from the help file, the unit has these operating modes:
Run and acquire current data. You can set the sampling rate, it seems to allow one as fast as 1 usec/sample. But there was a bug for settings below 10 usec, which has likely been fixed by the time you read this, so I couldn't test acquisitions faster than 10 usec.
Stop and display data. Current data gets uploaded to the host PC when the target code stops running.
Break on current exceeding some value. A single breakpoint can be set to stop execution if the target sucks more than a specified amount of current.
One mode is glaringly missing: there's no way to correlate the current graph with the program counter, other than by using a breakpoint. The help file does say, though, that this feature is coming.
Here's an example display:
A table provides details:
Note that both the voltage and the current are displayed. I'm not quite sure why the voltage is there since that is set statically during setup. In this case the code sequentially turns on LEDs. Look closely and the data appears a little erratic; the steps have rough spots suggesting some inaccuracy. But the errors are all lower than 2 mA, and, in this case the instrument was in the "high" (1 mA to 1 A) range. These errors are well within the accuracy specs Microchip quoted me. Like any bit of instrumentation, it's crucial to know its limits.
The graph very nicely autoscales itself.
At the 11 usec sample rate I could use (because of the bug at rates faster than 10 usec) I could detect no bandwidth-induced data degradations.
Navigation within the data is easy and very fast. Double-click on an interesting point in the graph and the table jumps right to that point; click and drag to select a region of the graph and the table fills in with just those points. The mouse scroll wheel zooms in around the cursor. In fact, it really is around the cursor: point to a section of the graph above the displayed curve and zoom, and you can completely lose the data. It's actually kind of cool how smoothly the feature works, but I'd prefer a more limited, and less confusing, zoom that keeps the data in view. The right mouse button gives several very controlled ways of expanding the data but that feature can require a lot of clicks to get the view you want.
A scroll bar pans left and right. All of the navigation is blindingly fast.
The help file is silent on this, but from examining the board it appears there are two sense resistors. One is 0.02 ohms, and the other 1 ohm. I'm guessing the relays on the board select the resistor; presumably the 0.02 ohm is selected for high-range monitoring (1 mA to 1 A) and the 1 ohm for 1 uA to 9 mA. Microchip is the first company of all of the current monitors I've looked at to get the sense resistors right. These are Dale WSR-2 devices, rated for two watts. Other products use little 1/8 or 1/4 watt resistors that will smoke the first time a user makes a mistake and applies too much power.
The good news is that with the 0.02 ohm resistor selected, even at a full amp Vdd will only drop 20 mV. I don't have access to a schematic, but there are a ton of op amps on the board; when reading a single uA across the one ohm resistor a lot of gain is needed.
You do have to exit debugging mode in the IDE to set a power breakpoint. That is not a big problem, but it does mean every time the breakpoint is changed the code has to restart from the reset vector.
I'll give this device a solid "B" grade. It does a great job of acquiring and displaying the data. Once the bug is fixed so it can handle faster sampling, and when the data gets correlated with the program counter (and I'm hoping this happens at the C source and disassembly levels) it will get an A-, the minus for having to stop the code to see the data, and for the poor documentation.
If you're developing PIC-based systems that have power limitations, Microchip's Power Monitor is a very valuable tool that I highly recommend. As a $380 add-on to the REAL ICE it's surprisingly inexpensive.
Published August 15, 2013