Capstone: compensate a two-stage op-amp
Compensate a two-stage op-amp so that it meets a phase-margin and bandwidth brief over a range of loads, find out what the textbook route costs, and verify the answer with steps at every load.
- Lesson
- E6.6
- Time
- 40 min
- Runs on
- ngspice
- Check
- 5 questions
A two-stage op-amp met 60° of phase margin with the 2 pF load of its datasheet bench. In the product it drove 5 pF of wiring, and a 10 mV step overshot by 26.7 %. The load is part of the loop, so a margin measured at one load holds only at that load.
- CL 2 pF
- CL 5 pF
- Time 121.6 nsCL 2 pF = 1.083 · CL 5 pF = 1.107
With 2 pF the output peaks at 1.085 of its final value: 8.5 % overshoot, the 60° loop of E6.4.
- Time 131.1 nsCL 2 pF = 1.031 · CL 5 pF = 1.264
With 5 pF the same op-amp peaks at 1.267: 26.7 % overshoot, and it rings before it settles.
Read the plot as a table
| Time | CL 2 pF | CL 5 pF |
|---|---|---|
| 0 s | 1.672 µ | 1.672 µ |
| 121.6 ns | 1.083 | 1.107 |
| 131.1 ns | 1.031 | 1.264 |
| 200 ns | 1 | 1.017 |
| 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.
The brief and the worst load
Your task is to compensate OPA-B, the two-stage op-amp of E5.5, as a buffer. The load is anywhere from 1 pF to 5 pF.
| Requirement | Limit | How it is measured |
|---|---|---|
| Phase margin | ≥ 60° at every load from 1 to 5 pF | 1 TH / 1 F bench, fu where |T| = 1 |
| Unity-gain frequency fu | ≥ 10 MHz at every load | the same run |
| 10 mV step overshoot | ≤ 10 % | closed-loop buffer, transient |
| Bias | the 20 µA reference and stage one unchanged | operating point |
The brief. A 10 mV step stays small enough that the buffer never slews (E5.6).
Start with the compensation of E6.4, Cc = 1 pF and Rz = 5 kΩ, and measure it at three loads. At 1 pF it has 75.3° at 25.29 MHz, at 2 pF 60.1° at 21.43 MHz, and at 5 pF only 41.4° at 15.25 MHz.
The reason is the output pole, p2 ≈ gm6/(2πCL). With gm6 = 393.4 µS it sits near 62.6 MHz at 1 pF and falls to 12.5 MHz at 5 pF, five times lower, while fu falls only from 25.3 to 15.3 MHz. For a two-stage op-amp the heaviest load is the worst case.
A one-stage OTA behaves the other way. Its only high-resistance node is the output, so CL sets its dominant pole (E5.3): more load lowers fu and leaves more margin.
The textbook route and its price
The textbook method cancels the zero with Rz = 1/gm6 and keeps p2 at least 2.2 fu at the worst load. At 5 pF that means fu ≤ 12.5 MHz/2.2 = 5.7 MHz, below the brief. Measure it anyway: Cc = 4 pF with Rz = 2.54 kΩ gives 62.2° at 5.77 MHz. The hand estimate was right.
To raise p2 you need more gm6, which means more second-stage current. Widen M6 and M7 together by 2.5 times (80/1 and 40/1) so the offset rule of E5.5 still holds. Now gm6 = 986.3 µS, so Rz = 1/gm6 ≈ 1.01 kΩ, and Cc = 2 pF gives 61.4° at 11.62 MHz at 5 pF. The supply current rises from 79.54 µA to 141.3 µA: 254 µW instead of 143 µW.
There is a second way, with no extra current. E6.4 showed that Rz above 1/gm6 turns the zero into a left-half-plane zero at 1/(2πCc(Rz − 1/gm6)), which adds phase. Put that zero near the 5 pF output pole and it cancels much of that pole's lag where it matters most.
- Find the worst case
The output pole falls with CL, so 5 pF decides the design.
- The textbook route
With the zero cancelled, 60° at 5 pF allows only 5.77 MHz. Doubling the bandwidth needs about 2.5 times the second-stage current.
- Use the zero
A left-half-plane zero near p2 recovers the phase at the original current. Then verify every load, the step, and Rz 20 % off.
Read the diagram as text
- Brief: 60°, 10 MHz, 1 to 5 pF
- Worst load: 5 pF: p2 near 12.5 MHz
- Cancel the zero: Rz = 1/gm6: 5.77 MHz
- More current: 2.5x stage two: 254 uW
- Use the zero: Rz = 8 k, Cc = 1.75 pF
- Verify: every load, a step, Rz +-20 %
- Brief → Worst load: find
- Worst load → Cancel the zero: try
- Cancel the zero → More current: too slow
- Cancel the zero → Use the zero: or
- Use the zero → Verify: measure
- More current → Use the zero: compare
Every number is from the comparison run in the next figure.
- E6.4: 1 pF, 5 kΩ
- textbook: 4 pF, 2.54 kΩ
- more current
- zero: 1.75 pF, 8 kΩ
- Frequency 5.767 MHzE6.4: 1 pF, 5 kΩ = 64.83° · textbook: 4 pF, 2.54 kΩ = 62.24° · more current = 75.27° · zero: 1.75 pF, 8 kΩ = 79.79°
The textbook route meets 60° only by crossing at 5.77 MHz, below the 10 MHz brief.
- Frequency 11.62 MHzE6.4: 1 pF, 5 kΩ = 47.93° · textbook: 4 pF, 2.54 kΩ = 41.42° · more current = 61.41° · zero: 1.75 pF, 8 kΩ = 72.89°
With 2.5 times the second-stage current, the same rule crosses at 11.62 MHz with 61.4°.
- Frequency 12.64 MHzE6.4: 1 pF, 5 kΩ = 45.85° · textbook: 4 pF, 2.54 kΩ = 38.58° · more current = 59.18° · zero: 1.75 pF, 8 kΩ = 71.99°
At the original current, the left-half-plane zero lifts the phase near fu: 72.0° at 12.64 MHz.
- Frequency 15.25 MHzE6.4: 1 pF, 5 kΩ = 41.38° · textbook: 4 pF, 2.54 kΩ = 32.15° · more current = 53.69° · zero: 1.75 pF, 8 kΩ = 69.92°
E6.4's compensation crosses at 15.25 MHz with only 41.4°.
Read the plot as a table
| Frequency | E6.4: 1 pF, 5 kΩ | textbook: 4 pF, 2.54 kΩ | more current | zero: 1.75 pF, 8 kΩ |
|---|---|---|---|---|
| 1 kHz | 156.2° | 120° | 139.2° | 142.7° |
| 10 kHz | 102.8° | 93.25° | 96.58° | 97.45° |
| 100 kHz | 90.83° | 89.82° | 90.4° | 90.56° |
| 1 MHz | 85.39° | 84.92° | 87.48° | 88.14° |
| 5.767 MHz | 64.83° | 62.24° | 75.27° | 79.79° |
| 10 MHz | 51.72° | 46.39° | 65.1° | 74.48° |
| 11.62 MHz | 47.93° | 41.42° | 61.41° | 72.89° |
| 12.64 MHz | 45.85° | 38.58° | 59.18° | 71.99° |
| 15.25 MHz | 41.38° | 32.15° | 53.69° | 69.92° |
| 100 MHz | 9.707° | -30.3° | -21.95° | 20.17° |
| 1 GHz | -98.72° | -114.1° | -113.5° | -94.42° |
| 10 GHz | -168.9° | -170.8° | -169.1° | -168.2° |
Every point is from a run on ngspice 42: the four designs at 1, 2 and 5 pF (the table lists all twelve).
The worked answer
With Cc = 1.75 pF and Rz = 8 kΩ the zero sits at 1/(2π·1.75 pF·5.46 kΩ) ≈ 16.7 MHz, just above the 5 pF output pole. The Bode plot shows the design at both ends of the load range. A margin above 90° at the light load means the phase of T at fu is above −90°: the zero has given back more phase than the dominant pole took.
- gain, CL 1 pF
- gain, CL 5 pF
- phase, CL 1 pF
- phase, CL 5 pF
- Frequency 12.64 MHzgain, CL 1 pF = 3.13 dB · gain, CL 5 pF = -0.00111 dB · phase, CL 1 pF = -70.72° · phase, CL 5 pF = -108°
At 5 pF the gain crosses 0 dB at 12.64 MHz with 72.0° of margin. Without the zero, this load allowed 5.77 MHz.
- Frequency 25.66 MHzgain, CL 1 pF = -0.001301 dB · gain, CL 5 pF = -7.151 dB · phase, CL 1 pF = -69.62° · phase, CL 5 pF = -116.8°
At 1 pF the crossing moves up to 25.66 MHz. Its margin is 110.4°: the zero now sits below fu.
Read the plot as a table
| Frequency | gain, CL 1 pF | gain, CL 5 pF | phase, CL 1 pF | phase, CL 5 pF |
|---|---|---|---|---|
| 10 kHz | 63.19 dB | 63.12 dB | -82.45° | -82.55° |
| 100 kHz | 43.26 dB | 43.19 dB | -89.04° | -89.44° |
| 1 MHz | 23.28 dB | 23.18 dB | -87.9° | -91.86° |
| 10 MHz | 4.557 dB | 2.332 dB | -73.16° | -105.5° |
| 12.64 MHz | 3.13 dB | -0.00111 dB | -70.72° | -108° |
| 25.66 MHz | -0.001301 dB | -7.151 dB | -69.62° | -116.8° |
| 100 MHz | -7.82 dB | -22.32 dB | -138° | -159.8° |
| 1 GHz | -42.26 dB | -56.19 dB | -273.6° | -274.4° |
Every point is from a run on ngspice 42 (CL = 2 and 3 pF and Rz ±20 % are in the same run; see the table).
- CL 1 pF
- CL 2 pF
- CL 5 pF
- Time 144.6 nsCL 1 pF = 0.9525 · CL 2 pF = 0.9633 · CL 5 pF = 1.021
At 5 pF the output overshoots by 2.1 %. At 1 and 2 pF it never passes its final value.
- Time 173.1 nsCL 1 pF = 0.99 · CL 2 pF = 0.9935 · CL 5 pF = 1.004
Within 1 % of the final value: 62.3 ns after the step at 5 pF, 66.0 ns at 2 pF and 73.1 ns at 1 pF. The light loads approach slowly from below.
Read the plot as a table
| Time | CL 1 pF | CL 2 pF | CL 5 pF |
|---|---|---|---|
| 0 s | 1.672 µ | 1.672 µ | 1.672 µ |
| 144.6 ns | 0.9525 | 0.9633 | 1.021 |
| 173.1 ns | 0.99 | 0.9935 | 1.004 |
| 200 ns | 0.9977 | 0.9987 | 0.9998 |
| 400 ns | 1 | 1 | 1 |
| 600 ns | 1 | 1 | 1 |
| 800 ns | 1 | 1 | 1 |
| 1 µs | 1 | 1 | 1 |
| 1.2 µs | 1 | 1 | 1 |
| 1.4 µs | 1 | 1 | 1 |
Every point is from a run on ngspice 42.
| Compensation | 1 pF | 2 pF | 5 pF | Supply |
|---|---|---|---|---|
| E6.4: 1 pF, 5 kΩ | 75.3° at 25.29 MHz | 60.1° at 21.43 MHz | 41.4° at 15.25 MHz | 79.54 µA |
| Textbook: 4 pF, 2.54 kΩ | 81.4° at 6.37 MHz | 75.8° at 6.27 MHz | 62.2° at 5.77 MHz | 79.54 µA |
| More current: 2 pF, 1.01 kΩ, M6/M7 ×2.5 | 79.3° at 12.70 MHz | 74.1° at 12.52 MHz | 61.4° at 11.62 MHz | 141.3 µA |
| The zero: 1.75 pF, 8 kΩ | 110.4° at 25.66 MHz | 94.9° at 19.39 MHz | 72.0° at 12.64 MHz | 79.54 µA |
Phase margin and fu of the buffer, from the comparison run; the supply current is one op-amp's, from 1.8 V.
Both the power route and the zero route meet the brief. The zero route costs no current, but it depends on Rz against 1/gm6. With Rz 20 % low (6.4 kΩ) the 5 pF margin falls to 64.9° at 11.63 MHz; 20 % high (9.6 kΩ) it is 77.2°. Both still pass.
It also settles more slowly at light loads. The power route reaches 1 % in 47.4 ns at 1 pF; the zero route takes 73.1 ns, because its zero and the closed-loop pole near it leave a slow tail. If the brief had a settling time, that would decide between them.
More current
XM6 out o1 vdd vdd sky130_fd_pr__pfet_01v8 W=80 L=1
XM7 out nb 0 0 sky130_fd_pr__nfet_01v8 W=40 L=1
RZ o1 z 1.01k
CC z out 2p
pm_power5 = 6.141535e+01 at 5 pF; isup_power = 1.413470e-04.
A left-half-plane zero
XM6 out o1 vdd vdd sky130_fd_pr__pfet_01v8 W=32 L=1
XM7 out nb 0 0 sky130_fd_pr__nfet_01v8 W=16 L=1
RZ o1 z 8k
CC z out 1.75p
pm_zero5 = 7.199262e+01 at 5 pF; isup_zero = 7.954101e-05.
Both from the comparison run, which also gives the other rows of the table.
Asked in interviews
How do you compensate a two-stage op-amp for a range of loads?
Design at the heaviest load, where the output pole gm6/(2πCL) is lowest, then check the lightest load and a step at each. Here 1 pF + 5 kΩ gave 60.1° at 2 pF and 41.4° at 5 pF.
Why is a one-stage OTA more stable with more load capacitance?
Its dominant pole is the output node itself, so more CL lowers fu and moves it further from the higher poles. In a two-stage op-amp CL sets the second pole instead, so more load brings it toward fu.
What do you trade when you raise Cc?
Bandwidth and slew rate: fu ≈ gm1/(2πCc) falls, and the first stage needs longer to charge Cc. The other levers are more second-stage current (power) or a nulling resistor that places a zero, which costs settling time and depends on Rz matching 1/gm6.
Try it
The starter is E6.4's compensation at the 5 pF corner of the brief. Run it: pm and overshoot both fail. Open Plots to see the loop gain and the step.
Now find your own answer. Change cc and rz, then run it again at cl=1p and cl=2p: a design passes only if it passes at every load. The worked answer is one solution, not the only one.
Run the netlist to draw its plots here.
fu = 1.525168e+07 pm = 4.139049e+01 v0 = 8.998682e-01 vf = 9.098686e-01Check yourself
Remember
- A two-stage op-amp is worst at its heaviest load: the output pole gm6/(2πCL) falls toward fu. Design there, then check every load with a step.
- With the zero cancelled (Rz = 1/gm6), fu ≤ p2/2.2; OPA-B reached only 5.77 MHz at 5 pF, and 10 MHz needed 2.5 times the second-stage current.
- An Rz above 1/gm6 places a left-half-plane zero near the worst-case output pole: 1.75 pF and 8 kΩ met the brief at the original current.
- Every route has a price: power, bandwidth, settling time or sensitivity to Rz. Measure each one before you choose.