Site hosted by Angelfire.com: Build your free website today!

Square Wave Testing.

Updated 20-Aug-2007.

It is perhaps unfortunate that the most common test for stability is to look for 'ringing' on a square-wave test signal. It is instructive to look at some examples, here using a 2kHz square wave input.

The first looks like sustained low level oscillation around 30kHz, while the second looks like damped oscillation at the same frequency. Actually the first diagram has nothing at all added to the square wave, the only thing done was to remove everything above the 15th harmonic. Everything up to and including 30kHz is being reproduced with no distortion, no phase error and flat frequency response. (If possible see 'A check on Fourier' by M.G.Scroggie, Wireless World, Nov 1977. p79-82. His Fig.5 is a better drawn version showing the harmonics and how they add.) The lack of higher frequency components however gives the impression of a serious problem, when in fact the audio frequency reproduction is perfect, and there is nothing at all added or removed in this range. The symmetrical variation of the 'oscillation' amplitude gives a clue to the origin of the effect, but practical low pass filters give a less sharp cut off of high harmonics together with frequency dependant phase shift which will give a different appearance. The suggestion that 'ringing' needs to be minimised is not entirely convincing when even an ideal low-pass filter gives the above result. Using an audio signal with no frequency components above 30kHz instead of the square wave there would be no effect at all from this filter.

The second diagram can also be the result of low-pass filtering, and something similar is often produced by the interaction of output inductors with capacitive loads, which is not related in any direct way to stability. Checking the signal ahead of the inductor may reveal a smooth signal without the 'ringing' effect, though some amplifiers have an output impedance with a small internal inductive component which will add some small effect. The square-wave response shown in the MJR-6 test results shows low level 'ringing' which is estimated at 120kHz. This is close to the expected resonance frequency of the 0.4uH output inductor with the 4uF load capacitance used in that test. Increasing loop gain to the point where the amplifier becomes unstable caused oscillation around 6MHz, as expected from the feedback loop unity gain frequency. This demonstrates that output 'ringing' is generally not related to instability, which can occur in an entirely different frequency range, and unless the input signal includes components close to the LC resonance frequency, or the inductance used is too high, there will be little effect. Leaving out the output inductor to eliminate 'ringing' caused by this LC resonance may seriously reduce the phase margin at higher frequencies with some capacitive loads, dangerously increasing the risk of instability.

A square wave test to investigate stability into capacitive loads is therefore of limited usefulness, and may be seriously misleading. My experience is that amplifiers sometimes have a stable state and an unstable state, and triggering them into instability may need a precise choice of load and input signal, in one case driving the amplifier heavily into clipping and then removing the input signal caused a dramatic latch-up and oscillation effect. Failure to oscillate with just any square-wave input and the usual 2uF test load may be necessary, but is no guarantee of unconditional stability. I also use high level sinewave signals at various frequencies, and look for signs of instability close to clipping as the signal level is adjusted to give different levels of clipping. Going into or out of clipping the loop gain is changing, and so the feedback loop unity gain frequency is in effect shifted over a wide range, revealing potential stability problems over a similar range. To limit dissipation it is convenient to use a toneburst signal for these clipping tests.

The next two photos are oscilloscope traces showing examples of clipping behaviour:



The first of these is just a single notch when coming out of clipping, and this is typical of latch-up effects rather than instability. In this case it was caused by a bad choice of frequency compensation circuit such that the compensation capacitor charged up during clipping and had to discharge before normal linear operation could return. A change to the compensation arrangement was needed to cure this.
Stability problems generally have a different appearance of the type shown in the second photo. Here a short burst of oscillation occurs when coming out of clipping, but in this case the effect continues long after this as seen from a slight ripple on the trace. A change in the value of the compensation capacitor was needed to remove this effect. The positive and negative clipping look different, which is not uncommon, here the positive clipping appears to include a latch-up effect in addition to the stability problem.
Had I relied only on observations of square-wave ringing with a 2uF load below clipping I would have said there were no stability problems to worry about, and stopped there without doing the necessary modifications.

It is known that the choice of test signal rise-time can often have a great effect on observed 'ringing', and it is possible to claim 'excellent transient response' just by careful choice of the rise-time of the test signal. This was mentioned in one of the Douglas Self articles, "The Audio Power Interface", Electronics World Sept.1997 p717-722.

The low-pass filter used at the input of my own amplifiers helps give a smooth square wave output with little ringing, but it was not included for this purpose. Anyone who still wants to reduce ringing further in the mosfet amplifiers could try reducing the damping resistor in parallel with the inductor, maybe to one ohm.

HOME.