# Choosing capacitators for crystal on AVR uC

Discussion in 'Electronic Basics' started by Willem, Feb 14, 2004.

1. ### WillemGuest

Hi all,

I've made a little hello world at90s8515 uC board with only a couple of
leds. The crystal specified a capacitance of 32pF so that's what I used but
the crystal is not oscillating. When I desolder the crystal and put an
external clock from the STK500 development board it's running fine. I found
this basic rule about the capacitance you need:

capacitance = 2 * (LC - trace_capacitance)

Where:
LC = capacitance specified by crystal manufacturer
trace_capacitance = capacitance from traces and wires etc which is typical
7-10pF

Is this a good basic rule of thumb? And how much can it be of this
capacitance? I read it influences the frequency of the crystal a bit but you
can't push it too much. But I couldn't find how much you can push it and
if/how this depends on the crystal used.

Any information is appreciated.

Regards,
Willem

2. ### Costas VlachosGuest

This is what I found on the net a while ago, which is pretty much the same
as your formula above.

Crystal Capacitor Formula (Parallel Mode)
-----------------------------------------
Let: CL = Crystal's load capacitance
CP = Circuit's parasitic capacitance
CI = Chip's input capacitance
C1 = Crystal oscillator capacitor 1
C2 = Crystal oscillator capacitor 2

Then: C1 = C2 = 2 * CL - (CP + CI)

Example: For a crystal with 12pF load capacitance (CL)
and assuming CP + CI = 5pF (typical), we have
C1 = C2 = 2 * 12pF - 5pF = 19pF. We can then
use two 18pF capacitors (closest standard
value).
---

Note that you need a parallel mode crystal and *two* capacitors, which you
put between the crystal terminals and GND, like this:

.. C1 ||
.. .-----||-------+--------
.. | || |
.. | _-_ TO
.. | XTAL |___| MCU
.. | -
.. | C2 || |
.. +-----||-------+--------
.. | ||
.. |
.. ===
.. GND

cheers,
Costas

3. ### CBarn24050Guest

Hi, ive allways used 20p and never had a problem on any micro or any crystal.