Saturday, March 27, 2021

Audio Amplifier Feedback - Estimating Poles in Lead-Lag Compensation Scheme

This post is a part of the series on audio amplifier feedback. The contents of the series can be found here.

In the last post, I postulated that a feedback network combining lead and lag compensation:

has a transfer function with two poles and two zeros:$$B(s)={R_g \over {R_f+R_g}}{{(s T_{z1}+1)(s T_{z2}+1)}\over{(s T_{p1}+1)(s T_{p2}+1)}}$$where $T_{z1}=R_f C_f$, $T_{z2}=R_n C_n$, $T_{p1} \approx (R_f || R_g +R_n)C_n$ and $T_{p2} \approx (R_f || R_g || R_n)C_f$.

The actual transfer function, calculated from the circuit theory, is$$B(s)={R_g \over {R_f+R_g}}{{(s T_{z1}+1)(s T_{z2}+1)}\over{(s(R_f||R_g)C_f+1)(s R_n C_n +1)+s(R_f||R_g)C_n}}$$As usual, it can be transformed into many equivalent forms as needed. The exact poles are the roots of the quadratic equation $${(s(R_f||R_g)C_f+1)(s R_n C_n +1)+s(R_f||R_g)C_n} = 0$$It can be solved algebraically, but the result is unwieldy and obscures, rather than clarifies, the placement of the poles.

Instead, it is easier to estimate the poles as follows. The time constant of the pole associated with $C_n$ is calculated by assuming that $C_f$ is an open circuit at the frequencies of interest and that the signal source (here, the output of the opamp) has zero impedance, then computing the equivalent resistance “seen” by the $C_n$, which is $R_f || R_g +R_n$.

The time constant of the pole associated with $C_f$ is calculated by assuming that $C_n$ is short circuit at the frequencies of interest and, again, that the output of the opamp has zero impedance, then computing the equivalent resistance “seen” by the $C_f$, which is $R_f || R_g||R_n$. 

The approximation is based on a number of assumptions that I may look at in a future post, but is surprisingly accurate (within 1% of the actual frequency for a reasonable audio band network). 

In any case, the exact roots are not that important. The approximate formulas help to see what shapes the loop gain, and what values can be changed to optimize it. For an experienced designer, the Bode plot by itself becomes sufficiently informative to skip the formulas altogether.

Saturday, March 20, 2021

Audio Amplifier Feedback - Combining Lead and Lag Compensation

This post is a part of the series on audio amplifier feedback. The contents of the series can be found here.

The lead and lag compensation schemes can be combined in one feedback network:


The transfer function of this lead-lag feedback network has two poles and two zeros:$$B(s)={R_g \over {R_f+R_g}}{{(s T_{z1}+1)(s T_{z2}+1)}\over{(s T_{p1}+1)(s T_{p2}+1)}}$$where $T_{z1}=R_f C_f$, $T_{z2}=R_n C_n$, $T_{p1} \approx (R_f || R_g +R_n)C_n$ and $T_{p2} \approx (R_f || R_g || R_n)C_f$.


For given $R_f$ and $R_g$, both zeros and one pole can be placed freely, which makes the combined compensation scheme quite flexible. 

Compare the $1/B$ feedback factor for the lead-lag compensation scheme (blue) with both lead (red) and lag (light blue) alone; green is the open-loop gain: 
It is clear that unlike the pure lead compensation, the combined scheme doesn't extend the bandwidth; unlike the pure lag compensation, it preserves the loop gain in the audio band; and from the rate-of closure, it appears that the phase margin is similar for all three compensation schemes.

One possible design procedure for the combined compensation scheme is:

  1. Choose $R_f$ and $R_g$ from the desired DC gain $(R_f+R_g)/R_g$ and the expected parasitic capacitances
  2. Choose the time constants for the first pole ($T_{p1}$) and both zeros ($T_{z1}$ and $T_{z2}$)
  3. Calculate $C_f=T_{z1}/R_f$
  4. Calculate $C_n=(T_{p1}-T_{z2})/(R_f || R_g)$ 
  5. Calculate $R_n=T_{z2}/C_n$

Saturday, March 13, 2021

Audio Amplifier Feedback - Lag Compensation

This post is a part of the series on audio amplifier feedback. The contents of the series can be found here.

