Op-amp phase shift and phase margin question - Page 1
Forum section: electronics / beginners

author: Yuu
author_rank: Regular Contributor
timestamp: August 01, 2023, 11:46:24 pm
content: I'm familiar with plots of the open-loop phase shift of an op-amp, such as the plot below, in the context of compensation.If you took the compensated op-amp of the plot above and made a simple buffer circuit with say a 100 Hz sine wave, does that mean the buffered output will have a -90 phase shift?I'm curious because when people make integrators with op-amps, you add a capacitor to the feedback loop which means you are introducing a -90 degree phase shift. Well, if you indeed already have a -90 phase shift then you've just made an oscillator.Also, I was reading Nwavguy's blog post on his O2 headphone amp. He uses these NJM4556A op-amps. Below is a plot of the phase of the op-amp output. Now, I don't think this plot is for open-loop phase. I think it's for a closed-loop configuration with 40dB gain. At least that's how I decipher it.Anyway, Nwavguy claims and proves he has less than like 1 degree of phase shift at 10 kHz. How is that possible? The spec sheet of the op-amp looks like you already have -15 degrees of phase shift at 10 kHz. How does that work?(Here is his plot btw)

author: MathWizard
author_rank: Super Contributor
timestamp: August 02, 2023, 12:31:14 am
content: I'm just learning this stuff too. For closed loop voltage gain Av=Vout/Vin, and the phase angle being the phasor/complex/polar angle of the top minus the angle of the bottom. If you had +/-180deg phase shift, that would be deconstructive interference, so 2, equal magnitude sine waves w/180deg phase shift would add to zero. It's 0 and n*360 degrees phase shift that would allow for oscillation, if the closed loop gain overcomes any losses. And so the phase shift can be off a bit, so long as there's enough gain. I guess it can be almost 180deg, and if you had enough open loop gain, you can get a closed loop gain greater than 1 still.IDK about uncompensated op-amps tho, I'm working designing a BJT AM radio receiver. I look forward to trying to make active filters with op-amps, IDK if that will be easier or harder.

author: Yuu
author_rank: Regular Contributor
timestamp: August 02, 2023, 01:09:54 am
content: Quote from: MathWizard on August 02, 2023, 12:31:14 amYes but if you picked up -90 phase shift through the op-amp, -90 through a capacitor for say an integrator configuration, then you enter theinvertinginput. That is -360 degrees giving you constructive interference. Hmmmm that makes me want to double check about the feedback factor and how easier that would be to stabilize vs with a resistive network. Will think about tomorrow.It's cool you're designing an AM receiver. I'm playing with analog circuits before moving on to RF sometime in my life. I like math too. I want to eventually get around to working through a complex analysis book before I get into too much RF stuff. They love their complex transformations in that field.

author: MathWizard
author_rank: Super Contributor
timestamp: August 02, 2023, 02:30:56 am
content: So you mean without any external network, if you took the op-amp, removed the added compensation, or didn't add any externally, if that already had -90deg phase shift...then add an external network, with -270 total, yeah then that should be back to 0deg. Maybe I'm mixing up, the -180 from the inverting configuration, and then externally another -90 for -270.....but maybe that's not how it is.

author: Kleinstein
author_rank: Super Contributor
timestamp: August 02, 2023, 07:03:55 am
content: Well below the GBWlimit of the OP-amp the phase shift in the closed loop configuration is set by the external feedback network. Here parasitic capacitance and the input capacitance of the OP-amps may be more relevent than the OP-amp. Added capacitance may even produce a phase shift in the other direction.

