Saturday, January 30, 2021

Audio Amplifier Feedback - Two-Pole Compensation

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

Saturday, January 23, 2021

Audio Amplifier Feedback - Transient Intermodulation Distortion (TIM)

Now that I covered the linearity of the input stage, it is a good time to talk about TIM - Transient Intermodulation Distortion.

In 1970, Matti Otala published a paper called "Transient Distortion in Transistorized Audio Power Amplifiers". He argued that under certain conditions, fast signal transients create a specific type of distortion, which he called Transient Intermodulation Distortion (TIM).

In the paper, Otala considered a simple model amplifier with an RC compensation network providing a dominant pole:

Otala fed this model amplifier with a fast voltage step and observed something like this:
Here, the green is the step at the input $V_2$, blue is the slower output step, scaled down by the feedback network $\beta$, and red is $V_3$, the difference between the input and scaled output which is fed to the input stage $A_1$.

When $V_2$ grows faster (has a higher slew rate $SR=dV/dt$) then the compensation RC network can reproduce, $V_3$ overshoots its steady state level, as the red trace shows. Depending on the difference in slew rates at the input and at the output, the overshoot can be large. 

Otala recognized that the overshoot at the input of the first stage may lead to the first stage clipping and thus to distortion - the effect he called Transient Intermodulation Distortion, or TIM. 

I demonstrated in the previous post that a difference amplifier typically used as an input stage can easily be overloaded by relatively small signals, and that is becomes nonlinear and start distorting long before it clips. This is one of the mechanisms that potentially can give rise to TIM. 

I have been arguing in my first post on audio amplifier feedback that the the difference signal seen by the input stage can be effectively reduced by increasing the loop gain. Indeed, the higher the loop gain is, the smaller both the overshoot and the steady state value of $V_3$ are, and the faster the overshoot settles to the steady state value:

The price of faster settling and smaller overshoot with higher loop gains, however, is the larger current though the RC network, all of which must be provided by the first stage $A_1$:

The extra current required by the compensation network may also lead to the first stage overload, but at the output rather than at the input. This is another mechanism that can potentially generate TIM.

The conclusions should have been that, in order to minimize TIM:

  • The slew rate at an amplifier's input should be limited (by, for example, a low pass filter) to what the amplifier can reproduce at the output; and
  • The first stage $A_1$ should be designed to both handle the difference input signals and drive the compensation network with low distortion; the now-standard approach (see my previous post) is to degenerate the input differential pair with emitter resistors and increase its tail current.

Otala came to the first conclusion, but not the second. Instead of designing a more robust and linear input stage, he set out to avoid both the overshoot at the input and the need to drive the compensation network at the output of $A_1$ by increasing the amplifier's slew rate, refusing to apply the dominant pole compensation and reducing the loop gain in the global feedback loop.

Importantly, Otala came up with the idea that there is an optimal level of feedback (loop gain), above which TIM would become the dominant distortion mechanism. The theme has become popular and led to the concept that it is the slew rate, and not the loop gain, that determines an amplifier's distortion. It still reverberates around the audio community in the form of amplifiers with "moderate feedback" and slew rates of 3kV per microsecond.

There is nothing wrong with high slew rate amplifiers. For a typical three stage Miller compensated amplifier, the slew rate can be an indication of how far the first stage of the amplifier is from clipping, and therefore how linear it is. It can also be an indication of the amplifier's bandwidth and hence of the loop gain in the audio range of frequencies.

Moderate feedback, on the other hand, is a problem. As I posted earlier, moderate feedback provides only moderate suppression of distortion and makes the input stage work harder and distort more. Conversely, high gain in the global feedback loop reduces the difference input signal for the input stage and thus reduces TIM. There is no need to choose between high loop gain and low TIM; one can - and should - have both.

Saturday, January 16, 2021

Audio Amplifier Feedback - Input Stage Linearity

In my previous posts, I mentioned that dominant pole compensation limits loop gain, which increases distortion in two ways.

  1. Lower loop gain means that the feedback loop has lower ability to correct distortion as the Error Transfer Function $ETF={1 \over {1 - LG}}$ increases.
  2. Lower loop gain means the input stage needs to deal with a larger signal.