Lag compensation involves an RC network connected between the inputs of an opamp:


It may be a bit difficult to understand, as feedback reduces the voltage across the compensation network, and thus reduces the effect of that network on the closed loop response. 

For the loop gain, however, lead-lag compensation does make a difference. Consider the following schematic: 
From the point of view of the feedback signal, the compensation network $R_N C_N$ is connected in parallel to $R_I$ and modifies the transfer function of the feedback network as follows:$$B={Z_I \over {Z_I + Z_F}}={{R_I \over {R_I + R_F}} \times {{s R_N C_N +1} \over {s (R_N + R_I||R_F)C_N +1}}}$$
The compensation network adds to the loop gain a pole at $\omega_p = {1 \over {(R_N + R_I||R_F) C_N}}$ and a zero at $\omega_z = {1 \over {R_N C_N}}$; note that $\omega_p < \omega_z$ (green is the forward gain of the amplifier, blue is $1/B$):

The loop gain is reduced by 3dB at $\omega_p$ and keeps falling until the zero cancels the effect of the pole, including the extra phase lag. The crossover shifts to a lower frequency, where the phase lag is smaller, increasing the phase margin (here, green is the loop gain without compensation, blue is the loop gain with lead-lag compensation):
The net effect of lag compensation is a reduction of the loop gain at higher frequencies without the phase lag that would normally be associated with such a reduction.

Compare lag compensation to dominant pole (e.g. Miller) compensation with the same bandwidth (green is the loop gain without compensation, blue - with lead-lag compensation, red - with dominant pole compensation):

Lag compensation allows more loop gain at lower frequencies while providing a very similar phase margin. Due to the finite gain of the amplifier, the closed loop frequency response with lead-lag compensation (blue) is slightly different from that with a dominant pole (red):

Sometimes in the lead-lag compensation network, either R of C is omitted. If R is omitted and C is left alone:
the feedback network transfer function becomes $$B={Z_I \over {Z_I + Z_F}}={{R_I \over {R_I + R_F}} \times {1 \over {s (R_I||R_F)C_C +1}}}$$ There is no zero anymore to compensate for the additional pole, and for stability, a zero would usually need to be introduced separately:

If C is omitted and R is left alone:
then the feedback network transfer function becomes $$B={Z_I \over {Z_I + Z_F}}={{R_G \over {R_G + R_F}} \times {R_1 \over {R_1 + R_G||R_F}}}$$ Since ${R_1 \over {R_1 + R_G||R_F}}<1$, the loop gain is decreased across all frequencies.

Useful links:

Saturday, March 6, 2021

Audio Amplifier Feedback - Rate-of-Closure

This post is a part of the series on audio amplifier feedback. The contents of the series can be found here.

Earlier in this series of posts, I showed that the loop gain is the product of open loop gain $A$ and the feedback network gain $B$: $LG = A \times B$:


If one plots the magnitudes $|A|$ and $|{1 / B}|$ on a logarithmic scale, the difference between these two plots corresponds to the loop gain magnitude: ${{|A|}_{dB}} - {{|{1 / B}|}_{dB}} = {{|LG|}_{dB}}$:

The crossover point where the two plots meet, and where the magnitude of the loop gain becomes unity (or 0dB), is important for the circuit's stability: if the phase lag around the feedback loop reached 180°, the circuit becomes unstable. The difference between the phase lag and 180° is the phase margin $\phi_m$:

Here, the phase margin is negative and the circuit is unstable. One of the objectives of compensation is to keep the phase margin sufficiently positive. A practical requirement is to keep the phase margin of at least 30° in the range of frequencies where the magnitude of loop gain is between 10dB and -10dB.

Rate-of-closure or ROC is a tool to estimate the phase margin from the logarithmic plots of $|A|$ and $|{1 / B}|$. ROC is defined as the difference between the slopes of the $|{1 / B}|$ and of the $|A|$ curves at the crossover frequency. Once we know the ROC, we can estimate the phase margin as $$\phi_m=180° - 4.5 \times ROC$$ where $\phi_m$ is in degrees and ROC is in dB/decade. In the example below, ROC 1 is about 45 dB/decade, so $\phi_m$ is about $180° - 4.5 \times 45 = -25°$. ROC 1 is about 25 dB/decade, so $\phi_m$ is about $180° - 4.5 \times 25 = 65°$:

