Load capacitance – is "good practise" misunderst

Go To Last Post
20 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I've read numerous posts on crystal load capacitance "“ mainly questions about how to calculate values.

But why these capacitors have to be there, doesn't seem to be covered. It's mainly written off as "good practise", and that's that. This use of the "good practise" term may also deter further questions. The "I must be too stupid by asking this question" soft of thing.

After reading a number of informative pages, I've concluded that the only reason for adding load capacitors is pure and simple frequency trimming. It has been mentioned here and there that the load capacitors have some (very little) influence on the clock frequency, but I was surprised to see that there is apparently no other reason for adding them. A couple of examples:
http://en.wikipedia.org/wiki/Pierce_oscillator#Load_capacitance
http://en.wikipedia.org/wiki/Crystal_oscillator#Electrical_model

Now for my own experience "“ which was about 10 years ago. The first time I used an ATmega128, it was on a sort of piggyback CPU board I'd made. And as the datasheet said I should, I added the mysterious "load capacitors". I'm not longer sure what the value was, but I think it was 12 pF. The crystal frequency was 14.7456 MHz.

The clock wouldn't run at all. No chance. Nothing. Then in desparation, I removed those cursed capacitors. And - VOILA - there be clock cycles! Ok, there might have been something wrong with one of the capacitors, but I don't think I tried to measure that. I was just happy to see oscillation. And it was probably late in the evening...

Since then I've not even bothered adding the load capacitors on later circuit boards. The frequency accuracy is (for my purposes) absolutely adequate without them.

Some application notes say something like "Start with 1 - 2 pF, and then increase...". Why not just start with zero? I've never ever had an AVR that wouldn't run at a stable frequency without load capacitors. So my suggestion is: Use them for trimming (if necessary), or don't use them at all.

My purpose with this thread is not to pick on those who by habit just add 2 x 22 pF, but rather to de-mystify load capacitors for those who are as confused as I have been. If anyone has more scientific reasons for adding load capacitors, please share your knowledge. I love learning new stuff. :wink:

Best regards,
ErikT

You're absolutely right. This member is stupid. Please help.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The Pierce oscillator requires two feedback capacitors. They aren't load capacitors, but the load capacitance of the crystal is required for calculating the optimum values. Most oscillators will work using stray capacitance for feedback, but I wouldn't recommend it.

Leon Heller G1HSM

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can't speak for the AVR specifically, but I've seen processors where the crystal was not oscillating, and adding the caps caused the crystal to start working.

That's not a "scientific" answer, but clearly those caps are critical for at least some processors.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
The Pierce oscillator requires two feedback capacitors. They aren't load capacitors, but the load capacitance of the crystal is required for calculating the optimum values.

Can you provide a link to some web page that explains this? Wikipedia certainly doesn't mention it like that at all.

You're absolutely right. This member is stupid. Please help.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Leon Heller G1HSM

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wikipedia indeed has an explanation:

Quote:
The crystal in combination with C1 and C2 forms a pi network band-pass filter, which provides a 180 degree phase shift and a voltage gain from the output to input at approximately the resonant frequency of the crystal.

Phase shift plus positive feedback result in auto generation, to put it in other words.
Leon is faster - so me second for that.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's a black art. Those who know these things keep it a secret from the rest of us. ;)

The Xplain board uses a watch crystal and has two caps. 18pf and 22pf.

The Butterfly board also uses a watch crystal and has no caps.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Some AVRs have the caps built into the chip for watch crystal oscillators. Thus, the caps are there, just invisible to you.

As for why caps. it really is a long story. If you are a circuit theory person, its no great mystery. It has to do with something called the "Barkhausen Stability Criterion". This describes the conditions of amplitude and phase required for oscillation to take place. With a Pierce oscillator, you do not get the required phase shift without those caps. And, for those of you who like puzzles, did you know that the Pierce and Colpitts oscillators really are the same; they just call different points in the circuit as "ground". If that is true, which I assert really IS true, one would not ask why the two feedback caps can't be left out of a Colpitts oscillator. So, why all the angst about the same two caps in our standard crystal (Pierce) oscillator?

