User Tools

Site Tools


From the crystal's point of view, C1 and C2 are in series, so the total that the crystal sees is 11 pF. Stray capacitance and input capacitance on the pins of the '328p may account for 8-10 pF. (Maybe a little more; possibly a little less.)

The '328P data sheet says The optimal value of the capacitors depends on the crystal or resonator in use, the amount of stray capacitance, and the electromagnetic noise of the environment. Some initial guidelines for choosing capacitors for use with crystals are given in Table 8-6 on page 31.

The table shows “Recommended Range for C1 and C2” is 12-22 pF.

As an example: If your crystal is cut for 16.0000 MHz +- 50 ppm for a load 20 pF, you may find that the actual frequency is a little high; maybe a little more than 50 ppm. If it's important, you can make adjustments by padding small values in parallel with C1 and C2 and can probably get the actual frequency (at a given temperature) to within 10 ppm of nominal.

Here's another thing: It's usually not practical to measure the frequency directly. You make a test program that uses one of the CPU counter/timers to toggle an output pin at some sub-multiple of the clock frequency and measure that with your high-precision frequency counter.

If the initial frequency is too low, then you might want to replace C1 and C2 by 15 pF caps (or 18 pF) and start again.

But first, you may want to ask yourself how important it is to be dead-nuts on.

Also note that crystals from different vendors may have slightly different characteristics even if they are rated for the same load capacitance, so if precision requirements are really, really important (for mass production), qualifying different vendors might have to be done by you in your lab (not just by reading a data sheet or taking some vendor's word about compatibility with whatever you have previously tested).

arduino_capacitor_for_crystal_circuit_choice.txt · Last modified: 2018/08/10 20:15 (external edit)