In this post, I will focus on the second point and look at how lower feedback affects the input stage. 

The input signal seen by the input stage of a feedback amplifier with loop gain $LG$ is $V_{diff}$, the difference between the input signal to the whole amplifier, $V_x$ and the portion of its output signal produced by the feedback network, $B \times V_y$ (see also the first post of the series): $$V_{diff}={V_x + {B \times V_y}} = Vx {1 \over {1 - LG}} + V_{err} {B \over {1 - LG}}$$
Clearly, the input signal seen by the input stage of a feedback amplifier depends on the loop gain - the larger the loop gain, the smaller the differential input signal.

For example, for an amplifier with 30dB (= approx 32) of feedback and 2V peak input voltage, the peak difference voltage the input stage sees would be (assuming the distortion is small compared to the signal and ignoring the sign) $$V_{diff}=Vx {1 \over {1 - LG}}= {2V \over {1 - 32}} = 65mV$$
Is that large or small? Let us look at a typical input stage - a differential amplifier a.k.a. long tail pair (LTP) - and at how its output voltage (between collectors) changes with the differential input signal (between bases):
It can only handle about 60mV peak input voltage before clipping, and is visibly nonlinear with much smaller inputs:
Oops. With 30dB of loop gain, the input stage will clip at relatively low input signals!

The standard way of fixing this is to degenerate the input stage by adding resistors into the emitters of the LTP:
The typical value of resistors is about 10x the intrinsic emitter resistance, which depends on emitter current $r_e={26mV / I_e}$. For the emitter current of 0.5mA, $r_e$ is about 50ohm, so 470ohm generation resistors are acceptable.

With degeneration, the gain decreases but the LTP can handle much larger input signals:

The nonlinearity is not so evident, so let's have a closer look:

This is 0.0074% of total harmonic distortion (THD). Unlike the distortion of the output stage, this distortion cannot be corrected by the feedback loop, as it is appears at the amplifier's input and is indistinguishable from the input signal. That is, 0.0074% will appear at the amplifier output.

Nevertheless, there are ways to decrease this distortion:
  • One is to make the input stage intrinsically more linear. This usually means making it more complicated or, if the input stage is an opamp, selecting a better (and more expensive) opamp.
  • Another is to make the differential input signal smaller by increasing the loop gain.
For example, with 100dB of loop gain, the distortion of a simple two-transistor differential input stage is unmeasurable:

With high loop gains, there is no need for complicated input stages or expensive opamps. Even a single transistor will do the job perfectly.

Sunday, January 10, 2021

Krell KSA-5 Clone - Revised Schematic and Build Guide

In the previous two posts on the topic, I discussed my approach to upgrading the KSA-5 and demonstrated the massive distortion improvement I was able to achieve. 

Without further ado, here is the revised schematic:

The list of parts required to modify two channels:
  1. 8x 0.22 ohm 2W or 3W resistors
  2. 4x 22 ohm resistors
  3. 6x 47 ohm resistors
  4. 8x 100 ohm resistors
  5. 8x 274 ohm resistors
  6. 4x 332 ohm resistors
  7. 2x 562 ohm resistors (not needed if you can reuse R5/R8)
  8. 2x 3.92k resistors
  9. 2x 1 Megohm resistors
  10. 2x 68pF 50V capacitors, NP0/C0G ceramic or mica
  11. 4x 4.7nF film capacitors
  12. Some 18 AWG single core insulated wire and 2x 10 ohm 2-3W resistors for the output RL network

