# What is Cf in OpAmp circuits? OpAmp design books?

Discussion in 'Electronic Design' started by Frank, May 20, 2004.

1. ### FrankGuest

Hi everyone,

The circuit below was posted as a reply to a question I asked back in
February (Thanks for all the tips!). Other projects have taken a
higher priority up until now and I'm getting back to this one.

Showing my analog ignorance, I admit I don't know what the capacitor
Cf is for. From what I've read, is it supposed to provide some sort
of stability to the circuit? The problem is I can't find any
information on calculating the best value for this capacitor. I'm
assuming it's something fairly small in the pf range. The circuit is
basically set and left alone, not varying the values at any frequency
at all.

Any pointers? I can do the math.

Also, any good books on OpAmp circuit usage?

Thanks,

-Frank

Please use a fixed-spaced font to view.

+-----------+
Vin --+--->| Regulator |------------------------+-->
| +-----+-----+ |
| | CF R2
| | +---||------+ \
| | | | /
| | | /| | |
| | | /-|---+----+
| +-------------+----< | |
| | \+|---+ \
| \ \| | R3
\ Rb | \
R1 \ | /
\ / | |
/ | | ---
| --- | Gnd
| Gnd |
| K x Vref |
| +----+
| Vref ( < 5V ) |
+-------------------------------+----------+
| | |Rh
| | +-----+
| | Radj | | Variable
/---/ zener or +-------| | Pot
/ \ TL431 | |
--- 2-wire <===============| |
| interface +-----+
| |Rl
--- |
Gnd

2. ### Tim WescottGuest

Cf slows down the response of the op-amp, to keep the circuit from
oscillating. It doesn't really matter that you _want_ the circuit to
sit still when left alone, if it's inherently unstable it'll burst into
song on its own no matter how hard you don't touch it.

You need to set Cf high enough so that the gain around the loop from the
'adj' pin of the regulator, through the regulator's internal
compensation, through the op-amp and back to the 'adj' pin, is
significantly less than 1 at the frequency where the phase is shifted by
180 degrees.

You don't know how the regulator is compensated, and furthermore
different regulators from different manufacturers or different times
will be compensated differently. I'd suggest that you dink around with
the values of Cf until you find the value that just makes it oscillate,
then install a Cf that's at least 10 times that amount. I'd probably
bump it up to 100x if the capacitor didn't get too large, especially if
I were designing for production.

At that point (ringing) it's just underdamped but you may still have some
reasonable phase margin, no? You're suggesting critical deamping?
The way I was taught to do it was based on analyzing a 2nd order simplified
(plenty of small parasitics left out) small-signal model amplifier and
'noticing' that the placement of Cf tended to make it dominant. For
something much more complex, it seems debatable whether or not it's even
pole/zero analysis tends to be somewhat broken in SPICE3... I wonder if
Kevin fixed his?)
Linear Technology's application notes advocate the 'apply step to error
input, examine shape of output response, iterate with compensation as
needed' approach to design.
Sad commentary on some of the people who purchased that book (this is an
Amazon.Com review):
"Get yourself a decent OpAmp "cookbook", you'll learn far more from a "this
is how they did it" approach than this author's methodology. "

4. ### Tim WescottGuest

By the time it's really ringing the phase margin is no longer
reasonable. A second order system with a 63 degree phase margin is
critically damped; with a 45 degree phase margin your damping ratio is
about 1/2 and you'll just be showing ringing.

I wouldn't design for 45 degrees phase margin unless I had a high level
of trust in the system components; I don't feel that a regulator could
be trusted to this level, and the set of all possible regulators that
might be put into the circuit _certainly_ can't be trusted.

Aw, c'mon, those overclocker guys haven't even broken a sweat at a 20% hike
in Vcc!

Just kidding.
Nice to know I'm not alone!
That is impressive.

I like your 'oscillating power supply' feedback fix; I'll definitely give it
a try some time. What order feedback networks do you usually place pads
down for on the PCB? I've gone through Pressman's book on switch-mode power
supplies, and while there are a few things I disagree with him about in his
feedback compensation chapter, he did manage to convince me that 2nd order
network (a pair of zeroes and poles) can be useful.
I have the typical engineer paranoia that the cookbook approach isn't going
to work at just the point where it needs to to prevent the airplane from
falling out of the sky, and hence understanding what's going on is
requisite.
That's a spot-on reason a lot of truly good books get bad reviews, in my
opinion -- someone who doesn't yet have the background to understand them
inadventently purchased them and now they're pissed. What's strange is that
usually I can recognize such situations in my own book-buying endeavors and
then just refrain from reviewing them!
The same can be said of many Prompt Publications books. I'm pretty sure
they and Tab will print just about anything that's vaguely technically
related so long as they're covinced it'll sell -- quality of the work not
withstanding.
I'd certainly be interested!

