This post looks at how the QA101B Mixed Signal Oscilloscope and QA150 High Side Current Sense Amp can be used together to help the engineer understand their circuit operation at very low levels of current consumption. Usually, this is checked with a DVM measuring across a current sense resistor which reports an RMS reading. And that is fine for a lot of applications. But there are times when more understand of the circuit operation is needed, and the QA150 makes this possible.
The QA150 is a high-side current measuring device, designed for measuring up to 4 channels of current in-line. This means the circuit you want to measure must be broken, which is usually pretty easy on most boards designed for embedded operation
Each channel on the QA150 covers a separate range. The most sensitive covers roughly 0 to 20 mA, generating 20V of output when 20 mA is flowing through the sense terminals. The second channels is 10X less sensitive, generating 20V of output when 200 mA is flowing, the third channel is output 20V for 2A, and the forth channel is limited to about 5Arms max (5V output) for thermal reasons.
For the measurements below, note we’re using a TI launchpad for the MSP430. The power supply to the processor flows through one of the J3 jumpers, making it easy to “break” the connection and route it through the QA150. To do this, just remove the VCC jumper on J3, and take the pin from the power supply (left-most pin of the two-pin connector) and connect that to the S+ input on the QA150. The current will flow THROUGH the QA150: Into the S+ pin, through a sense resistor and out of the S- pin back into the circuit you are measuring. In the drawing below, this is the red wire.
Next, connect the S- pin to the processor supply side (green wire in drawing below). This is the current return back to the Launchpad board. Finally, you need to connect the ground of the QA150 to the ground of the DUT (Device Under Test).
The QA150 uses polarized one-way terminal blocks available from Digikey and other places. These have the Digikey Part Number of 277-2323-ND. The connectors are push-fit for most wire, meaning you can just push the wire into the back of the connector. Combined with standard jumper wires available at places like AdaFruit, Pololu and Sparkfun, it’s very quick to patch the QA150 into the DUT.
Once the DUT is connected, take the voltage output from the QA150 and connect that to your scope. Remember, the purpose of the QA150 is to precisely convert a current to a voltage. This voltage extends to ground for zero current. Most high-side current monitors don’t offer a buffered output that extends down to 0V, leaving your zero current an opamp rail drop away from 0 (30 mV or more).
Below is a simple application for the MSP430
Grace_init(); // Activate Grace-generated configuration
// >>>>> Fill-in user code here <<<<<
CCTL0 = CCIE;
_BIS_SR(LPM3_bits + GIE);
// We never get here
Above the application starts running, and the in line 9, all of the clocks are turned off except for the ~12 KHz A clock. Once line 9 is executed, the main execution stops and an ISR runs every mS.
An ISR was created on TimerA that runs at roughly a 1 KHz rate:
2: * ======== Timer0_A3 Interrupt Service Routine ========
4: #pragma vector=TIMER0_A0_VECTOR
5: __interrupt void TIMER0_A0_ISR_HOOK(void)
7: /* USER CODE START (section: TIMER0_A0_ISR_HOOK) */
8: P1OUT |= 0x2;
9: P1OUT &= ~0x2;
10: /* USER CODE END (section: TIMER0_A0_ISR_HOOK) */
Inside the ISR, we toggle a pin to indicate when we’re in the ISR (lines 8 and 9).
When the ISR runs, it first must turn on the main clock DCO. When the ISR exits, it pops the SR from the stack which kills all the clocks except the A Clock and waits again for the next Timer A interrupt.
In the scope capture below, we can see the CH1 trace is the measured current as output by the QA150. In this case, we used the “1 mA = 1V” channel on the QA150, which means that 100 mV of amplitude = 100 uA of current. As you look at the CH1 current trace, you might think it’s very noisy, but in fact you are seeing small surges of current into the processor supply pins, and those surges are being smoothed somewhat by the power supply caps.
From the plot below, we can deduce a few things:
1) The two peaks are about 4 divisions high, which is roughly 400 uA in amplitude
2) The peaks are very narrow in duration. In fact, they are so narrow we’re not seeing the true current of an MSP430 running at 16 MHz. More on that later.
3) The average reported measurement is 52.5mV, which translates to 52.5uA (reported near the top of the plot in yellow). That is our average current. The connectors on the QA150 permit you to sanity check the voltage across the sense resistor. The sense resistor is 10 ohms on the channel we’re using, and a DVM reports 0.5 mV, which indicates 50 uV. There is good agreement between a DVM measurement and the scope measurement.
Below the yellow trace, we have some logic signals that we’ve captured. At the bottom, there’s the ACLK. This is nominally 12 KHz, but in this case, it’s measured at 91.0 uS or 10.99 KHz, which is within expected range. Notice that the A Clock never shuts off.
Up from that, we can see the ISR signal. Recall our ISR simply toggled a pin when it ran. This is that toggle.
The next trace is the SMCLK. Recall this clock is gated and will start running when the MSP430 needs to run the ISR, and it will stop again when the ISR exits.
The last (topmost) trace is an interpreter, which allows us to visualize other trace information. In this case, it’s simply counting the number of rising edges displayed I by the SMCLK trace.
Below, we’ll zoom in to look at each of these in more detail.
In the capture above, you can see the ISR activity in a bit more detail. The current, in particular, is looking a bit strange—very noisy. But in fact this seems to be a legitimate flow of current. Something inside the MSP430 is running around 188 KHz—there are no DCDC converters on the board. If we look at a DC source of current, say through one of the LEDs, the noise is gone.
Note the ISR is happening at the rising edge of the 12 KHz clock. Let’s zoom in some more:
Above we’re zoomed into the intimate details of the wake-up. Note you can again see the ACLK rising. Internally, that counter clocked by the ACLK registered a match, and the DCO was started and stablized, and about 300 nS after the ACLK rising, the DCO was driving the chip at 16 MHz.We can see the bit toggle in the ISR, which is the pulse. That took 271 nS. The SMCLK_COUNT shows us that exactly 20 pulses of the SMCLK were needed to wake up, push the stack, wiggle the GPIO, pop the stack and get back to sleep. Pretty impressive what the MSP430 is doing.
Let’s return to the wakeup current pulse below:
Here we can see that the system doesn’t really require any extra current while the ISR is happening. In fact, that current is sourced by a large 10uF capacitor across the 3.6V supply. When the CPU first spins up, the current rush is coming from the big cap, and then as that cap starts to deplete more current comes from the upstream supply rail to re-charge the cap. From the plot above, it appears the that the cap is supplying the load current for the first 5 microseconds or so, and then as the cap depletes, the charge is replenished from the LDO. A 10 uF cap can provide 3 mA for 5 uS with the voltage on the cap dropping just 1.5 mV. In other words, the entire ISR is powered by the cap.
Let’s stretch the ISR pulse by a lot via a delay inside the ISR and see if we can get a feeling for the steady state current demand in the ISR:
Now we’re seeing something a bit more familiar. This is showing about 3.5 mA when running at 16 MHz. This is 218uA/MHz @ 3.6V, while TI claims 220uA at 1 MHz at 2.2V. We’re in the ballpark for sure.
But the lesson here is important: capacitors can dramatically distort what you think you’re seeing, especially for events of very short duration. The bandwidth of the QA150 is extremely high, well north of 500 KHz, meaning you will potentially seeing things that you’ve not been able to see before.
What about the 3 other channels?
In a normal system measurement, you’d probably also want to be making a measurement at the output of the 3.3V DCDC or LDO, as well as the input to the regulator if you were keen to understand the efficiency during various modes of operation. And finally, you could also instrument the USB current of the product you were working on. The QA150 can measure up to 10A on the fourth channel—plenty to capture a GSM, Wifi or UMTS burst. The forth channel connectors have a continuous current rating of about 5A, which you should respect otherwise things could get too hot.
This post was a short introduction to the extremely demanding world of detailed current measurements made possible by the QA150. Combined with a good mixed signal scope, it’ll reveal aspects of your embedded design that were previously difficult to see.