The list of changes to the original schematic:

  1. Replace R1, R2, R6, R7 with 100 ohm resistors
  2. Replace R5 and R8 with 332 ohm resistors
  3. Replace R9, R10, R11, R12 with 274 ohm resistors
  4. Replace R16 and R17 with 22 ohm resistors
  5. Replace R19 with a 562 ohm resistor (reuse one of R5/R8)
  6. Replace R23 with a 1 Megohm resistor
  7. Replace R24 with a 68pF 50V NP0/C0G ceramic capacitor
  8. Replace R33, R34, R35 and R36 with 0.22 ohm 2W or 3W resistors
  9. Replace R37 and R38 with one 47 ohm resistor connected between bases of Q23/Q24 and Q25/26. Make sure to connect the new resistor correctly - see the build guide below - or your output transistors are at risk.
  10. Replace R47 with a 3.92k resistor
  11. Remove C2 and C3
  12. Add a 4.7nF film capacitor and a 47 ohm resistor, connected in series, between the collectors of Q2 and Q3. Add another 4.7nF film capacitor and a 47 ohm resistor, also connected in series, between the collectors of Q7 and Q8. Place the new parts on the underside of the board if you like.
Repeat for the other channel. That's it!

As resistors's names are not marked on the board, here is a photo showing what to replace with what. Note that the additional parts from step 12 above are not shown - they are under the PCB. Click the picture to open it in full resolution.

After assembly, take the usual precautions before powering the amplifier up, as if it were a newly assembled board. Turn the bias adjustment trimpots all the way counterclockwise, connect a current limited +/-21V power supply with the current limit set at 0.5A per rail.

With power on, check the output for a possible oscillation, then adjust the bias and re-check for oscillations. The bias level needs to be at about 20mA per transistor - with 0.22 ohm emitter resistors, it corresponds to 4mV between the test points, which should be easy to measure with a DVM. Higher bias levels are possible, but the distortion will be slightly higher. 

Let the amplifier warm up for 10-15 minutes and readjust the bias - it should go down as the output transistors warm up.

As with any feedback amplifier, capacitive loads may affect stability. In my testing, the amplifier remained stable with capacitive loads of up to 100nF. Consider adding the usual RL network between the output of each channel and the load to ensure stability. Make 20-30 turns of 18 AWG single core insulated wire on a 1/2 inch (12mm) former - a Sharpie will work - to make an air core inductor, then connect a 10ohm 2-3W resistor in parallel to it.

Saturday, January 9, 2021

Audio Amplifier Feedback - Nested Feedback Loops

In the previous post, I looked at how Miller compensation reduces the global loop gain of an amplifier. Where does the gain go? It gets trapped inside the local loop that the compensation capacitor forms around the second (transimpedance) stage.

When several stages are included within one feedback loop, the individual gains of each stage multiply (left). However, when one of the stages is enclosed in a local loop, the contribution of that stage to the global loop gain changes - it becomes the Signal Transfer Function set by that local loop (right).

With Miller compensation, the magnitude of the second stage's Signal Transfer Function falls with frequency by 20dB/decade. Because of that, at low frequencies most of the raw open loop gain of the second stage is applied to the global feedback loop. As the frequency grows, the gain of the second stage is increasingly removed from the global loop and locked inside the local loop.

As discussed in the last post, the decreasing global loop gain affects distortion at high frequencies. The effect is quite dramatic - here is an illustration from Douglas Self's Desiging Audio Power Amplifiers book:

In the next post, I will look into how loop gain affects the linearity of the input stage of an amplifier.

Friday, January 8, 2021

Krell KSA-5 Clone - A Massive Performance Upgrade

In my previous post on the topic, I reviewed the original schematic of Krell KSA-5 and concluded that is has a nicely linear front end that cannot help the output stage stay linear because of low feedback.

My plan was to improve the linearity of the output stage and wrap it in a feedback loop with as much loop gain as possible. An additional self imposed limitation was to keep the PCB and the general schematic intact as much as possible and use the parts that I had readily available, so as to complete the upgrade over one weekend.

I decreased the emitter resistors of the output stage by an order of magnitude, converted the output drivers to Class A, decreased the amount of local feedback (degeneration), dramatically increased global feedback loop gain - the revised KSA-5 has at least 50dB of loop gain over all audio range - and adjusted the compensation to keep the amplifier stable. 

It sounds immaculate and is a massive upgrade over the original version. I have heard it so far driving Sennheiser HD595 and Grado GS1000 headphones and B&W 602.5 floor standing speakers, with great results on a variety of music material. A brief head-to-head against Musical Fidelity X-CANv8 revealed that the amplifiers are somewhat different but without a clear preference one way or the other.