A more detailed discussion of rate-of-closure can be found in this excellent article by Sergio Franco.

How does this concept apply to the lead compensation discussed in my last post? Let's take the above example and add a lead compensation capacitor, which introduces a pole-zero pair into the feedback network transfer function $B$. If the crossover point falls between the pole and the zero, where the $|1/B|$ curve slopes down, ROC decreases, indicating a higher phase margin:

Here, ROC 1 is about 35 dB/decade, indicating $\phi_m$ about $180° - 4.5 \times 35 = 20°$ (compare to -25° without the compensation capacitor).

If the compensation capacitor is too small, $|1/B|$ curve slopes down at the frequencies higher than the crossover, the ROC remains high, and the phase margin remains low:

If the compensation capacitor is too large, $|1/B|$ curve slopes down at the frequencies lower than the crossover, returning to horizontal at the crossover point. Again, the ROC remains high, and the phase margin remains low:

That is, as stated in my previous post, the value of the lead compensation capacitor is critical. If it is too high or too low, it will not improve the phase margin. 

Friday, February 26, 2021

Audio Amplifier Feedback - Lead Compensation

This post is a part of the series on audio amplifier feedback. The contents of the series can be found here.

So far in this series of posts, I have been looking at shaping the loop gain of an amplifier by modifying its forward gain $A$:

Although I only scratched the surface of that topic, let me move to the gain of feedback network $B$.

