How to measure phase margin of an amplifier?

Hi!

How do you guys measure the phase margin of an amplifier?

I don't want to make an amplifier that risk becoming unstable, and I don't want to overcompensate the amp with a too low dominant pole. Without access to a network analyzer, how do you do this?

I found an article here that describes a method for measuring the phase margin of a power supply feedback loop, and I suppose this would for for an amplifier also. They are using a transformer to inject a signal, what type of transformer do you think would be suitable?

I suppose a good indication of stability can be made by looking at the response to a small signal squarewave. If it rings it's phase margin is probably too low, right? But is this method accurate enough?

Anyone here who can point me in the right direction?

Regards,
OJG
 
Hi PMA,

Yes it really is loop-gain that I am trying to measure and if one can make the amp work without feedback then that is probably the most accurate method.

Problem is though that if the loopgain is high, say 80-100dB then even a tiny bit of noise on it's input will make it saturate. How can you avoid this?

The amp that I want to measure does not have a DC servo, but I suppose I could rig one up just for the measurement.

Brgds,
OJG
 
stability

Injecting square waves and looking at ringing is an excellent technique.

Injecting a small hf squarewave on top of a large low frequency sinewave is also very good, as it shows you stability at many operating currents.

The network analyzer method of measuring the loop gain is a great one also. Any kind of transformer works fine, because you make A/R measurements in the network analyzer, which takes the xfmr characteristics out of the picture. Now, you might argue that if the transformer had a lot of leakage inductance, you could make the amp unstable. Easy way to deal with this is to put 50 Ohms (or less) across the transformer winding which goes in series with the feedback.
 
Similar to the way that you measure the phase margin of a power supply -- I posted this link last week to a video from Frederick Dostal of National Semi -- http://www.diyaudio.com/forums/power-supplies/158486-power-supply-bode-plot-how-video.html
Measure power-supply loop transfer | Test & Measurement World
Measure power-supply loop transfer - 2008-09-01 06:00:00 | Test & Measurement World

In a power supply you interrupt the voltage to the error amplifier. In an amp you measure the magnitude and timing between the input and output signals -- there are ways to do this without an oscilloscope -- this application note by intersil uses one of their specialty transistors, but you can just as easily use high speed comparators: http://www.intersil.com/data/an/AN9637.pdf -- there was also a "phase meter" in Audio Amateur decades ago which used run-of-the mill comparators --
 
Last edited:
Hi!

How do you guys measure the phase margin of an amplifier?

I don't want to make an amplifier that risk becoming unstable, and I don't want to overcompensate the amp with a too low dominant pole. Without access to a network analyzer, how do you do this?

I found an article here that describes a method for measuring the phase margin of a power supply feedback loop, and I suppose this would for for an amplifier also. They are using a transformer to inject a signal, what type of transformer do you think would be suitable?

I suppose a good indication of stability can be made by looking at the response to a small signal squarewave. If it rings it's phase margin is probably too low, right? But is this method accurate enough?

Anyone here who can point me in the right direction?

Regards,
OJG

Let's say that your exiating gain crossover frequency is fc. Let's also assume that your feedback network has a flat frequency response (e.g., no lead capacitor, etc.) Change the feedback network to increase closed loop gain by a factor of ten. Measure the input-output phase of the amplifier at fc. This measurement must be performed absent any input low-pass filtering on the amplifier. This I/O phase measurement at fc will get you fairly cloase to the amount of open-loop phase lag at fc. If you measure 90 degree lag at fc, your phase margin is about 90 degrees. If you measure 135 degree lag at fc, your phase margin is about 45 degrees.

Another test is as follows: Add a pole in the feedback loop at twice fc and decrease closed loop gain by 1 dB. If the amplifier does not oscillate, you have at least 22 degrees of phase margin. This of course is not enough. Next, put a pole in the feedback loop at fc and decrease closed loop gain by 3 dB from its design value. If the amplifier does not oscillate, you have at least 45 degrees of phase margin. This whole approach is based on how much lagging phase shift an additional pole adds to the feedback loop and by how much that pole decreases the loop gain. By reducing the closed loop gain setting, we are compensating for the decrease in loop gain at fc caused by the introduction of the pole, leaving only its lagging phase effect.

