Hello, Currently I try to calculate the necessary capacitors for a 7.3728 MHz crystal supposed to be external clock source on an ATMega328PB. The crystal (ECS-73-18-23B-JTN) according to its datasheet requires 18 pf load capacitance. The µC datasheet gives formulas to calculate the value of the external capacitors. In addition it gives the internal capacitance of the XTAL1 and XTAL2 pins. What puzzels me, different capacity are given for XTAL1 and XTAL2, 18 pF and 8 pF, respectively. Does this mean I don't need an external capacitor on XTAL1, whereas on XTAL2 I would need 10 pF? Assuming stray capacitance of 4 pF, the maximum capacitance of 22 pF is already reached at XTAL1? Many thanks for your help! Regards, Thomas
Hi, It is really not that critical. I usually look up the load capacitance in the crystal data sheet and allow a few pF for wiring capacitance. If the datasheet specifies 18pF, I would choose 15pF and it will work with compatible crystals. Generally it is a good idea to follow the recommendations in the device data sheet and app notes regarding uC crystal oscillator considerations, If you need really precise frequency, you'll need to consider calibrating the circuit with a trimmer capacitor. However, in normal uC applications it is not really required. BAUD rates are usually not exact due to divider frequency errors and it makes more sense to choose such crystal frequencies that allow exact divider ratios. Regards, Gerhard
Hi Gerhard, thanks for quick answer! I chose 7.3728 MHz indeed to match to BAUD rates for serial connection. The system is supposed to be supplied by 3 V, which allows freqency of the ATmega328PB up to 10 MHz. So I should not consider internal capacity of the pins at all? Formulas in the datasheet and in AN2519 request to do so... Regards, Thomas
Thomas, In my experience it is not worth the effort. Allowing 2-4pF for wiring and internal parasitic capacitance is usually adequate. As I mentioned before, I allow about 3pF for this and had never ever any issues. Unless you are required providing detailed design documentation, it is overkill. Besides, crystals have tolerances and unless you measure crystal operational parameters, you would be just spinning your wheels. If your crystal connections to the uC pins are as short and direct as practical, you are done. It is usually a good idea to put the load caps as close as practical to the oscillator pins using adequate trace width, as much of the oscillator operation RF current passes through them. The traces to the crystal can be as thin as convenient to minimize parasitic wiring capacitance. Also avoid groundplanes on the other side or internal (multilayer) between crystal pins and load caps. But the reality is not as critical. The AVRs are quite cooperative when it comes to implementation. Just pay attention, what the datasheet specifies and match a crystal to those requirements and allow for wiring parasitic capacitance. Regards, Gerhard
:
Edited by User
Hello Gerhard, once again many thanks for prompt and very valuable information! I will try 15 pF, as on other places on the PCB they are used anyhow. Best regards, Thomas
Hello Thomas, You are welcome. With 15pF you will be in the sweet spot. Keep also in mind, that the internal functioning of the oscillator depends on those capacitors more than the crystal. The crystal manufacturer uses the specified load capacitance to calibrate the crystal parameters. Depending on the gain of the oscillator stage and the equivalent crystal series resistance you will find, actually, that the circuit will operate over a wide range of C values (10-50pF). But the crystal accuracy and adherence to the stated crystal parameters will only apply at an actual nominal load capacitance. This is normally hard to achieve in the reality. Keep also in mind, that typical computer crystals have a manufacturing tolerance of 20 to 50ppm. With a series or variable trim capacitor on the oscillator input side, one can exactly calibrate the frequency within the possible range. Be also aware, that crystals are made and calibrated to either oscillate in the so called "fundamental mode" or "third" or "fifth" order overtone mode. At frequencies under 25MHz most crystals are intended to oscillate in fundamental mode, although most crystals will oscillate in a suitable circuit also at least in third overtone at approximately three times the fundamental frequency. Overtone crystal oscillator circuits can be more critical and difficult to "tame" and require careful adherence to proper design practice and construction and careful testing. (You may want to look for further information on the Internet. There is tons of information). Regards, Gerhard
Hi Gerhard, The application is in my opinion not particularily critical regarding frequency. It is supposed to communicate to another device (home ventilation) over RS-232 serial connection at 9600 BAUD. At first I considered using the internal oszillator with calibration or a ceramic resonator, but chose the quartz crystal to be able to absorb as much as possible timing error on the other side by providing a reasonably accurate frequency on my side. With the crystal and the 15 pF load capacitors I hope to achieve this goal with plenty of margin. Best regards, Thomas
:
Edited by User
Thomas wrote: > What puzzels me, different capacity are given for XTAL1 and XTAL2, 18 pF > and 8 pF, respectively. You're looking at the specification of the 32 kHz crystal oscillator. Look a couple of chapters before, for the "low power crystal oscillator", they specify 6 pF for both pins there. So with an assumed additional 4 pF on both pins, you end up with 10 pF per pin plus your intended 15 pF capacitors, total of 25 pF per pin. As these 2 x 25 pF are in series, that results in 12.5 pF overall load. You'd like to have 18 pF … I'd rather pick 22 pF. Overall clock accuracy is usually not such a big issue (unless you want to run a watch), but with the load capacitance too much off, you risk the oscillator not starting reliably.
Hi Jörg, thanks for this remark. I checked again in ATMega328PB complete data sheet and downloaded also most recent issue from Microchip website. In chapter 11.3, Low-Power Crystal Oscillator, there is Table 11-3, providing those different 18 pF and 8 pF values for the XTAL pin capacity. What is strange, the top left cell of this table says "32 kHz Osc. Type", so indeed it seems this is valid for the low-frequency oscillator. So I assume meanwhile it is a typo in the document. In which document / issue did you find the 6 pF? Regards, Thomas
OK, Microchip first returned me the "A" revision of the datasheet. Indeed, revision "C" has 18 / 8 pF (and still the typo with the "32 kHz" in the top left corner of the table). So with 15 pF + 4 pF stray capacitance, you end up with 37 pF in series with 27 pF, resulting in a total of 15 pF load for the crystal. I guess that's good enough given the remaining uncertainties.
So it seems everybody agrees on 15 pF for both external load capacitors, I will give them a try! In case it doesn't work I will come back with more questions...;-) Many thanks and best regards, Thomas
You could of course also make them asymmetric: 22 pF at XTAL2, and 12 pF at XTAL1. I guess both will work.
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.