Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Choicing crystal or external oscillator for time critical project on PIC18F

Status
Not open for further replies.

sghosh

New Member
Need to learn how making frequency counter (or any time critical project) using PIC18F that display output over USB.

Having choice of 3 clock sources:

1. ±50ppm 4.0000 MHZ crystal ATP040SM
4.0000 MHZ 20PF SMD ±50ppm
https://www.electro-tech-online.com/custompdfs/2011/08/008-0325-0_A.pdf

2. ±50 ppm 24.0MHZ external oscillator
XO-54D-24.0MHZ
±50 ppm
**broken link removed**

3. ±100 ppm 40.0MHZ external oscillator
MXO45-40M000 Manufacturer: CTS CORP
40 Mhz
±100 ppm
https://engineering.dartmouth.edu/courses/engs031/databook/oscillator.pdf

To run internal PLL PIC18F will divide clock input by PLLDIV that can be setting to either 1, 6 or 10 for above options respectively.

I thinking which option providing best stability?

When thinking myself, I feel 3rd option will be best as I reasoning that ±100 ppm 40Mhz clock will be divide by 10 and hence effectively behaving like ±10 ppm 4Mhz clock?

Or is reasoning wrong and ±100 ppm 40Mhz clock after divide by 10 is effectively still ±100 ppm 4Mhz clock?

If you, experienced designing having choice of above 3 - which one you choose and why (no consider PCB space or 5V voltage issue in 3.3v world, but might consider cost only between more expensive ±50 ppm vs less expensive ±100 ppm)
 
Last edited:
Yes the ppm stability is the same no matter how you divide the clock. So the ±50 ppm crystal and oscillator will be more accurate then the ±100 ppm oscillator.

I would think the crystal would be less expensive then the external oscillators.
 
Yes the ppm stability is the same no matter how you divide the clock. So the ±50 ppm crystal and oscillator will be more accurate then the ±100 ppm oscillator.

I would think the crystal would be less expensive then the external oscillators.

Thanking crutschow.

One question - why there are external oscillators if they are more expensive and less precise than crystal?
 
The first link you listed was a crystal and only a crystal which is part of what comprises a complete oscillator. The latter two links were complete oscillator assemblies. Thus a crystal and crystal oscillator are not the same thing. The crystal oscillators can be used as clock sources plug and play for many applications.

Ron
 
Crystal oscillators are used because the stability quoted is the overall stability that you get. You don't have to worry about what load capacitors to add or the tolerance or those. You only need one pin on the PIC for the clock and layout is not important.

With a crystal, the exact value of the capacitors is very difficult to predict, because the time delay though the oscillator inverter will alter the frequency, so you need to adjust the capacitors to take account of that. It is almost always done with some trial and error on the first production boards. The oscillator inverter on an IC can often have too much gain, and some crystals will oscillate at overtone when they are not supposed to. That can be a real problem with low frequency crystals, such as 4 MHz ones. The crystal inside will be quite thick compared to its length, and it has to be cut down to a thin strip to get in the case. Both of those cause problems such as difficulty in getting the oscillators to start, or running at spurious or overtone frequencies. Also those crystals are adjusted to +/- 50 ppm, and they have a +/- 50 ppm stability. You will only get +/- 50 ppm over the temperature range if you have some way of adjusting each one to the right frequency at room temperature.

Where I used to work, we made oscillators and crystals. A lot of customers had a lot of trouble getting crystals to run at the right frequency, and it is simply not worth the effort unless production runs are large, or there is some odd requirement.

On one application at 4 MHz, I used a crystal in an HC33 package, which is 19 x 19 x 8 mm, so that I could get one with a lower equivalent series resistance, and more predicable temperature characteristics. 4 MHz in the surface package will be a far more difficult crystal to work with.
 
One of the most common mistakes is not taking PCB capacitance into account for setting up capacitor load for crystal. If a crystal is cut for a 10 pF load and circuit has two 20 pF discrete caps hung on either side of crystal (two 20 pf series = 10 pF) then the circuit has no allowance for PCB strays or capacitance loading for the I.C. oscillator active device. PCB stray depends on layout but can easily be 2 to 5 pF on each terminal and I.C. has 1 to 4 pF of load on each terminal. Not taking into account these stray capacitance effects means the oscillator usually ends up running low in frequency (too much capacitance loading).

You can put a trimmer cap on one side to zero in the center frequency. Do not load either side of crystal making measurement. Try to use a buffered output from processor to make measurements so not to load crystal with test probe.

Parallel resonant mode crystals are cut to a manufacturing freq accuracy that varies but usually put in perspective of what the temp drift range of the crystal cut tolerance. 1 to 5 ppm is common cut accuracy at 25 deg C (it can be trimmed out). TC of AT cut crystal depends on accuracy of cut angle of quartz. Best you can get is about 10 ppm from -10C to +50 deg C.

You can buy TCXO module that track out temperature drift. The lowest cost, best ones are TCXO's used for GPS receivers. They are spec'd at 0.5 ppm.
Cellular phone TCXO's for CDMA are about 1 ppm. For GSM phones they are about 10 ppm.
 
Crystal oscillators are used because the stability quoted is the overall stability that you get. You don't have to worry about what load capacitors to add or the tolerance or those. You only need one pin on the PIC for the clock and layout is not important.
Where I used to work, we made oscillators and crystals. A lot of customers had a lot of trouble getting crystals to run at the right frequency, and it is simply not worth the effort unless production runs are large, or there is some odd requirement.

One of the most common mistakes is not taking PCB capacitance into account for setting up capacitor load for crystal.

You can buy TCXO module that track out temperature drift. The lowest cost, best ones are TCXO's used for GPS receivers. They are spec'd at 0.5 ppm.
Cellular phone TCXO's for CDMA are about 1 ppm. For GSM phones they are about 10 ppm.

Thanking you both very much!

Now, it look to me that for DIY, better use external oscillator, because stability is guaranteed but even if crystal cheap and "looks" more stable from datasheet, PCB layout and load capacitance very important factor and hard to perhaps getting right for DIY person?

Helpful person guiding me to use http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=631-1067-1-ND that having ±2.5ppm!
 
Last edited:
You should keep the frequency counting process under hardware control. A PIC or any processor generally will slip cycles even on a hardware interrupt service.

The hardware assist circuit will capture the actual frequency count and processor can read it from buffer output from hardware assist circuit.

A relatively inexpensive high accuracy frequency reference is the one pulse per second output from a GPS receiver. You can divide down the 10 MHz TCXO to 1 pps and compare the counts over period of 15 minutes to 30 minutes. You can make a very low loop bandwidth TCXO correction using Vc control on TCXO. This is called a dissiplined reference. You should insulate the TCXO to prevent short term drift due to air circulation causing slight temp changes.
 
You should keep the frequency counting process under hardware control. A PIC or any processor generally will slip cycles even on a hardware interrupt service.

Frequency counting was just example :)

That is start project to learning, but after we also do NCO.

Does that link have links to 48 and 75Mhz TCXO?

I am having difficult time trying locate same specification 48 and 75Mhz TCXO on that site, can you share some links?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top