Cheers,
Bob
 
I suppose a good indication of stability can be made by looking at the response to a small signal squarewave. If it rings it's phase margin is probably too low, right? But is this method accurate enough?
The closed-loop response is the best approach to testing stability because the closed-loop behaviour cannot entirely be predicted from open-loop, especially as you have to modify the circuit to make it work in open-loop. After all, the point is not to achieve a particular phase margin (whose prescribed values presuppose an ideal 2nd order system) the point is to achieve a stable closed-loop behaviour. The textbook phase margin target is just a rule of thumb to help you get a reasonable closed-loop response. It can be instructive to look at the OL response to check it is what you expect, but don't rely upon it.

Phase margin is not the whole story when it comes to NFB amplifiers. The circuit can be unstable in ways that are not shown by a simple phase margin measurement. So it is worth really stressing the circuit to try to make it squeal.

Keep everything about the circuit unchanged if you can. If you remove the input filter this may change the stability. You don't need a transformer. You can inject a signal into the feedback at the subtractor input via a big resistor in series with a cap. You just need to give it a sharp kick and see how it reacts.

No one has mentioned loading. You need to make sure you have adequate phase margin into all realistic loads that your amp will drive. This typically means anything between say 1 ohm resistive and no load, and a selection of capacitive loads ranging from, say, 1nF to 10uF. This is a Krell style test.
But be careful because some NFB circuits are only marginally stable and can burst into full power oscillation at several MHz when faced with a capacitive load, even with no input signal. So you may blow your transistors up. To mitigate this, put high-power resistors in series with the psu connections to the output transistors, say 10-ohms. When you first attach caps to the output they will save your transistors if the amp goes mad. Short the safety resistors if it is ok and retest.

Also, a well-implemented NFB amp with no input connected should sound virtually silent even with your ear stuffed into the loudspeaker drivers. You should have no hum at all. The tweeter will have a very faint hiss. Once you connect a pre-amp or other input device you should expect an increase in hiss and maybe a little hum. But not the sort of hum you can hear from more than a foot away.

Good luck,
Brian
 
Last edited:
1. The closed-loop response is the best approach to testing stability because the closed-loop behaviour cannot entirely be predicted from open-loop, especially as you have to modify the circuit to make it work in open-loop.

2. After all, the point is not to achieve a particular phase margin (whose prescribed values presuppose an ideal 2nd order system) the point is to achieve a stable closed-loop behaviour.

3. The textbook phase margin target is just a rule of thumb to help you get a reasonable closed-loop response.

4. It can be instructive to look at the OL response to check it is what you expect, but don't rely upon it.

5. Phase margin is not the whole story when it comes to NFB amplifiers.

6. The circuit can be unstable in ways that are not shown by a simple phase margin measurement. So it is worth really stressing the circuit to try to make it squeal.

Keep everything about the circuit unchanged if you can.

7. If you remove the input filter this may change the stability.

8. You don't need a transformer. You can inject a signal into the feedback at the subtractor input via a big resistor in series with a cap.

9. You just need to give it a sharp kick and see how it reacts.

Wow Brian, this requires tons of explanations...

1. Short of loop breaking effects (that can always be minimized if you know what you are doing), why?

2. Why not?

3. Why? Would you suggest that a design with low measured phase margin has any chance to be unconditionally stable?

4. Why? We are talking about stability, isn't it?

5. And what's the rest of the story?

6. How is different from the phase margin issue? If an amp is unstable in capacitive loads, this will show in the phase margin as well.

7. How/why?

8. Indeed, you don't necessary need a transformer, but I don't understand your suggestion. Care to explain?

9. Huh?

My only extra comment is that measuring the phase using a scope is impossible to any useful degree of accuracy.
 
If we're isolating the debate to stability only, then implementing a circuit with a reasonable phase margin and gain margin should be the goal. With PM > 0 and GM < 0, the amp is stable. Most people would prefer some margin, though...

