When trying to get a 37Khz crystal to start oscillating, it finally turned out that the boards were too clean electronically, and there was not enough noise in the system to kick them off. Adding a 100K series resistor solved the problem--provided the resistor was a NOISY carbon Composition type.
RealTime@ Time@, Oscillators
David VanHorn says:
Microcontroller Crystals Basic
One of the most frequently asked questions about microcontrollers has to be
"What kind of crystal capacitors do I use on this chip."
Unfortunately, that's even the wrong question!
This also applies to any other common chip that uses an external crystal timebase.
- First, the crystal determines the capacitor values, not the chip.
Atmel's application notes correctly leave off the cap values, since they can't tell you what values to use!
- There are two types of crystals. Series resonant, and Parallel resonant.
Most microcontrollers use parallel resonant crystals.
- If you use series resonant crystals in a circuit designed for parallel resonant crystals, you will never get the crystal to the right frequency.
Because every crystal has two resonant points, the parallel point, and the series point.
They are very close together, but they cannot ever be on the same frequency.
Which one you use, depends on the circuit the crystal is used in.
Crystals are sold as parallel or series resonant, depending on which of these two points is intended to be used.
The other point is still there, but it may not perform well.
- All parallel resonant crystals have a specification that tells you how much loading capacitance is expected to be in the final circuit. However, you can't use that value directly.
First, there will be some amount of parasitic capacitance in the circuit, which we'll call "CP"
This happens in the traces, wires, and sockets.
Second, the chip itself will have some amount of input capacitance, which we'll call "CI"
Finally, the specified load capacitance, which we'll call "CL"
- A key point, is that from the crystal's point of view, the capacitors are in series.
This means that the values you need would be twice the value specified for CL.
If your crystal wants 22pF, then you would start out with an estimated value of 44pF for each cap.
However, you must subtract a bit for the parasitic capacitance, and the chip's input capacitance.
The final formula comes out as C=2(CL)-(CP+CI)
- You can estimate (CP+CI) to be about 5pF as a starting point, so our C value becomes:
C=(44)-(5) or 39pF.
If all you wanted is to get your project going, then this is what you needed.
However, if you'd also like to minimize your EMI output, then carry on to the next section.
Microcontroller Crystals, Advanced.
So we've got the right cap values, what more could there be?
- As it turns out, it's not quite so simple, if you care about minimising your EMI output.
The normal sort of crystal oscillator circuit has an input pin, and an output pin. The input pin is pretty simple-minded, it basically looks like a capacitor. But what's on the other side of that capacitor?
- Answer: Ground, and VCC. So current into or out of this pin, ends up on Ground or VCC.
When you think about it, it makes sense. That current has got to flow, and it has got to return to the source.
This is a key point that's often missed, or not fully understood.
- Also, the output pin is a pair of FETs that source current alternately, from VCC, and to Ground.
Is this taking shape yet?
- If you really want to get it as quiet as possible, you now split your caps (39pF from the previous example) into a pair of 19pF caps on each side, one to VCC, and one to ground!
- It is critical that these caps connect directly, and only to the processor power pins, by a separate track.
Don't dump the ground side caps into a plane, and don't connect the VCC side caps to any other point on the VCC tracks.
If you do, you have just created a shunt-fed antenna, driven by the microcontroller, passing the higher order odd harmonics of the crystal frequency through the caps!
If anything else is connected to these tracks, then it's an antenna!
- So why don't you see this technique used more frequently?
Probably because of the extra expense of two more capacitors.
Also, because "The other guys don't do it that way."
Remember, when you copy the other guy's answers, you also copy his mistakes.
Sean Breheny says:
The purpose in using capacitors with a crystal is two fold:
#1) The oscillator consists of the inverter inside the PIC, the crystal, and external capacitance (both parasitic and actual capacitors). The total phase shift around the loop (from one inverter terminal, through the inverter, across the crystal/capacitor network, back into the inverter) has to be either 0 or 360 (the same thing) degrees for oscillation. The capacitance adjusts the phase shift of the network to allow oscillation.
#2) Crystals are designed to "see" a certain type of load. Most are designed to see a certain, specified capacitance, referred to as the Load Capacitance. In order for your crystal to operate at the correct frequency, it must see this value of capacitance at its terminals.
The total value of capacitance at the crystal's terminals is (Ca+Cp)/2, where Ca is the actual value of capacitor, per pin, that you place at the OSC1 and OSC2 pins, and Cp is the per pin parasitic capacitance. Cp is usually about 8pF or so. So, if your crystal wants to see a 20pF load, you will need to put 32pF capacitors at both OSC1 and OSC2: (32+8)/2 = 20pF This is one of the very useful and neat things that I learned from the PICLIST :-)
In [many cases], it probably "just works" because the parasitic capacitance is enough to satisfy #1 and [the] oscillator is probably running with perhaps 0.1% frequency error, a few kHz with an xtal in the several MHz range.
[This] question is almost a FAQ, and every time it comes up, there is always a debate about the last point that you make: what is the difference between "series" and "parallel" crystals. Here is the usual consensus: there is no difference. Every crystal has a parallel resonant frequency and a series resonant frequency. They are separated by a few kHz and which one you get depends on what value of external capacitance you place on the crystal (I think it ultimately has to do with #2 and exactly what frequency gives the 0 deg phase shift through the whole network). Crystals sold as "parallel" crystals achieve their rated frequency when loaded with the recommended load capacitance. Those sold as "series" crystals achieve their rated frequency when operated in series resonant mode (determined by the external capacitance, but I'm not sure how to figure this one out numerically,since it isn't specified for xtals sold as "series").
If you need a rough frequency standard, just use the (Ca+Cp)/2 formula. If you need strict accuracy, you will have to use a trimmer cap for one of the caps and use it to adjust the frequency.
|file: /Techref/clocks.htm, 10KB, , updated: 2010/5/10 06:09, local time: 2020/8/7 23:11,
|©2020 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?|
<A HREF="http://www.massmind.org/techref/clocks.htm"> Processor Clock Crystals</A>
|Did you find what you needed?|
Welcome to massmind.org!
Welcome to www.massmind.org!