## Questions about using an external oscillator

9 posts / 0 new
Author
Message

I'm going to play around with USB with my 2313. I'm looking at this circuit, and it needs a 12MHz crystal, but I have never worked with crystals before, and I need help finding the value of the load capacitors. I have looked around the internet but have not found a good tutorial that explains this thoroughly and I have a few questions:

The schematic from the website states that the load capacitors are 27pF, but I heard that all crystals are different and may even need adjusting. I am planning on buying this crystal, and it says that the impedance is 32pF and the shunt capacitance is 7pF. What do these values mean, and how do I find the value of the capacitors I should be using?

-Cory Walker

The value of the capacitors is not that critical. As long as they are in a certain range, it should be all right. I have the same crystal with 15 pF capacitors (in the same circuit), and I haven't had any problems.
I hope, this helps,
Zoltan

Atmel says

CL1 = CL2 = 2 * (CL - Cs)

CL: Load capacitance from the crystal datasheet (what you calls load impedance)
Cs: Stray capacity 5 ... 10pF

So you get something between 44pF ... 54pF. This is beyond Atmel's recommended range of 22 ... 33pF. If this is for something really important, then consider getting another crystal with a CL in the 20pF range. If this is really just for play, try two 33pF capacitors, or maybe even two 47pF capacitors.

Stealing Proteus doesn't make you an engineer.

Thanks for the info Arnold. I found a new crystal (20pF) and calculated the capacitors to be 26pF. I can't find any 26pF capacitors, so I settled with 22pF. A 4pF difference shouldn't matter that much should it? This is just a basic USB circuit.

It should not matter. You just need to be in the right range. 22pF is within Atmel's recommendation for the AVR's build in oscillator. And it is within the range of what should bring you near the crystal's nominal frequency.

The right load should ensure that the crystal oscillates, which is a good idea :-) and that it oscillates near its nominal frequency. By varying the load you can pull a crystal's frequency slightly.

The given stray capacitance of 5pF ... 10pF as used in the equation is already an estimation, and depends on e.g. your PCB layout. Then you have manufacturing tolerances of the crystal, the capacitors, and of course the AVR. Oh, and the crystal is temperature dependent.

So even if you would use the exact calculate capacitance values it would be extremely unlikely that you hit the nominal crystal frequency. A few ppm frequency offset are normal and ok for most application.

Stealing Proteus doesn't make you an engineer.

Ok, thanks. I didn't know how much the capacitors really affected the frequency.

Have you read Colin O'Flynn's article Why you need a Clock Source?
I think it's very valuable.

Regards
Sebastian