However, if the debate is expanded to include amplifier closed-loop transient response, then PM does not tell the entire story. Most textbooks include calculations of the Q and overshoot as function of PM. Those equations are only valid for 2nd order systems. Most amps are higher order than this. An amp can have PM > 45 deg but a not-so-well behaved transient response. This is usually resulting from high frequency poles or - even worse - from right half-plane zeros. In many cases, I've found that amps may have excellent PM but marginal GM. These amps tend to show more HF ringing on transients than those with excellent PM and excellent GM.

In the op-amps and voltage regulator circuits I've designed, I've usually aimed for a PM of at least 60 degrees (worst case). I use AC analysis as it tends to be one of the fastest simulation types. But I also look at the transient response. This exercise is then repeated in the lab once I get the circuit built. Having access to a network analyzer does have its advantages...

~Tom
 
Most amps are higher order than this. An amp can have PM > 45 deg but a not-so-well behaved transient response. This is usually resulting from high frequency poles or - even worse - from right half-plane zeros. In many cases, I've found that amps may have excellent PM but marginal GM. These amps tend to show more HF ringing on transients than those with excellent PM and excellent GM.

Measuring the phase/gain margin cannot substitute for a competent design, but only to check against component models and parameter variations.

An audio (and not only) amp that is higher order (usually relying on the asymptotic frequency characteristic given by the HF poles) is poorly designed. Also an audio amp in which the stability margins largely depend on the signal level (the most common reason for large signal oscillation bursts) is an incompetent design. Both of these circumstances can though be determined by closely examining the measured Bode diagrams.
 
Measuring the phase/gain margin cannot substitute for a competent design, but only to check against component models and parameter variations.

Agree.

An audio (and not only) amp that is higher order (usually relying on the asymptotic frequency characteristic given by the HF poles) is poorly designed.

It's very possible to design an audio amp where the bandwidth and, hence, stability is determined dominantly by discrete RC's. If the bandwidth and/or stability of an audio amp is set by any other mechanism, I would agree that the design is poor. However, when designing op-amps -- especially designing for maximum bandwidth within a given power budget, it is very common that the second pole in the response is set by circuit parasitics. That said, these parasitics, while technically uncontrolled, are quite repeatable from device to device and lot to lot. It all depends on how close to the bleeding edge you want to be...

~Tom
 
However, when designing op-amps -- especially designing for maximum bandwidth within a given power budget, it is very common that the second pole in the response is set by circuit parasitics.

That is a completely different kettle of fish. Another example is using opamps with >1GHz bandwidth. Ever snipped a SOT unused pin to get rid of that pesky 0.5pF parasitic (aka "frequency decompensating" :D )?