Consider a hypothetical amplifier from my earlier post with three poles at 1kHz, 1MHz and 20MHz inside a feedback loop setting the ideal closed loop gain at 20dB:
As discussed in that post, the amplifier's accumulates just under 180 degrees of phase lag at the frequency where the loop gain is unity (crossover frequency), its phase margin is close to zero, and the amplifier is on the verge of becoming a generator:
Connect a small capacitor in parallel to the feedback resistor:
Although the forward gain (green curve) does not change, the ideal closed loop gain (the inverse of the feedback network's gain, blue curve) now has a kink:
Compare the loop gain with (brown curve) and without (red curve) the capacitor:
The capacitor extends the bandwidth from 4.4MHz to 6.7MHz and improves the phase margin from zero to 43 degrees. This is called lead compensation. Intuitively, the capacitor "speeds up" the feedback loop - extends its bandwidth and compensates some of the phase lag introduced in the forward path $A$.

Unlike dominant pole (e.g. Miller) compensation, lead compensation does not affect the loop gain at low frequencies, so there is no tradeoff between stability and loop gain, definitely a positive. On the other hand, where dominant pole compensation decreases the amplifier's bandwidths, lead compensation extends it, which may be problematic. As the zero-loop-gain frequency increases, high frequency poles add to the phase lag, the impact of parasitics increases, the variations in the parameters of parts with voltage and current become more important, the construction of the amplifier requires more attention, and so on.

The analysis of lead compensation can be found in many, many sources, such as Op Amps for Everyone by Ron Mancini, Operational Amplifiers: Theory and Practice by James K. Roberge, or this Burr-Brown application bulletin. The gist of it is that with the compensation capacitor, the loop gain becomes: $$LG=A \times B=A {R_2 \over {R_1+R_2}}{{s R_1 C + 1} \over {s(R_1 || R_2)C+1}}$$ The capacitor introduces a zero at $\omega_z={1 \over {R_1 C}}$ and a pole at $\omega_p={1 \over {(R_1 || R_2) C}}$; note that $(R_1 || R_2) < R_1$, so $\omega_z < \omega_p$. For the schematic above, the zero is at 2.85MHz, and the pole is at 28.5MHz. 

Textbooks say that the properly placed zero should cancel one of the amplifier's poles. The reality is more complex. First, lead compensation only works when the crossover frequency (where the loop gain become unity) occurs between the pole and the zero:
That is, the value of the lead compensation capacitor cannot be chosen arbitrarily. While increasing the Miller compensation capacitor always improves stability (at the cost of reduced loop gain), the lead compensation capacitor must have just the right value. Too much or too little won't improve the phase margin. In addition, too large a capacitor will still extend the bandwidth, bringing all the associated costs but no benefits of better stability.

Second, in a real circuit, selecting the value of the compensation capacitor is even more difficult because the forward gain and the crossover point are not fixed. With the signal, the parameters of various components change, the crossover point moves, and the lead compensation may become ineffective. 

Third, a limitation specific to the lead compensation with a single capacitor is that, for a given closed-loop gain, the pole and the zero cannot be placed independently: $${\omega_p \over \omega_z}={{R_1 C}\over{(R_1 || R_2)C}}={R_1\over{R_1 || R_2}}={{R_1+R_2} \over R_2}={1+{R_1 \over R_2}}$$
That is, the zero and the pole are separated by a factor equal to the amplifier's ideal closed loop gain at DC as set by the feedback network. For an amplifier with 20dB gain, the pole will always be a decade higher than the zero. This fixed relationship is not always convenient. 

The workaround for that last problem is to add a resistor in series with the capacitor:
The loop gain becomes $$LG=A {R_2 \over {R_1+R_2}}{{s (R_1 + R_3) C + 1} \over {s(R_1 || R_2 + R_3)C+1}}$$ and allows placing the zero and pole independently. In this example, the capacitance was decreased slightly to keep the zero at 2.85MHz, but the pole now is at 15MHz, not 28.5MHz as before.

Another version places the resistor differently:
but achieves a similar result: $$LG=A {R_2 \over {R_1+R_2+R_3}}{{s R_1 C + 1} \over {s(R_1 || (R_2 + R_3))C+1}}$$ Here a slightly higher capacitance was chosen to compensate for the smaller $R_1$ and keep the zero at 2.85MHz. The pole is at 14.3MHz.

Saturday, February 20, 2021

Audio Amplifier Feedback - LTP with LR compensation

This post is a part of the series on audio amplifier feedback. The contents of the series can be found here.

Since my previous post was about shaping the open loop gain of a long-tail pair (LTP) with an RC network across the load, it seems to be a convenient moment to talk about LR compensation of an LTP:

The compensation network consists of an inductor $L$ in series with an optional resistor $R$, connected between emitters of the differential amplifier. Intuitively, at low frequencies where the impedance of the $RL$ network $Z_{RL}=R+sL$ is low compared to $R_e$, the $RL$ network reduces the degeneration added by $R_e$ and increases the transconductance of the LTP. At high frequencies, where $Z_{RL}$ is high compared to $R_e$, the $RL$ has little effect, and the LTP is degenerated by $R_e$:
To find out exactly how the transconductance changes in between these two extremes, I need to consider the small signal equivalent emitter circuit of the LTP:
Here, $r_e = {V_T \over I_E}$ is the emitter intrinsic resistance. The transconductance of the LTP with $RL$ compensation is $$g_m={1 \over {2 r_e+(R+sL)||(2 R_e)}}={{sL+(R+2R_e)} \over {2(R_e+r_e)(sL+R+2(R_e||r_e))}}$$ and has a pole at $s=-{{R+2(R_e||r_e)} \over L}$ and a zero at $s=-{{R+2R_e} \over L}$.

For example, the Bode plot above was generated with $R_e=220 ohm$, $R=0ohm$, $L=100 \mu H$ and $r_e={V_T \over I_E} = {{25mV} \over {1mA}}=25ohm$. With these values, the pole is at $s=-{{R+2(R_e||r_e)} \over L} = -{{0+2(220||25)} \over 10^{-4}} \approx -450k$, or $71.5kHz$, and the zero is at $s=-{{R+2R_e} \over L} = -{{0+2 \times 220} \over 10^{-4}} = -4.4M$ or $700kHz$.

One word of caution is that low $R$ in the $LR$ network undoes the degeneration added by $R_e$ and thus makes the LTP more susceptible to overload and nonlinearity, as discussed in the post of input stage linearity. The intended outcome is, of course, that the extra transconductance available with low $R$ increases loop gain, which reduces the differential input voltage seen by the LTP and improves its linearity. However, depending on the specific implementation, the loss of degeneration with low $R$ may become problematic. 

Another potential problem is that the inductor is an effective antenna and will increase inductive coupling of noise from e.g. power supply rails into the LTP. The standard remedy is to use a shielded inductor and/or use two inductors in series connected in anti-phase, so that noise coupled into one is cancelled by the other.

Tuesday, February 16, 2021

Burning Amp BA-3b (Balanced) Updated Power Supply

In my previous post of the Burning Ampifier 3 Balanced, I mentioned that I replaced the CRC filters in the power supply with 100mF + 10mH + 100mF CLC filters per rail per channel. Here are some pictures of the new power supply:

From left to right, you can see two toroidal power transformers with a soft start mounted on top; four bridge rectifiers; first four capacitors, one per channel per rail, with their discharge resisotrs; four chokes; the other four capacitors; and the PCBs with the from ends, mounted on the rear wall of the chassis. On the far side, there are six pairs of power MOSFETs mounted on a heatsink. Here is a close-up shot showing how the capacitors and chokes are mounted:


The capacitors are Vishay/BCcomponents MAL2 101 16104, chokes are Hammond 159ZJ. The power transformers are from Antek.


Saturday, February 13, 2021

Audio Amplifier feedback - LTP with Frequency Dependent Load

This post is a part of the series on audio amplifier feedback. The contents of the series can be found here.

In a number of previous posts, I looked at shaping the gain of a simple common emitter stage by applying frequency dependent local feedback. Local feedback, however, is not the only available gain-shaping tool. Another commonly used way is to add frequency dependent load.

Consider a simple long tail pair (LTP):


The analysis of the LTP can be found in many places online; my favorite is the ECE 3050 class notes by Marshall Leach. For small signals, the LTP is essentially a voltage dependent current source with transconductance $g_m={1 \over r_e} = {I_E \over V_T} = {I_{LTP} \over {2 V_T}}$ loaded with $R_1$ and $R_2$:


Clearly, by making $R_1+R_2$ frequency dependent, the gain $${v_o \over v_{diff}} = {{v_{C1}-v_{C2}} \over v_{diff}} = {{v_{diff} \times g_m(R_1+R_2)} \over v_{diff}} = g_m(R_1+R_2)$$ can also be made frequency dependent. For example, one can connect an RC network across $R_1+R_2$:

This modifies the load impedance from $R_1+R_2$ to $${(R_1+R_2)||({R_c+{1 \over {s C_c}}})}={(R_1+R_2){{(s R_c C_c+1)} \over {s(R_1+R_2+R_c)C_c+1}}}$$ with a zero at $\omega_z={1 \over {R_c C_c}}$ and a pole at $\omega_p={1 \over {(R_1+R_2+R_c) C_c}}$.

With the values shown, the zero is at 1.6MHz and the pole is at 2.65kHz (blue trace); for comparison, the green trace shows the response of the same LTP without the RC network:

In principle, the input impedance of the next stage (e.g. a common emitter amplifier) should be included into the calculation as connected in parallel to $R_1$ and/or $R_2$. That does not affect the zero, but the position of the pole can be more difficult to find. Note that the input impedance of a typical second stage of an audio amplifier with Miller compensation falls with frequency and can be quite low, pushing the pole to a higher frequency. This usually is a desirable outcome as it limits the phase lag introduced by the pole within the amplifier's bandwidth.

If the LTP is loaded not with resistors but with a current mirror, the formulas above still hold if you use the actual load impedance instead of $R_1+R_2$. The load would include the input impedance of the next stage in parallel with the output impedances of the differential pair itself and of the current mirror. For higher load impedance, the pole moves to a lower frequency. At the limit, if the differential pair is a pure current source with infinite output impedance, and the RC network is its only load, the pole appears at $w_z=0$.

Saturday, February 6, 2021

Audio Amplifier Feedback - NCore style compensation

This post is a part of the series on audio amplifier feedback. The contents of the series can be found here.

After analyzing the two-pole compensation scheme with the C-R-C "T" network, it became clear that compensating an audio amplifier is not just about ensuring stability, but about shaping (usually maximizing) the loop gain in the audio range of frequencies. This can be achieved in many different ways, and here is another one.

At the 131st AES convention in 2011, Bruno Putzeys presented a paper titled High-Order Analog Control of a Clocked Class-D Audio Amplifier with Global Feedback Using Z-Domain Methods, discussing the details of then-new Class D amplifier technology, marketed by Hypex under the trade name NCore. An NCore amplifier has an analog control loop with five poles, one real plus two complex pairs. One pair comes from the LC output filter, and the others come from the following circuit:


An opamp is enclosed in a local feedback loop, part of which is the same C-R-C "T" network that is used in the two-pole compensation scheme. $R_f$ and $C_f$ add another pole-zero pair, and the transfer function of the whole circuit has the following form:
$$H(s)={v_o(s) \over v_i(s)}={A \over s}{(s+\omega_{z1})(s+\omega_{z2}) \over {s^2+{\omega_0 \over Q}s+\omega_0^2}}$$where $\omega_{z1}={1 \over {R_f C_f}}$, $\omega_{z2}={1 \over {R_t (C_1 + C_2)}}$, and $\omega_0=\sqrt{1 \over {R_f R_t C_1 C_2}}$.
That is, it includes an integrator (pole at $\omega=0$), zero at $\omega_{z1}$, a pair of poles with the corner frequency $\omega_0$, and another zero at $\omega_{z2}$, in this order. The positions of all poles and zeros can be chosen freely, although some values may be impractical given the parasitics.

For example, with the first zero at 72Hz, the pair of poles at 46kHz, and the second zero at 720kHz, the Bode plot looks like this:

Light blue is the Bode plot of an amplifier with NCore compensation network around its second stage. The gain set by the global feedback is the blue trace. As in previous posts, for comparison are also shown the same amplifier uncompensated (green) and with two-pole compensation (red).

This compensation network keeps the loop gain at about 55dB in the audio range of frequencies. (As I posted earlier, some experts believe that a flat loop gain across the audio range has a more palatable sonic signature compared to that of the loop gain falling at higher frequencies.) As the frequency increases beyond the corner frequency of the pole pair, the loop gain falls, first at 40dB/decade, then at 20dB/decade, ensuring sufficient phase margin and thus stability.


Saturday, January 30, 2021

Audio Amplifier Feedback - Two-Pole Compensation

This post is a part of the series on audio amplifier feedback. The contents of the series can be found here.

As I noted in my posts on limitations of dominant pole compensation and on nested loops, dominant pole compensation locks a lot of gain inside the local feedback loop and makes it unavailable to the global feedback loop. The simplest way to unlock (part of) that gain is two-pole compensation. 

Two-pole compensation implemented with a C-R-C “T” compensation network is well known since 1980s and was featured in Douglas Self's comprehensive article on frequency compensation in the February 1994 issue of Electronics World - see FIG 1D on the right:


An intuitive explanation of how the C-R-C compensation network works is simple:

  • $R_P$ and $C_{P2}$ form a frequency-dependent voltage divider that feeds $C_{P1}$ with a portion of the output voltage
  • At low frequencies, the impedance of $C_{P2}$ is high compared to $R_P$,  so $C_{P1}$ sees a only a small portion of the output voltage, the local feedback's loop gain is reduced, and more gain is available for the global feedback loop
  • At high frequencies, the impedance of $C_{P1}$ and $C_{P2}$ is low compared to $R_P$,  so both capacitors in series work as a Miller compensation.
Between those two extremes, the amplifier with two-pole compensation has two poles (hence the name), so the loop gain falls at a rate of 40dB/decade, and a zero, which decreases both the rate of loop gain change by 20dB/decade and the phase lag. Compared to Miller compensation with the same bandwidth, two-pole compensation provides a welcome boost of global loop gain at audio frequencies:

Despite being around for 30+ years and probably because of its simplicity, a formal analysis of two pole compensation was published only in 2010 by Harry Dymond and Phil Mellor from University of Bristol, who presented their paper at the 129th AES convention. A brief summary:

  • Similarly to Miller's single dominant pole, the location of the two poles depends on the amplifier's stage inside the local feedback loop
  • The zero is located at the frequency $f_z = {1 \over {2 \pi R_P (C_{P1}+C_{P2})}}$
  • Unity loop gain frequency is $f_0 = B \times g_m {(C_{P1}+C_{P2}) \over 2 \pi C_{P1} C_{P2}}$, where $B$ is the transfer function of the feedback network and $g_m \approx  {1 \over {r_e + R_e}}$ is the transconductance of the input stage

Practically speaking, let $C_{P1}$ have the same value as for Miller compensation, choose $C_{P2}$ twice as big, and make $R_P$ as low as you can without affecting stability.
 
There is a so-called "output inclusive" version of the two-pole compensation where the bottom end of $R_P$ is connected not to the ground but to the output of the amplifier. The output-inclusive version has almost identical design equations to what is discussed above.

Thursday, January 28, 2021