---Joel

6. ### Terry GivenGuest

Nice reply, Tim. If the regulator doesnt oscillate (Murphy pretty much
guarantees this to be the case when your (very good) design technique
requires it), then try a load step - R + FET + pulse generator. Switch the
load on and off, and look at the output voltage - If you get an RC-like
exponentially decaying under- or over-shoot (load on & off respectively)
then its stable. As you increase Cf, the time constant will increase
(amplitude probably will increase too).

This time constant is directly related to the crossover frequency of your
closed-loop control system. What time constant do you need? well, thats up
to you, but is often governed by the load changes you expect to see in
practice (pentium VRMs see > 20A load changes in a few 10s of ns - these
circuits tend to have bloody short time constants)

If instead of a nice exponential decay you get ringing (usually with an
exponentially decaying envelope) then your circuit is exhibiting closed-loop
oscillations, and Cf needs to be increased. If you make Cf small enough, you
may well get a lovely sine wave superimposed on your DC voltage.....

dont forget to test your supply with a variety of loads, and at a variety of
temperatures. Tims rule-of-thumb "Find Cf that just works then use 10x" is a
great way of empirically designing compensation networks, as it provides you
with plenty of margin to soak up load & device variation over time,
temperature and sock colour.

It turns out that stability analysis of closed-loop control systems is
actually fairly difficult - many EE grads cant do it at all. And very few
books on power supplies tell you how to do it, either. A class in control
systems theory might help, but they often talk about mechanical and chemical
control systems, and handily ignore opamp/psu control loops. And then when
you do find an article on psu loops, they always seem to miss out crucial
bits of information...*sigh* Or some maths nut implements an H-infinity
controller or some other stupid, mathematically evil thing, leaving you
still wondering how the hell to calculate Cf....

If you really want to learn how to do it for opamps, read Jerald Graeme's
book "optimising op amp performance" ISBN 0-07-024522-3 - he explains it all
clearly and carefully. If your maths is good, go for Jiri Dostals
"Operational Amplifiers" ISBN 0-7506-9317-7, but its a lot harder read (Bob
Pease swears by this book)

Cheers
Terry

7. ### Terry GivenGuest

Hi Joel,

a critically damped (delta = 0.71) 2nd order circuit has a single "ring"
with about 20% overshoot, followed by almost no undershoot and settling to
the steady-state value; the rise time is quite a bit less than a first-order
response. By the time delta = 1, the 2nd order cct looks just like a 1st
order ie RC response. As delta increases above 1, the "time constant" of the
pseudo 1st-order response gets longer and longer (and the 1st-order
approximation gets more and more accurate, IIRR).

Watch a pentium get real pissy if you give it a 20% overshoot! Ultimately
though *YOU* get to choose the response that best suits your app, so choose
wisely. Usually its a tradeoff between response time and overshoot. If
response time aint critical, damp the crap out of it! I once worked on a
400W flyback converter with a crossover frequency of 1Hz - a moving coil
meter faithfully displayed the step response!

Kevin will love me for saying this, but a transient test is gemnerally the
way to go in spice. I have not had much success using spice TF analysis, and
so gave up on it years ago (quite probably it works fine under certain
circumstances, but I had wasted enough time so did something that worked,
and havent looked at it since. I bet its great for all-passive circuits like
LC filters).

I have tackled the analysis of 3rd and (once, never again) 4th order
systems, analytically. The 3rd-order system wasnt too bad (well, dozens of
pages of maths, bloody hard to ensure I hadnt made any ****-ups) and I got
closed-form design expressions. The 4th order system didnt decompose nicely,
so I couldnt analytically find the roots, but luckily god invented matlab
. The exercise was painful enough I just do that stuff numerically now,
with a decent maths package (mathcad, matlab)

I sometimes do opamp circuit simulation using a VCVS with a gain of 1e9, ie
an almost perfect opamp. Then I use a 1st order laplace block to simulate
GBW, followed by the device macromodel (which is usually very close to the
laplace block version), but only when I need to show the effect of the opamp
on cct performance (active filters etc)

gear like network/frequency-response analysers etc. I came up with a
decidedly crude method a few years ago. If smps oscillates, measure the
oscillation frequency - this is your current (pun unintentional) crossover
frequency. It is trivial to analyse the error amp circuit, its the rest of
the smps thats poxy to analyse. If Fcross isnt acceptable, fiddle with your
error amp gain only (leave phase the same - piece of piss to do in spice)
until Fcross is where you want it (more gain = higher Fcross, less = lower).