Then again, this is supposed to be DIYAudio (although it lately looks like a cuckoo's nest).
 
If we're isolating the debate to stability only, then implementing a circuit with a reasonable phase margin and gain margin should be the goal. With PM > 0 and GM < 0, the amp is stable. Most people would prefer some margin, though...

However, if the debate is expanded to include amplifier closed-loop transient response, then PM does not tell the entire story. Most textbooks include calculations of the Q and overshoot as function of PM. Those equations are only valid for 2nd order systems. Most amps are higher order than this. An amp can have PM > 45 deg but a not-so-well behaved transient response. This is usually resulting from high frequency poles or - even worse - from right half-plane zeros. In many cases, I've found that amps may have excellent PM but marginal GM. These amps tend to show more HF ringing on transients than those with excellent PM and excellent GM.

In the op-amps and voltage regulator circuits I've designed, I've usually aimed for a PM of at least 60 degrees (worst case). I use AC analysis as it tends to be one of the fastest simulation types. But I also look at the transient response. This exercise is then repeated in the lab once I get the circuit built. Having access to a network analyzer does have its advantages...

~Tom

Hi Tom,

These are all very good points. Indeed, I have seen many amplifiers with adequate phase margin and poor gain margin. I was always taught to look for 6 dB gain margin.

In most conventional Miller-compensarted amps, gain margin can be reasonably verified to be at least 6 dB by changing the closed-loop gain to be 1/2 of what it normally is.

I agree that the second-order system view is not very accurate, since there are usually numerous parasitic poles that detract from the starting phase margin of 90 degrees. For a number of multiple poles far out, the concept of excess delay is better. In that case, excess delay translates to a given amount of phase margin at the gain crossover frequency. Under those conditions a plot of peaking vs. gain margin can be quite useful.

Think of maybe three poles out around 10 MHz for an amplifier with a 1 MHz gain crossover. Those poles begin to look more like a constant delay at 1 MHz. Moreover, they add phase delay while adding very little amplitude attenuation.

Cheers,
Bob


Cheers,
Bob
 
syn08 said:
Wow Brian, this requires tons of explanations...
I don't think you need tons of explanation so here are a few grams.
CL performance is the goal. Seems self-evident to me.
CL performance is affected by many more things than phase margin. Such as linearity, saturation, subtraction error, delays and more. When you apply feedback and make a system's input a function of its own output you create a new system and IMO its characteristics should be considered afresh.
Input filter components can load the i/p node and affect its impedance which is important both for stability of the LTP and for noise susceptibility.

By "kicking" the system I mean to excite it with a fast signal like a pulse or a square wave. Like you would test a car suspension by driving it over a curb (if it wasn't your car of course!). Technically, this is injecting high frequency energy and seeing how the system reacts. As you know, it is usually desirable that the system does not get excited and is well damped. It is easy to feed the output of a sig gen through series RC to the -'ve input node of the LTP as a convenient injection point.

My only extra comment is that measuring the phase using a scope is impossible to any useful degree of accuracy.
Yes the accuracy is poor (10 degrees or so) but one can estimate the phase margin quite well by observing the square wave or step response on the scope, assuming it is predominantly a second order system.
 
since there s some expiremented people by there,
i ve got a question..
what is, by your experiences, the accuracy of
simulators in checking these parameters, phase margin
and gain margin?
is real world largely different from the virtual experiments?...

thanks for the insights,
 
Bob Cordell said:
For a number of multiple poles far out, the concept of excess delay is better. In that case, excess delay translates to a given amount of phase margin at the gain crossover frequency.
When I talk about delay I mean time delay. I use the term phase shift and sometimes phase lead or phase lag to describe what I assume you mean when you use delay. That is, the apparent phase delay of a simple sinusoid. I notice a number of novice's get easily confused between the concepts of inertial phase shift and time delay and I like to point this out now and again for clarification.
 
I was always taught to look for 6 dB gain margin.

Bob - thanks for your insight. When designing op-amps I was taught to design for GM better than 10 dB. But then we also usually designed for 60 degrees PM... In my experience, the 6 dB figure you mention is adequate if you can accept a little buzz on the edges of the transient response.

When I talk about delay I mean time delay. I use the term phase shift and sometimes phase lead or phase lag to describe what I assume you mean when you use delay.

Potato - potahto... Time delay and phase delay are two sides of the same thing. One is in the time domain, the other the frequency domain. It's been scary long since I've done any Laplace or Fourier transforms but you should be able to figure the equivalent phase delay from a given time delay. However, a constant time delay will imply a frequency dependent phase delay. This may be where the confusion between phase and time delay arises.

~Tom
 
tomchr said:
Potato - potahto... Time delay and phase delay are two sides of the same thing. One is in the time domain, the other the frequency domain. It's been scary long since I've done any Laplace or Fourier transforms but you should be able to figure the equivalent phase delay from a given time delay. However, a constant time delay will imply a frequency dependent phase delay. This may be where the confusion between phase and time delay arises.

~Tom
I am sorry sir but they are certainly not two sides of the same thing. They are entirely different effects and have different implications. This will become clear to you when you do refresh yourself on Laplace transforms.
 
I am sorry sir but they are certainly not two sides of the same thing. They are entirely different effects and have different implications. This will become clear to you when you do refresh yourself on Laplace transforms.

Could you elaborate or are you really suggesting that I - I?! - do the hard work of reading up on Laplace transforms?! I really don't like hard work... :)

~Tom