Below are some measurements. I believe that at this point, the distortion performance is largely limited by the original topology, such as the JFET buffers outside of the global feedback loop (note that First Watt B1, which is a JFET buffer, has similar distortion at similar input levels), and by the PCB layout.

1kHz THD and 19+20kHz 1:1 IMD @ 4Vpeak (1W) into 8 ohm:

9Vpeak (5W) into 8 ohm:

4Vpeak into 33 ohm:

9Vpeak into 100 ohm:

The amplifier clips nicely:

and delivers a good looking square wave:

The phase margin is more than adequate:

Monday, January 4, 2021

Krell KSA-5 Clone - Review of the Original Schematic

In the last post, I demonstrated the measured performance of my KSA-5 clone before the upgrade, which was not so great. Let's see why it distorts.

KSA-5 is designed along the lines of "moderate feedback", that is, it uses very little to no global feedback but lots of local degeneration.

The pair of input JFET buffers (Q1, red box on the schematic above) run independently of each other and outside of the global feedback loop. With low loop gain, they see very different signal levels, so the differential stage downstream doesn't cancel their distortion. (BTW, because of this JFETs need not be matched. Also, the expensive and hard-to-find JFETs can be easily replaced here with BJTs.) Having said that, a JFET follower loaded by a current source has 100% degeneration and low distortion, at least at low signal levels, so the buffers are not the biggest problem.

The pair of differential stages (Q2+Q3, Q7+Q8, orange box) is heavily degenerated by 680ohm emitter resistors and have R10/(R1+R2) = 2 = 6dB of amplification.

The pair of common emitter stages (Q12, Q13, purple box) is also heavily generated by 402ohm emitter resistors and, with the low load of R23 and R24, provides R23/R16 = 9 = 19dB of amplification.

Since the output stage (blue box) is a double emitter follower with approximately unity gain, the total open loop gain of KSA-5 is 2x9 = 18 = 25dB. The feedback divider (R45-R47) attenuates the output signal by a factor of 9 (19dB), which leaves 18/9 =2 (6dB) of global feedback. That is, the global feedback loop attenuates the distortion of the output stage by a small factor of 1+2 = 3.

The output stage, meanwhile, is the biggest source of distortion. Although Krell claimed that KSA-5 runs in "pure Class A", in reality it is Class AB. The output pairs run at only 50mA of quiescent current each and leave Class A (that is, one half of the output stage stops conducting current) when the output current reaches 200mA. The driver quads (Q15-Q22) also run in Class AB (R37 and R38 are connected to the output), which means they stop conducting at that point, too. With a 100ohm load, it would happen at 20V peak output voltage, so the amp never leaves Class A with such a load. However, with 32ohm, KSA-5 leaves Class A at 6.4V peak; with 8ohm, at 1.6V - that's 320mW! No wonder the owner's manual warns not to connect this amplifier to any loudspeakers.

Even within Class A region, the output stage is not very linear, especially with low impedance loads. It uses paralleled transistors with relatively large emitter resistors to ensure current sharing. The dark side of large emitter resistors is that they make the output impedance of the emitter follower large and nonlinear in the crossover region (see e.g. Douglas Self and his "wingspread" diagrams). Since the output impedance forms a voltage divider with the load, its nonlinearity makes the gain of the emitter follower nonlinear, adding crossover distortion and negating the benefit of the large bias current.

Overall, KSA-5 has a not-so-linear output stage and a nice and linear frontend that doesn't help the output stage to stay linear.

In the following posts, I will show how I improved the distortion performance of KSA-5.

Krell KSA-5 Clone - Measured Distortion Performance Before Upgrade

The measured distortion performance of the unmodified KSA-5 clone confirmed what was clear in listening sessions. It works ok with 100ohm and 33ohm loads, but is completely confused with 8ohm (click to open larger pictures):

Even with a 100ohm load, the distortion at 1kHz is 0.02%, or -74dB, equivalent to 12 bit resolution. 

In the next post, I will look at the reasons for this performance.