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°.

TransientTwo 10 mV steps, each scaled to its own final valueOPA-B as a buffer, and OPA-B as a gain of two with RF = RG = 200 kΩ. 1 means the output has reached its final value.
  • buffer (bench: 60.1°)
  • gain of two (bench: 71.8°)
-0.200.20.40.60.81.01.2Fraction of the step00.2 µs0.4 µs0.6 µs0.8 µs1.0 µs1.2 µs1.4 µsTimefinal value-0.200.20.40.60.81.01.2Fraction of the step00.5 µs1.0 µs1.5 µsTimefinal value
  1. 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.

  2. 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
Timebuffer (bench: 60.1°)gain of two (bench: 71.8°)
0 s1.672 µ-657.6 n
135.6 ns1.0081.106
200 ns11.001
400 ns11
600 ns11
800 ns11
1 µs11
1.2 µs11
1.4 µs11

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.

Where each bench opens the gain-of-two loopArrows show the signal going once around the loop. Each step marks where a bench puts its source.
Where each bench opens the gain-of-two loopArrows show the signal going once around the loop. Each step marks where a bench puts its source. component OPA-B gain from the − input component Output drives C_L and thedivider component RF and RG load the output component Divider tap RF and RG in parallelbehind it component M1 gate a small capacitance drivescurrentdividesvoltagereturns
  1. 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.

  2. 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.

  3. 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.

  4. 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.

The recipe from the lab. 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)
.endc

Check 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.

AC analysisLoop gain with 2 kΩ resistors: injection against the LC break at the outputGain above, phase below. Each point marks fu.
  • gain, injection
  • gain, LC at output
  • phase, injection
  • phase, LC at output
-100 dB-50 dB050 dB100 dBGain-360°-270°-180°-90°0Phase10 Hz100 Hz1 kHz10 kHz100 kHz1 MHz10 MHz100 MHz1 GHzFrequency0 dB-100 dB-50 dB050 dB100 dBGain-360°-270°-180°-90°0Phase10 Hz10 kHz10 MHzFrequency0 dB
  1. 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.

  2. 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°.

  3. 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
Frequencygain, injectiongain, LC at outputphase, injectionphase, LC at output
10 Hz38.88 dB74.82 dB-0.006904°-0.2494°
100 Hz38.88 dB74.81 dB-0.06904°-2.493°
1 kHz38.88 dB74.07 dB-0.6903°-23.53°
10 kHz38.81 dB61.82 dB-6.871°-77.08°
100 kHz34.99 dB42.04 dB-50.36°-88.85°
1 MHz17.24 dB22.04 dB-86.07°-91.52°
7.271 MHz-0.003608 dB4.598 dB-95.3°-101.8°
10 MHz-2.806 dB1.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.

AC analysisLoop gain with 200 kΩ resistors: injection against the LC break at the gateGain above, phase below. Each point marks fu.
  • gain, injection
  • gain, LC at gate
  • phase, injection
  • phase, LC at gate
-100 dB-50 dB050 dB100 dBGain-450°-360°-270°-180°-90°0Phase10 Hz100 Hz1 kHz10 kHz100 kHz1 MHz10 MHz100 MHz1 GHzFrequency0 dB-100 dB-50 dB050 dB100 dBGain-540°-360°-180°0Phase10 Hz10 kHz10 MHzFrequency0 dB
  1. 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.

  2. 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°.

  3. 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
Frequencygain, injectiongain, LC at gatephase, injectionphase, LC at gate
10 Hz70.65 dB70.65 dB-0.1555°-0.1555°
100 Hz70.65 dB70.65 dB-1.554°-1.554°
1 kHz70.34 dB70.34 dB-15.18°-15.18°
10 kHz61.43 dB61.43 dB-69.8°-69.78°
100 kHz41.97 dB41.97 dB-88.19°-88.05°
1 MHz21.97 dB21.98 dB-92.81°-91.41°
10 MHz1.339 dB1.597 dB-119.3°-105.6°
11.43 MHz-0.00366 dB0.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 = RGInjectionLC break at the gateLC break at the output
2 kΩ84.7° at 7.27 MHz84.8° at 7.27 MHz71.4° at 11.89 MHz
200 kΩ56.8° at 11.43 MHz71.8° at 11.83 MHz56.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
  1. 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.

  2. 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.

  3. 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?

SPICEngspice 42 · simulator service
Edit the netlist, then run it
Expected measurements: 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-14

Check yourself

Predict the outputAn ideal inverting amplifier of gain 100 drives a 1 kΩ output resistance, then a 1 kΩ + 1 kΩ divider whose tap is its input. Its loop gain is measured by injection between the output resistance and the divider. Type the line meas prints for T at DC (format: t_dc = 6.319360e-01).
* an ideal loop: inverting gain 100, 1 k output resistance, a 1 k + 1 k divider back to the input
EA a 0 0 tap 100
RO a o 1k
VI f o DC 0 AC 1
II 0 o DC 0 AC 0
RF f tap 1k
RG tap 0 1k
.control
ac dec 10 1k 10k
let tv = -v(o)/v(f)
alter VI acmag=0
alter II acmag=1
ac dec 10 1k 10k
let ti = -(1+i(VI))/i(VI)
let t = real((ac1.tv*ti-1)/(ac1.tv+ti+2))
meas ac t_dc FIND t AT=2k
.endc
.end
ConceptRead the 200 kΩ plot and the table. Which phase margin should go on the sign-off sheet?
ConceptWhich of these loop-gain benches leaves the DC loop open?
ConceptWith 2 kΩ resistors the LC break at M1's gate agreed with injection. Why is a gate a good place to break that loop?
ConceptWhy does injection need two AC runs?

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.