Choosing Capacitors for a Crystal; Do I Have It Right? - Page 1
Forum section: electronics / beginners

author: RJDog
author_rank: Contributor
timestamp: February 19, 2017, 01:50:16 pm
content: So under the assumption that just choosing a 22pF capacitor to go along with a 12MHz crystal as shown in so many Arduino examples might not be the most ideal choice, I started looking into what the right value might be. What tipped me off was the fact that there seemed to be quite a number of variances in "Load Capacitance" for the same frequency.The best information I have found seems to be C = 2*CL - 2*Cstray. So for this crystalhttp://www.digikey.ca/product-detail/en/ecs-inc/ECS-120-20-46X/XC1753-ND/2676583the Load Capacitance is listed at 20pF... this seems to be a pretty common value. But my question pertains really to Cstray... all of the examples use 5pF for that value but other resources say it could be anywhere from 3 to 5pF. How do I know, calculate or even guess what Cstray should be? Is the higher value of 5pF the "safe" choice?Using what appears to be the "standard" value of 5pF, this gives C = 2*20 - 2*5 = 30pF, which is quite a bit higher than 22pF so I can only assume that if I were to have used a pair of 22pF caps that the accuracy of the 12Mhz crystal would have been off a bit.

author: Ian.M
author_rank: Super Contributor
timestamp: February 19, 2017, 03:03:16 pm
content: Cstray is highly dependent on the physical circuit layout and the active device used. 5pF is at best a guesstimate. Its quite difficult to measure as one has to remove the crystal, disable the active device that's providing the gain so it tristates its output, and keep its terminals biassed at 1/2 Vcc so that any internal protection diodes don't interfere with the reading.The two capacitors in a Pierce oscillator circuit don't have to be equal, but a gross imbalance causes problems. The formula is Cload=C1*C2/(C1+C2), but Cstray must be treated as part of C1 and C2 (hopefully its similar for both, unless you have a pathologically bad board layout). Use the simpler formula to get the desired C for two identical caps, then see what comes closest to the correct Cload, next preferred value (alowing for Cstray) up or down or one of each.Its possible to use a trimmer either to replace or in series with one of the caps, but that may not be good for long-term stability. Another factor to consider is the temperature coefficient of the caps, and also of the crystal.Nowadays, for digital applications, its always worth investigating if its possible to compensate for frequency errors in the software rather than trying to trim it spot-on.

author: RJDog
author_rank: Contributor
timestamp: February 19, 2017, 05:51:10 pm
content: So, I should have asked this in my original post, but when we're talking about Cstray, we're talking about the miniscule amount of capacitance that is present just between the traces and nearby ground traces and planes? Also known as parasitic capacitance?The traces on my board for the crystal and capacitors are mirrored exactly, so I'm quite confident that choosing the same capacitor value is the correct choice. Is there a way to estimate the stray capacitance?I suppose a better question is, what is the consequence of selecting not the exactly right capacitor value?

author: MagicSmoker
author_rank: Super Contributor
timestamp: February 19, 2017, 10:51:34 pm
content: Quote from: RJDog on February 19, 2017, 05:51:10 pmMore or less. Also the pads and crystal package itself.Quote from: RJDog on February 19, 2017, 05:51:10 pmI suspect no one bothers trying to estimate Cstray for a crystal oscillator; if frequency is really that critical then use an OCXO (Oven Controlled Xtal Oscillator). Cstray is usually low enough that you can just use the recommended load capacitance* for the crystal, or the next closest standard value down. If the crystal doesn't oscillate when the first board is built then you can tweak the load capacitor values, but that is rarely a problem.Quote from: RJDog on February 19, 2017, 05:51:10 pmGenerally speaking, increasing the loading capacitance pulls the frequency down (NB - "pulling" is commonly used jargon for adjusting a crystal's frequency, usually by varying the load capacitance), until a point is reached which causes the crystal to either stop oscillating, or results in damage (fracture of the crystal). Decreasing the load capacitance pulls the frequency up, until a point is reached where the crystal stops oscillating. So clearly the consequences of too much loading capacitance are more severe than too little, but the range of "acceptable" capacitance can be surprisingly wide, particularly for crystals below, oh, 25MHz or so.Which reminds me, crystals above 25MHz might use an overtone, rather than the fundamental, and these can be much more picky about the load capacitance. They also tend to be much less "pullable" as a result.* - or twice the load capacitance for each capacitor, if there are capacitors to ground on either side of the crystal.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: February 20, 2017, 07:03:45 am
content: Found this reference discussing it:https://www.seventransistorlabs.com/Articles/Crystals.htmlTim

author: shteii01
author_rank: Frequent Contributor
timestamp: February 20, 2017, 09:36:26 am
content: https://blog.adafruit.com/2012/01/24/choosing-the-right-crystal-and-caps-for-your-design/

author: RJDog
author_rank: Contributor
timestamp: February 20, 2017, 01:56:56 pm
content: Quote from: MagicSmoker on February 19, 2017, 10:51:34 pmSo, if I iterperet correctly, estimating a "higher" value for Cstray (e.g. 5pF) is safer than a low or 0 value for Cstray, as that would cause one to come up with a lower value for the accompanying caps?E.g. for the crystal I linked with 20pF CL, 2 * CL = 40pF for the caps, but estimating Cstray at 5pF leads to cap value of 30pF, which should be a "safe" choice being below the default value of 40pF?

author: MagicSmoker
author_rank: Super Contributor
timestamp: February 20, 2017, 02:12:21 pm
content: Quote from: RJDog on February 20, 2017, 01:56:56 pmYes, if you want to be really precise about something that cannot be estimated precisely... Personally, I'd use 33pF for each load capacitor because it is a more common value, but you will likely find that anything from 22pF to 47pF will work as well, with just a few tenths of a percent change in frequency. But don't take my word for it; try a few different capacitor values yourself, and for each value hit the crystal with freeze spray, as a marginal oscillator will often stop when cooled down below 0C.

author: TimFox
author_rank: Super Contributor
timestamp: February 20, 2017, 02:14:14 pm
content: You can always use a screwdriver-adjust trimmer capacitor as part of the total load capacitance and adjust it to get the correct frequency with a counter.

author: CJay
author_rank: Super Contributor
timestamp: February 20, 2017, 07:57:39 pm
content: Isn't the biggest problem, after accuracy (which isn't likely to be great on a cheap microprocessor crystal anyway) reliability of starting?Better to choose a lower value by calculating for max and min then picking mid range perhaps