I would argue that the Pierce oscillator caps are not appropriately called "good practice". They are necessary. Sometimes, once in a while, you will find a situation where the circuit will work without them. When this happens, it is only because there is stray capacitance (typically 3-6pf) at each oscillator pin which you just don't see (because you have not put in a part) but is there. The specific value is defined by the load capacitance specification of the crystal and is REQUIRED if you want it to oscillate at the specified frequency.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For the internal capacitors inside the AVR, one should check for the errata: with many chips the internal caps don't work as claimed in the datasheet.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And if I'm not mistaken, the two load caps present a load to the crystal as if they were in series, e.g. two 22pF caps load the crystal with 11pF. Together with the pin and PCB capacitance you can trim this total capacity to the required/recommended capacitance of the particular crystal. Can take a bit of experimentation.

At work I did that once to trim a circuit to +/-1ppm (initial); of course you cannot measure the frequency on the crystal itself directly, you must use the digital output of the oscillator, as some AVRs provide on a CKOUT pin that be enabled with a fuse.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, they are effectively in series.

Leon Heller G1HSM

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You don't necessarily need the CKOUT pin, at least on an Xmega. You can use a counter to divide it down a bit and wiggle an output compare pin. That can allow you to use a frequency counter on a cheap DMM that can't count above 500 kHz.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For ATMEL's take on this see this this application note:

Atmel AVR042: AVR Hardware Design Considerations
http://www.atmel.com/dyn/resourc...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ooooh, an excuse to give a long winded explanation.

Consider a quartz crystal as an electromechanical device. It is merely a slab of quite stiff piezoelectric matrial with a pair of electrodes on it. It has resonance at a specific frequency.

When you wish to design an oscillator, you create a positive feedback loop, and place a filter element in that loop. If you consider a simple transistor amplifier, the emitter resistor is a good place to affect the frequency response. If you substitute in your quartz crystal where the emitter resistor was, and somehow keep DC-biasing the transistor, at the resonant frequency of the slab it will act as a low-value resistor, and give you more amplification.
This is called series resonance. The oscillator is operating at the resonant frequency of the slab.

The amplifier in the AVR only shifts 180 degrees (it is an inverter), so we lack the additional 180 degrees of phase shift to get positive feedback. If we disregard crystals for a moment, there is a way to do this: construct a pi-stage from inductors and capacitors. So for a 16MHz filter with 180 degree phase, going from the output of the amplifier to the input, we pick a capacitance, say 16pF. We put 32pF on the input and the output, and put the inductor between the input and the output. The inductor sees the caps in series, 16pF. To get resonance at 16MHz we need an inductor of 6uH.
This would work (in reality the inductor becomes hard/impossible to manufacture). Only problem is, it is not all that stable, and it will be rather imprecise too.

Fortunately the quartz slab, when you apply a frequency that is slightly different from the resonant frequency, will have current that is no longer in phase with the applied voltage. It will be ahead or behind. When you have a component where the phase of the current lags the phase of the applied voltage, that is an inductor.
So, to get the 16MHz oscillator working, you call up your crystal supplier, and ask for "one that behaves as 6uH at 16MHz". What you usually say is "I want one that will have the inductance to match 16pF at 16MHz (which is 6uH if I bother to calculate it)".

The crystal supplier then cuts a crystal that is TOO THICK. The slab has resonance at a lower frequency than the one you asked for, and if you use it in a series resonant circuit, it will oscillate at that lower frequency. Let's say 15999800 Hz.

When you put it in the circuit, there is a point, 200Hz above the resonant frequency, where the crystal behaves as a 6uH inductor. At that frequency the pi-stage provides the additional 180 degrees shift, and low atenuation. Thus the circuit will oscillate at 16MHz, even though the crystal resonance is really at 15999800Hz.

This is called a 'parallel resonant crystal', even though really there is no such beast, and it is not operated at resonance. Close to, but not at resonance.

(Some details removed, as to not make this even longer. If you know what I left out, this was not meant for you:-)

/Kasper

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@kasper: I found your post very informative! Thanks for posting, I will save it as a reference. :-)

-Aashish.
If you don't see it coming, you'll never know what hit you...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
@kasper: I found your post very informative! Thanks for posting, I will save it as a reference.

I totally agree. Several people have given good input to this thread, but I've never seen the subject explained this thoroughly!

As for the wikipedia explanation, I don't give much for it. If it really was "just" a pi-type band-pass filter, changing the load capacitors should have an enormous impact on the frequency. Something like the square root of the relative capacitance change.

