Thursday, October 28, 2021

Hawksford's Error Correction (H.ec)

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

In 1983, Malcom Hawksford presented at the 74th AES convention a paper "Power Amplifier Output Stage Design Incorporating Error Feedback Correction With Current Dumping Enhancement". The idea was simple - compare the signal after the output stage with that at its input and add the difference back to the input:

On the schematic, H is the output stage with near-unity gain; $\epsilon$ is the error (distortion) introduced by the output stage; and B is the feedback network. Working from right to left: $$v_o = \epsilon + v_e H$$ $$v_e = v_i - v_c = v_i - B (v_o - v_e)$$ From the second equation we find $$v_e={{v_i - v_o B} \over {1-B}}$$ Substituting back into the first equation: $$v_o = \epsilon + v_e H = \epsilon +{{H(v_i - v_o B)} \over {1-B}} = \epsilon {{1-B} \over {1-B+HB}} + v_i {H \over {1-B+HB}}$$ That is, we have the error transfer function $$ETF = {{1-B} \over {1-B+HB}}$$ and the signal transfer function $$STF={H \over {1-B+HB}}$$

How the magic works: when $B=1$, $ETF=0$ and $STF=1/B=1$. Neither the transfer function of the output stage $H$ nor its distortion $\epsilon$ affect the output signal.

H.ec can also be analyzed as a positive feedback loop with the transfer function $1/(1-B)$ nested inside a negative feedback loop with forward gain $H$ and feedback gain $B$ - which gives the loop gain $H B / (1-B)$. It is equivalent to replacing $H$ with $H^\prime = {H/(1-B)}$.

One example of practical implementation is Thule Audio's Spirit IA-100 integrated amplifier. The simplified schematic is as follows:

Here, Q7 and R4 convert the difference between the output and input of the emitter follower Q2 Q5 into the collector current of Q7. R4 sets the transimpedance, that is, the rate of voltage-to-current conversion. Q7's collector current flows into the current mirror Q1 Q3 Q4 Q6. At the output of the current mirror, this current adds to the the current from the voltage amplification stage, represented by Ivas. The sum of the two currents is converted to voltage by R1 and becomes the input signal for the emitter follower. The value of R1 defines the proportion of the two currents at the summing point and hence $B$, so R4 needs to be adjusted for the lowest distortion. (The real IA-100 uses a push-pull emitter follower at the output and no copuling capacitor, but that is not essential for the discussion of H.ec.)

Another implementation, the paX amplifier by Jan Didden, published in Elektor Magazine in 2008, employs the AD844 instead of Q7 and the current mirror in the schematic above, but otherwise works the same.

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.
 
The two last forms of lead compensation can easily be transformed one into the other. To transform from the former $(R_3$ in series with $C_1)$ to the latter $(R_1'$ in parallel to $C_1')$, set $$R_3'=R_1||R_3$$ $$R_1'=R_1-R_3'$$ $$C_1'=C_1 \times (R_1+R_3)/R_1'$$ For example, from R1=9k and R3=1k, R3'=9/10=0.9k=900ohm; R1'=9k-0.9k=8.1k; and from C1=5.6pF, C1'=5.6pF×10k/8.1k=6.9pF.

To transform back, set $$R_1=R_1'+R_3'$$ $$R_3=R_1 \times R_3' / R_1'$$ $$C_1=C_1' \times R_1' / (R_1 + R_3)$$ For example, from R1'=8k and R3'=1k, R1=8k+1k=9k; R3=9k×1k/8k=1.125k; and from C1'=7pF, C1=7pF×8k/(9k+1.125k)=5.53pF.

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.