author: magic
author_rank: Super Contributor
timestamp: August 02, 2023, 08:03:57 am
content: I once posted this image, which shows (simulated) input and output waveforms of an "ideal" 1MHz opamp working at 40dB noninverting closed loop gain at 1kHz.V(in)is the input signal, delivered to IN+ of the opamp.V(fb)is the IN- signal coming from the feedback divider, it is also exactly 1% of the output.V(fb,in) = V(fb)-V(in)is the difference between them, i.e. the differential input voltage driving the opamp. Note that it's shown inverted here (IN- - IN+ rather than the usual IN+ - IN-).You can clearly see that the output (which is 100·V(fb), green) is 90° out of phase with the differential input (red). This is the 90° open loop phase response of the opamp at 1kHz, as expected.You can also see that the output of the opamp is 100V peak and the differential input voltage is 0.1V peak. This is the 60dB open loop gain at 1kHz, as expected for a simple 1MHz opamp.Since V(fb,in) = V(fb)-V(in), it follows that V(fb) = V(in)+V(fb,in). So feedback voltage (IN-) is the sum of the input signal and the (small) differential input voltage of the opamp, which is what happens to be required to generate this particular output waveform, as determined by open loop response of the opamp. This is the closed loop response, and the feedback signal approximately equals the input, as expected. The output is simply 100x larger than feedback.Doing more math we get V(out) = 100·V(fb) = 100·(V(in)+V(fb,in) = 100·V(in) + 100· V(fb,in). The 100 here is the closed loop gain, so increasing closed loop gain increases the difference between actual output and "ideal" output (simply 100·V(in)). You can see on the plot that this difference consist mostly of a phase shift, but there is also a small amplitude error (the output is slightly less than 100x more than the input).So NJM4556 may have a fair bit of phase error at 10kHz at 40dB gain, but in the O2 it works at unity gain and the error is much smaller.

author: magic
author_rank: Super Contributor
timestamp: August 02, 2023, 08:18:11 am
content: Quote from: Yuu on August 01, 2023, 11:46:24 pmThe feedback capacitor of an integrator usually forms a capacitive divider with the capacitance of the signal source and an RC highpass filter with the resistance of the signal source. This kind of feedback circuit has almost zero phase shift at high frequencies (where it's mostly a capacitive divider), and if anything, the highpass filter component introduces phase lead rather than lag at lower frequencies below its RC corner.Ignoring input capacitance, an integrator can usually be regarded as working at unity gain: feedback voltage = output voltage, because everything else connected to IN- pin is too high impedance to matter. If source capacitance is not negligible, then the opamp works at some positive noninverting gain.

author: xavier60
author_rank: Super Contributor
timestamp: August 02, 2023, 02:32:34 pm
content: A typical compensated opamp consists of a differential transconductance amplifier driving an internal Miller integrator or external compensation capacitor. The integrated signal is then buffered before being output.Applied input difference voltage causes a rate of change in output voltage rather than instant amplification.If a fixed DC voltage is input, the output will slew with a linear ramp.My drawing shows what's happening when a triangle wave is input.Although there is little phase shift between the 2 waveforms WRT ground, the opamp sees a 90° shifted difference signal.In practice, the feedback waveform won't be quite the same amplitude.Also, the output waveform will have slightly rounded corners.

author: Yuu
author_rank: Regular Contributor
timestamp: August 02, 2023, 09:15:28 pm
content: Quote from: magic on August 02, 2023, 08:03:57 amOh okay. This makes sense now. The error signal, which is the differential input, is what takes a phase shift. I was thinking too much about just the feedback signal and not the difference between the input and that.That's a nice plot by the way. Thank you.Quote from: magic on August 02, 2023, 08:18:11 amI should really know better. I suppose I tend to see a capacitor, know its impendance is given as 1/jwC, and then just automatically think "oh, -90 phase shift." If there is resistance and capacitive reactance then I should properly calculate phase using voltage divider equations and what not.Quote from: xavier60 on August 02, 2023, 02:32:34 pmThank you for the post.Quote from: MathWizard on August 02, 2023, 02:30:56 amNot an inverting configuration but a -180 from the inverting input. If you consider a sort of signal flow representation of the op-amp, it becomes clearer.That's why the necessary, but not sufficient, condition for oscillation is -180 degrees for op-amps. In the end it's still n*360 degrees for constructive interference like any wave phenomena.Anyway, I need to study up compensation and also get more familiar with reactances in feedback paths.