Once Fcross is where you want it, re-design your error amp for the SAME gain
at Fcross, but much more phase boost, thereby stoppping the oscillations. It
bloody well works, too. I havent actually tried fiddling with gain alone to
move Fcross, its always been good enough for me, but the theory is sound.
All i ever do is stick in the right number of components, so the values can
be twiddled at will - actually I calculate them all, and then see how it
behaves; sometimes I screw up, and produce power oscillators, at least until
the 2nd round of R,C calcs as outlined above, but no pcb changes.
Well, I have read a lot of electrical/electronic engineering books (I have a
technical library with about 700 books in it), and JG's is pretty darned
good (I bought it because bob pease recommended it). Cookbooks are OK if you
are only interested in making their circuit work, without any real
understanding - its more akin to training (think dogs) than educating. give
me education every time.

I did a job a while ago that required an inverting sallen-key bandpass
filter. The "cookbook" equations set R1=R2=R, C1=C2=C and give equations for
Wo, Q, BW and centre-band gain, and they work, BUT Q,BW and centre-band gain
are interdependant. I wanted to do BETTER (high gain, low Q), so went back
to the original design equations (derived them myself, its easy really),
which are a whole lot messier than the cookbook equations. Sure enough, with
a little algebra I came up with a set of closed-form equations that allow me
to choose Wo, Q and gain, then calculate all the R's and C's. I got quite a
bit more gain than the cookbook solution.

Oh, and what if there is a typo in the cookbook? switching ones brain off
and following a proof by blatant assertion is usually a great way of
producing a sub-optimal design. what if the circuit you want isnt in the
cookbook? say its an existing product, designed by someone who died in a car
crash (cant ask them, unless you ouija board has a set of greek &
mathematical symbols), it works perfectly but you need to change some
parameters for a new product?

I think it would be fair to say that whoever posted that was not highly
skilled in the art of electronics, and probably couldnt follow the maths. If
you can, off the top of your head, analyse a 2nd order circuit in the
laplace domain, then you can tackle pretty much any real-world problem, and
will easily follow JG's mathematical reasoning. get it on interloan from
your local library, and have a read - you will be pleasantly surprised.

In general, any book published by TAB books is for hobbyists (who dont
understand much of anything, especially maths), and are desperately lacking
in useful information (read a book by Irving Gottlieb and you'll see what I
mean) - often they are just cobbled together out of bits of app notes. Mind
you, Walt Jung's books are damn good. I have his opamp and data converter
cookbooks, and a dozen or so analog devices app books he has contributed to.

I just read that idiots (eDICKent) review on amazon - what a moron!
obviously he is a piss-poor engineer. If he cant understand JG, I would
recommend suicide as a viable career alternative as he is way too stupid to
be of any use as an engineer.

Actually, I'll rescind that harsh career recommendation - about 2/3 of the
money I have earned as a consultant engineer has been fixing circuits
"designed" (often straight out of cookbooks-for-dummies) by idiots like that
guy. eDICKent, please keep fucking up product designs, I want a large
swimming pool :}

look at the review after him: (copied from amazon.com)
This book is an excellent treatment of this subject that is intuitive and
not overly theoretical. It draws together a lot of material available in
magazines and on vendor websites, but not available in book format. The
author starts with the traditional op amp symbol, and derives Black's
classic feedback model for various configurations (inverting, non-inverting,
etc) of the op amp. A generalized expression for the closed loop gain is
eventually obtained where the numerator is the ideal closed loop gain, and
the denominator contains the frequency response that can be analyzed with
the aid of the Bode plot. Practical design issues are logically addressed
using this simple formalism including bandwidth, phase compensation for
input and output capacitances, power supply by-pass requirements,
distortion, etc. Care is taken to indicate what conclusions apply to all op
amp configurations, and which address specific design issues. As a writer,
the author is very pointed in his approach and thorough with his analyses;
and will not win any awards for fiction suited for a general audience.
However, I highly recommend the book to anyone trying to learn how to use op
amps in a systematic way

I couldnt have put it better myself. ten bucks says eDICKent wouldnt
recognise noise gain if it leapt up an bit him on the ass.

Cheers
Terry

PS if you are interested, I can post a list of the books i do have.....

8. ### Terry GivenGuest

Hi Joel,

in hindsight I would consider it downright stupid. Numerical solutions are
shitloads faster, and avoid algebraic mistakes (easy when inverting 4x4
matrices analytically)
Alas, mr P doesnt quite give enough info....
I normally use Zf = C||(R+C). It may be a good idea to drop a C across the
top resistor of the voltage divider (usually only used in voltage mode
buck-derived converters). I always work in smt, and it costs nothing to
leave an smt part off, but is a real pain to add one that isnt there.
never read a prompt publication. probably wont now.
keep to recall who borrowed what - sometimes people dont return books, and I
have to hunt them down and kill them)

Terry