One other thing I hadn't thought about: If the oscillator input had a really high impedance (R = inf., C = 0 pF), one of two things may happen: Either the capacitors in the crystal will immediately be charged to the voltage difference between XOUT and XIN, and the Pierce oscillator will act as an inverter in a static state. Or the "resonant frequency" of the inverter itself will pass directly through the parallel capacitance in the crystal, making it oscillate at some incredible frequency. When oscillators won't run, I guess it is the first situation we have, so now I believe that I understand it! :D

Thanks a lot for clearing things up, reducing the mystical stuff. Even if I haven't experienced problems without the capacitors, I'll add them to my future PCBs.

Best regards,
ErikT

You're absolutely right. This member is stupid. Please help.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ErikT:
Yes, it is 'not only' a pi-filter. The magic part is the frequency dependant inductor you usually call a crystal. If you reduce the capacitors by half (to 16pF in my example), there is a point 400Hz above the quartz resonance where the crystal behaves as a 12uH inductor, and you get 16000200Hz out. The stability comes from the steepness of the reactance vs. frequency.

Yes, the crystal has shunt capacitance. There is capacitance in the construction and plating of the quartz slab, and capacitance to the case where the pins exit, usually glass sealed (one reason why I like grounding the case).
Together with the capacitor on the input of the amplifier, it forms a voltage divider. If this divider does not attenuate enough, there will be sufficient loop gain for the output to shoot through to the input, and yes you get an oscillator with the delay of the amplifier. I have seen this in production with a mis-designed oscillator. 135MHz.

What may make it work is that the pins are not capacitance-free. I think it is somewhere around 4pF. So without external capacitors, the crystal sees 2pF plus the shunt capacitance. But the shut capacitance is often 7pF, twice as large as the capacitance in the input, so it is a scary situation.

To make life more interesting, the crystal has resonance at odd integer harmonics (and will do something at even ones too). So it will just as happily behave as a couple hundred nH at 48MHz, and this is where your 'capacitor-deficient' oscillator may end up.
With appropriate capacitance, the losses in the pi-circuit (due to the crystal ESR) prevent overtones from having better loop gain than the fundamental.
And you also do not want to pick an amplifier with far higher roll-off frequency than you need.

/Kasper

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Let me just add my thoughts on this.

The crystal is manufactured with such motional parameters so that it will work at the environment it is specified to.

So for a parallel resonant crystal, the crystal works in parallel resonant circuit (like with the AVR) at the rated frequency when it has the rated load capacitance over it. It means that the crystal is usually not operated exactly at the parallel resonant point where impedance is minimum (ESR only), but on the area of usual parallel resonance, the area between parallel resonant and series resonant points, where the crystal impedance looks a bit inductive, so therefore the exact oscillation frequency is set by the capacitors. And in a way having a variable amount of load capacitance can be used to fine-tune the frequency anyway.

And for a series resonant crystal, it works at the rated frequency in a series resonant circuit. The crystal will actually operate at the series resonance point where impedance is almost infinity.

So if you use a wrong type of crystal in wrong kind of circuit, or use a wrong amount of load capacitance, it will still work, but since the resonance type or load capacitance requirements are not right, the crystal just does not work at the specified frequency printed on it.

However the actual frequency usually so close to the frequency printed on it, so nobody usually sees they have series resonant crystal connected to AVR, unless they make a wall clock so the time always lags more than usually it is expected from a crystal oscillator.

And it is a completely different thing with what value capacitors the oscillator (AVR) works best with.

In short: It is the crystal that specifies the exact capacitor values (of course approximated stray capacitance taken into account as well). You have to see what range of capacitors AVR datasheet suggests, and then select a crystal with such capacitance requirement that fits the AVR requirements too.

Also other parameters are important if a crystal is suitable for a given oscillator at all, but the AVR datasheets and application notes do not specify these in great detail, like many other microcontroller datasheets. Sometimes you just need to select a crystal with smaller ESR or smaller load capacitance rating before the oscillator in microcontroller works reliably, and these are somewhat easily calculated if the oscillator transconductance (gain) is known. The dissipated power in crystal is much harder to calculate so usually it is just measured, but requires a current probe or FET voltage probe so it is also difficult to measure.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Some crystal manufacturers are glad to test your actual circuit in their lab to see if their product is used/works according to specs. You get back a nice report with frequency, crystal load etc.

Probably a service only available to major clients though :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've only seen actual measurements of a batch of say 10 crystals they have sent as engineering samples. Still very impressive to actually see the plots, instead of just seeing the datasheet.