Measuring loop gain without breaking the loop
Measure the loop gain of a closed-loop amplifier three ways on the same circuit, see where the LC break gives the wrong phase margin, and inject a signal in a way that never changes the loop.
- Lesson
- E6.5
- Time
- 30 min
- Runs on
- ngspice
- Check
- 5 questions
A verification engineer signed off a gain-of-two amplifier, OPA-B with 200 kΩ feedback resistors, at 71.8° of phase margin, measured with the 1 TH / 1 F bench at the − input. A 10 mV step then overshot by 10.7 %, more than the plain buffer signed off at 60.1°.
- buffer (bench: 60.1°)
- gain of two (bench: 71.8°)
- Time 135.6 nsbuffer (bench: 60.1°) = 1.008 · gain of two (bench: 71.8°) = 1.106
The gain-of-two output peaks at 1.107 of its final value: 10.7 % overshoot. The buffer peaks at 1.085.
More context
More margin should mean less overshoot, so the 71.8° on the sign-off sheet was wrong.
- Time 600 nsbuffer (bench: 60.1°) = 1 · gain of two (bench: 71.8°) = 1
Both have settled. The gain-of-two output moved by 20.0 mV, the buffer by 10.0 mV.
Read the plot as a table
| Time | buffer (bench: 60.1°) | gain of two (bench: 71.8°) |
|---|---|---|
| 0 s | 1.672 µ | -657.6 n |
| 135.6 ns | 1.008 | 1.106 |
| 200 ns | 1 | 1.001 |
| 400 ns | 1 | 1 |
| 600 ns | 1 | 1 |
| 800 ns | 1 | 1 |
| 1 µs | 1 | 1 |
| 1.2 µs | 1 | 1 |
| 1.4 µs | 1 | 1 |
Every point is from a run on ngspice 42 (CL = 2 pF, Cc = 1 pF, Rz = 5 kΩ).
This bench changed the circuit at the point where it opened the loop.
Three ways to open a loop
The loop gain T is what a signal gains going once around the loop (E6.2). To measure it you send a signal in at one point and see what comes back. The bench must keep the loop's DC bias, and every impedance at the injection point must stay what it was in the closed circuit.
The first way is to cut and drive: open the loop and drive the − input from an ideal source at the bias you expect. It fails before any AC is applied. With both inputs at 0.9 V, OPA-B's output goes to 0.145 V. Its gain is about 11 000, and a fraction of a millivolt of offset is enough to send it to a rail. The closed loop is what held the output at 0.9 V.
- The closed loop
The output drives the divider, the tap drives M1's gate, and OPA-B inverts it. Each link loads the one before it.
- LC break at the output
1 TH between the output and the divider, 1 F feeding the divider from the source. The source drives the divider directly, so the output no longer carries the divider's current.
- LC break at the gate
1 TH between the tap and the gate, 1 F feeding the gate. The divider still loads the output, but the tap no longer drives the gate's capacitance.
- Injection
A 0 V source in series between the output and the divider, and a current source into the output. Nothing is removed: each link keeps its load.
Read the diagram as text
- OPA-B: gain from the − input
- Output: drives C_L and the divider
- RF and RG: load the output
- Divider tap: RF and RG in parallel behind it
- M1 gate: a small capacitance
- OPA-B → Output: drives
- Output → RF and RG: current
- RF and RG → Divider tap: divides
- Divider tap → M1 gate: voltage
- M1 gate → OPA-B: returns
The LC break opens the loop for AC only: 1 TH carries the DC bias and blocks any signal; 1 F passes the signal and blocks DC.
The second way is the LC break of E5 and E6.3. A 1 TH inductor keeps the loop closed at DC, so the bias is right, and opens it for AC. A 1 F capacitor feeds the test signal in. It is exact only where the side that drives the break has a much lower impedance than the side it feeds, at every frequency up to fu. Otherwise the break removes a load that the closed loop had.
The third way never opens anything: injection. Middlebrook's method puts a 0 V voltage source in series in the loop and a current source into one side of it. Two AC runs give two ratios, and one formula combines them into T with the loading at that point removed.
Two runs and one formula
In the first run the series source carries 1 V of AC. On one side of it the network sees vf; on the other side the op-amp's output reads vo. The voltage ratio is Tv = −vo/vf. In the second run the series source is set to 0 V of AC, so it is a wire, and 1 A of AC goes into the output node. The current ratio Ti is the current into the op-amp side over the current into the network.
Each ratio alone is wrong by the loading at that point: Tv by Zo/Zin, Ti by Zin/Zo. Together they cancel it. Middlebrook's result is T = (TvTi − 1)/(Tv + Ti + 2). Tian and co-authors later refined the method for simulators; it also takes two AC runs.
alter changes a source's AC magnitude between runs, and ac1.tv reads the first run's vector. The current i(VIA) is counted into the + node, on the network side: −i(VIA) flows into the network and 1 + i(VIA) into the op-amp.VIA fa outa DC 0 AC 1 ; 0 V in series: out -> network
IIA 0 outa DC 0 AC 0 ; current into the output node
.control
ac dec 40 10 1g
let tv = -v(outa)/v(fa)
alter VIA acmag=0
alter IIA acmag=1
ac dec 40 10 1g
let ti = -(1+i(VIA))/i(VIA)
let t_inj = (ac1.tv*ti-1)/(ac1.tv+ti+2)
.endcCheck the bench before you trust it. On an ideal loop (a gain of −100, 1 kΩ of output resistance, a 1 kΩ + 1 kΩ divider) the formula should return exactly what the circuit says. The predict item below runs it.
Where each LC break fails
Now measure the gain-of-two loop with all three benches in one netlist. Start with RF = RG = 2 kΩ, a heavy load for OPA-B's output.
- gain, injection
- gain, LC at output
- phase, injection
- phase, LC at output
- Frequency 10 Hzgain, injection = 38.88 dB · gain, LC at output = 74.82 dB · phase, injection = -0.006904° · phase, LC at output = -0.2494°
At 10 Hz injection reads 38.88 dB. The LC break at the output reads 74.82 dB: 36 dB too high.
- Frequency 7.271 MHzgain, injection = -0.003608 dB · gain, LC at output = 4.598 dB · phase, injection = -95.3° · phase, LC at output = -101.8°
Injection: |T| = 1 at 7.271 MHz with 84.7° of margin. The LC break at the gate (not drawn) agrees: 84.8°.
- Frequency 11.89 MHzgain, injection = -4.34 dB · gain, LC at output = -0.0001486 dB · phase, injection = -99.26° · phase, LC at output = -108.6°
The LC break at the output crosses at 11.89 MHz with 71.4°.
More context
With the divider fed from an ideal source, the output carries only CL. A 2 kΩ + 2 kΩ divider is the load that cut OPA-B's second-stage gain, and the bench took it away.
Read the plot as a table
| Frequency | gain, injection | gain, LC at output | phase, injection | phase, LC at output |
|---|---|---|---|---|
| 10 Hz | 38.88 dB | 74.82 dB | -0.006904° | -0.2494° |
| 100 Hz | 38.88 dB | 74.81 dB | -0.06904° | -2.493° |
| 1 kHz | 38.88 dB | 74.07 dB | -0.6903° | -23.53° |
| 10 kHz | 38.81 dB | 61.82 dB | -6.871° | -77.08° |
| 100 kHz | 34.99 dB | 42.04 dB | -50.36° | -88.85° |
| 1 MHz | 17.24 dB | 22.04 dB | -86.07° | -91.52° |
| 7.271 MHz | -0.003608 dB | 4.598 dB | -95.3° | -101.8° |
| 10 MHz | -2.806 dB | 1.652 dB | -97.67° | -105.9° |
| 11.89 MHz | -4.34 dB | -0.0001486 dB | -99.26° | -108.6° |
| 100 MHz | -25.8 dB | -25.19 dB | -152.4° | -162.9° |
| 1 GHz | -61.16 dB | -61.82 dB | -296.3° | -302.5° |
Measured on ngspice 42: the lab netlist.
With 2 kΩ the output is the weak side: the op-amp's output resistance is high and the divider's 4 kΩ is low, so breaking there hides the divider. M1's gate draws almost nothing, so the break at the gate is right.
Raise the resistors to 200 kΩ and the roles swap. Now the divider is the high-impedance side, and its tap drives M1's gate capacitance.
- gain, injection
- gain, LC at gate
- phase, injection
- phase, LC at gate
- Frequency 10 Hzgain, injection = 70.65 dB · gain, LC at gate = 70.65 dB · phase, injection = -0.1555° · phase, LC at gate = -0.1555°
At 10 Hz both read 70.65 dB. The divider barely loads the output any more.
- Frequency 11.43 MHzgain, injection = -0.00366 dB · gain, LC at gate = 0.3306 dB · phase, injection = -123.2° · phase, LC at gate = -107.6°
Injection: |T| = 1 at 11.43 MHz with 56.8° of margin. The LC break at the output (not drawn) agrees: 56.5°.
- Frequency 11.83 MHzgain, injection = -0.3581 dB · gain, LC at gate = -0.00123 dB · phase, injection = -124.3° · phase, LC at gate = -108.2°
The LC break at the gate: 11.83 MHz and 71.8°, the number on the sign-off sheet.
More context
The gate shows 38.7 fF to the divider at fu. Behind the tap sit 200 kΩ ∥ 200 kΩ = 100 kΩ: a pole near 1/(2π·100 kΩ·38.7 fF) = 41.1 MHz that the closed loop has and this bench removes. At 11.4 MHz it costs atan(11.4/41.1) = 15.5°.
Read the plot as a table
| Frequency | gain, injection | gain, LC at gate | phase, injection | phase, LC at gate |
|---|---|---|---|---|
| 10 Hz | 70.65 dB | 70.65 dB | -0.1555° | -0.1555° |
| 100 Hz | 70.65 dB | 70.65 dB | -1.554° | -1.554° |
| 1 kHz | 70.34 dB | 70.34 dB | -15.18° | -15.18° |
| 10 kHz | 61.43 dB | 61.43 dB | -69.8° | -69.78° |
| 100 kHz | 41.97 dB | 41.97 dB | -88.19° | -88.05° |
| 1 MHz | 21.97 dB | 21.98 dB | -92.81° | -91.41° |
| 10 MHz | 1.339 dB | 1.597 dB | -119.3° | -105.6° |
| 11.43 MHz | -0.00366 dB | 0.3306 dB | -123.2° | -107.6° |
| 11.83 MHz | -0.3581 dB | -0.00123 dB | -124.3° | -108.2° |
| 100 MHz | -33.57 dB | -25.17 dB | -227.9° | -161.4° |
| 1 GHz | -88.38 dB | -61.6 dB | -372.3° | -289.1° |
Measured on ngspice 42: the lab netlist with rf=200k.
| RF = RG | Injection | LC break at the gate | LC break at the output |
|---|---|---|---|
| 2 kΩ | 84.7° at 7.27 MHz | 84.8° at 7.27 MHz | 71.4° at 11.89 MHz |
| 200 kΩ | 56.8° at 11.43 MHz | 71.8° at 11.83 MHz | 56.5° at 11.50 MHz |
Phase margin and fu of one gain-of-two amplifier, from the two figure runs.
Each LC break is right for one network and wrong for the other, optimistic or pessimistic. Injection agrees with the right break in both cases, and with the hook's 10.7 % overshoot.
LC break at the gate
RFB outb tapb {rf}
RGB tapb ref {rf}
LB tapb gb 1T
CB gb acb 1
VACB acb 0 DC 0 AC 1
let t_gate = -v(tapb)/v(gb)
With 200 kΩ: pm_gate = 7.181200e+01. The divider no longer drives the gate.
Injection at the output
VIA fa outa DC 0 AC 1
IIA 0 outa DC 0 AC 0
RFA fa tapa {rf}
RGA tapa ref {rf}
* two ac runs, alter between them
With 200 kΩ: pm_inj = 5.678933e+01. Every node keeps its load.
Both from the 200 kΩ figure run.
Asked in interviews
How do you simulate the phase margin of a closed-loop circuit?
Keep the loop closed and inject. One AC run drives a 0 V series source in the loop, a second drives a current source at the same point, and Middlebrook's formula combines them. Then read fu where |T| = 1 and the phase there.
What is wrong with breaking the loop?
Cut and drive loses the DC bias: OPA-B's output went to 0.145 V. An LC break keeps the bias but removes the load at the break, so it is exact only where a low impedance drives a high one up to fu. Here it was off by 13° at one break and 15° at the other.
When is the big-inductor trick acceptable?
When the side that drives the break is far stiffer than the side it feeds, up to fu. Examples: an op-amp output driving a light network, or a low-impedance tap driving a MOS gate. Check it against injection once for each new network.
Try it
Run it and compare the three phase margins. cut_and_drive is the DC output of the copy whose inputs are both held at 0.9 V. Open Plots: the second AC plot holds the gain and phase of all three methods.
Now set .param rf=200k and predict which LC break moves away from injection. Then try 20k: at what resistor value do all three agree within a degree?
Run the netlist to draw its plots here.
cut_and_drive = 1.449269e-01 t0_inj = 3.887671e+01 t0_gate = 3.887671e+01 t0_out = 7.481906e+01 fu_inj = 7.270801e+06 fu_gate = 7.271592e+06 fu_out = 1.189129e+07 pm_inj = 8.470732e+01 pm_gate = 8.484959e+01 pm_out = 7.137364e+01 c_gate = 3.864250e-14Check yourself
Remember
- A loop-gain bench must keep the DC bias and every load at the injection point; cutting the loop and driving it loses the bias (OPA-B went to 0.145 V).
- The 1 TH / 1 F break is exact only where a stiff node drives a much higher impedance up to fu; on one gain-of-two amplifier it was 13° off at the output with 2 kΩ and 15° off at the gate with 200 kΩ.
- Middlebrook injection keeps the loop closed: a series voltage run and a shunt current run give T = (TvTi − 1)/(Tv + Ti + 2).
- Check a new bench on a loop whose T you know, and cross-check a margin against a step.