> I've always used 15pF without problems on all boards. Sigh.. Where do you get these crystals with the appx 6pF loading spec? Normally such crystals are rather expensive and hard to find. Have you checked your oscillator margin? Do you <KNOW> that you don't have problems, or things just sort of seem to be working ok, more or less? Unfortunately, there is a bit of design work required to get it right. First, the crystal determines the cap values, in it's loading cap spec. If your crystal dosen't have a loading cap spec, then it's a series mode rock, and you shouldn't use it in a parallel mode circuit like this. It won't operate at the nameplate frequency since the parallel and series resonant points cannot be at the same frequency, and it may not even start up reliably in this mode. Second, from the crystal's point of view, the caps are in series, so they need to be almost twice the value specified by the crystal. Almost, because there is always some amount of stray capacitance on the board. You can guess at 5pF and start there. CL = (2*Cs)-5 Third, you need to check drive power, it is possible to damage or even shatter a crystal with too much drive. This involves a measurement of drive current and crystal impedance, see data sheet. Power is of course I^2 * R where R is the crystal impedance at resonance. You can add a small value resistor in series with the drive pin, and measure voltage across it. Fourth, it's always a good idea to do a margin check, which involves adding series resistance between the micro's output pin and the crystal. You adjust this value upward till the oscillator just starts. This value should be at least three times the crystal's ESR value, and higher ratios are better. With the AVR in particular, there is one more consideration, the CKOPT fuse should be programmed. The default (unprogrammed) state enables a low power "vittoz" mode oscillator that typically operates at about 1/2VCC amplitude, and will cause significant problems unless the crystal is specifically designed for this mode.
Message
Re: Problem reading PIND.0 on Mega16 with 16MHz Crystal
2006-02-06 by Dave VanHorn
Attachments
- No local attachments were found for this message.