Go Down

Topic: Barebones ATmega328 - Why use caps on the crystal? (Read 2957 times) previous topic - next topic

davivid

Why do all minimal Atmega328 designs have caps on the the 16Mhz crystal? I haven't and it seems to run fine! just power to the pins 7&8 and Crystal between 9&10.

dc42

A minimal atmega328 design doesn't have the crystal either.

With a crystal and no capacitors, you are relying on the stray capacitance of the wiring and the capacitance of the mcu. This may not work reliably, and the frequency will be a little higher than the nominal frequency of the crystal.

I normally use a 3-terminal ceramic resonator, which has the capacitors built-in.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Bajdi

Hmm, I once tried to bootload an ATmega328 on a breadboard and had forgotten to connect both caps to ground. I tried several times to burn the bootloader to no avail. Until I realised my mistake, connected the caps to ground and then it worked. I have read a couple of crystal datasheets and they all required caps. I don't think a crystal will work reliably with no caps. Try to do some high speed serial communication and see if it still works...
www.bajdi.com

fungus


Why do all minimal Atmega328 designs have caps on the the 16Mhz crystal? I haven't and it seems to run fine! just power to the pins 7&8 and Crystal between 9&10.


The capacitors make it much more reliable. Without them you depend on random factors like the length of the connection wires, the electrical noise in the room, etc.

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

dhenry

It works without capacitors. The chip will run slightly faster, like 1Khz on a 4Mhz crystal, due to crystal's low pullability. Also 7pf crystals run much closer to spec than 15pf or 22pf crystals (rare today).

Capacitors become more important for 32Khz crystals.

davivid

Ultimately I plan to implement a high speed serial communications network once I have finished experimenting. Currently I'm just sending a few bytes every second or so.

My crystals have the following specs:
Frequency: 16MHz
Frequency Tolerance: ± 30ppm
Load Capacitance: 18pF
Frequency Stability: ± 30ppm

Should I therefore be using 18pF Caps? I also assume lower is better for Frequency Tolerance and Stability?

Quote
I normally use a 3-terminal ceramic resonator, which has the capacitors built-in.

What would specs should I look for in one of these?
Is this preferred because of the lower part count?

dc42


Ultimately I plan to implement a high speed serial communications network once I have finished experimenting. Currently I'm just sending a few bytes every second or so.

My crystals have the following specs:
Frequency: 16MHz
Frequency Tolerance: ± 30ppm
Load Capacitance: 18pF
Frequency Stability: ± 30ppm

Should I therefore be using 18pF Caps? I also assume lower is better for Frequency Tolerance and Stability?


To get as close to 16MHz as possible without using a variable capacitor, you should aim for 18pF loading. The 2 capacitors are in series as seen from the crystal, so two 22pF caps gives a loading of 11pF. Add the stray capacitance of the circuit and the capacitance of the IC, and you will be close to 18pF.


Quote
I normally use a 3-terminal ceramic resonator, which has the capacitors built-in.

What would specs should I look for in one of these?
Is this preferred because of the lower part count?


The main advantage is the lower part count. Ceramic resonators also cost slightly less than crystals. The disadvantage is that ceramic resonators have a lower frequency accuracy and stability than crystals - but still good enough for serial comms.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

MarkT

Without the right load caps the frequency won't be in-spec for that crystal (they are calibrated for a given load capacitance). 

Load caps make the oscillation frequency much less sensitive to stray circuit capacitances I believe - not necessarily important.

A particular oscillator design may assume a certain range of load capacitance too - without it there might be no guarantee of oscillator start-up?
[ I won't respond to messages, use the forum please ]

dhenry

Quote
Without the right load caps the frequency won't be in-spec for that crystal (they are calibrated for a given load capacitance).


Depends on what you meant by "in-spec".

Quote
Load caps make the oscillation frequency much less sensitive to stray circuit capacitances I believe - not necessarily important.


It doesn't make it less sensitive. It makes the frequency closer to spec.

Quote
A particular oscillator design may assume a certain range of load capacitance too - without it there might be no guarantee of oscillator start-up?


Yes, but generally only for low frequency oscillators.

simplex

A Crystal has an equivalent RLC model, see: http://www.eetkorea.com/ARTICLES/2001SEP/2001SEP06_AMD_AN.PDF

The Crystal together with its two capacitors and maybe other components make a filter. You just have cu calculate the resonant frequency of this filter and reach the conclusion that the two added capacitors help in obtaining a precise frequency for the oscillator (filter + inverter).

There is no other explanation.

dc42

The capacitors perform another important function. The combination of capacitors, crystal and the inverting amplifier make up a Colpitts oscillator. Without the capacitors (or sufficient stray and pin capacitance instead), the circuit would not oscillate.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

CrossRoads

Also helps to read this Atmel Application note, section 5, where it describes what the internals of the OSC1 & OSC2 pins are and how they are to be connected to external components such as crystals.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

MarkT


The capacitors perform another important function. The combination of capacitors, crystal and the inverting amplifier make up a Colpitts oscillator. Without the capacitors (or sufficient stray and pin capacitance instead), the circuit would not oscillate.


CMOS inverter is a phase-shift oscillator surely?
[ I won't respond to messages, use the forum please ]

dc42

I suppose you could view it as a phase shift oscilator, but it's more usually viewed as a Colpitts oscillator in which the inductor and most of the capacitance is replaced by a crystal. If you google "colpitts oscillator crystal" you will find lots of references to a Colpitts oscillator that uses a crystal. But when I googled "phase shift oscillator crystal", the hits were mostly describing two different oscillators, not a phase shift oscillator that used a crystal.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

mantoui

I've run various experiments to measure frequency offset on various MCU's and RTC's.  I connected 32Khz crystal to oscillator pins on 328p both with and without load capacitors.  Crystal worked in both configurations, though maybe a little more jitter with no capacitors. More than you wanted to know here
 
   https://github.com/manitou48/crystals

Go Up