Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIC18F quartz frequency tuning

Status
Not open for further replies.

bjuric

Advanced Member level 4
Joined
May 4, 2011
Messages
115
Helped
32
Reputation
64
Reaction score
30
Trophy points
1,308
Location
Serbia
Activity points
1,980
Hi guys,

I need to do some precise timing in 10us to 10ms range. And for this, I'm trying to achieve as precise crystal frequency as possible. The oscillator also needs to be tunable for periodic calibration.

This is the setup. The oscilloscope is showing nice waveform, but I'm unable to measure the fine frequency changes for now (my frequency meter is acting weird).
tune.PNG

I'm using PIC18F2420 and it's internal oscillator circuitry as a tunable pierce oscillator (hopefully).
osc.png


Has anyone tried using this setup?

Thanks.
 

wp100

Advanced Member level 5
Joined
May 15, 2009
Messages
3,056
Helped
883
Reputation
1,781
Reaction score
736
Trophy points
113
Location
Prime Meridian
Activity points
0
Hi,

OscTune is only available when using the Internal Osc.
The accuracy of the Int Osc is detailed in the Electrical Specifications of the datasheet +-2% at 25c .

An external crystal would seem the more obvious choice for the accuarcy you need.

However if the crystals timing at 10us was out by a few ns , how could you realistically calibrate it ?
Perhaps using a 20meg crystal and / or PLL would give more lattitude to software adjustments

Assume your scope has been checked and calibrated for those levels of accuaracy ?
 

bjuric

Advanced Member level 4
Joined
May 4, 2011
Messages
115
Helped
32
Reputation
64
Reaction score
30
Trophy points
1,308
Location
Serbia
Activity points
1,980
ZASto said:
Take a look: High accuracy PIC timing systems

Some very nice ideas.
Thank you, this is very nice reed.

wp100 said:
OscTune is only available when using the Internal Osc.
The accuracy of the Int Osc is detailed in the Electrical Specifications of the datasheet +-2% at 25c.

An external crystal would seem the more obvious choice for the accuarcy you need.

I do intend to use the external crystal. I know osctune is for internal oscillator, what I meant by tunable is that I must have a means to calibrate the quartz frequency from time to time, with a variable capacitor.

wp100 said:
However if the crystals timing at 10us was out by a few ns , how could you realistically calibrate it ?
Perhaps using a 20meg crystal and / or PLL would give more lattitude to software adjustments

Assume your scope has been checked and calibrated for those levels of accuaracy ?

My work demands that all the equipment is attested yearly by an official laboratory, so that won't be a problem
It's just that frequency meter is gone wild, and I'd like to mark this part as done and not wait for the new one.


What I was trying to say is that PIC has a fast internal inverter on OSC1/OSC2, and instead of making external tunable Pierce oscillator with an inverter IC, I intend to use PICs internal circuitry.
I just never tried it, and don't know if the calibration is gonna work nicely with PICs internal circuitry (it should, but one can never be sure before testing it).

Thanks.
 

wp100

Advanced Member level 5
Joined
May 15, 2009
Messages
3,056
Helped
883
Reputation
1,781
Reaction score
736
Trophy points
113
Location
Prime Meridian
Activity points
0
Hi,

Altering the capacitors will alter the timing slightly, as to if it will be a stable and accurate enough method for your use its hard to say.

Would have thought if you are designing for such accuracy then you need to move to a higher level of circiut design to reliably achieve that.

I'm only a diy-er, perhaps some of the Pro members can give you better guidance.
 

bjuric

Advanced Member level 4
Joined
May 4, 2011
Messages
115
Helped
32
Reputation
64
Reaction score
30
Trophy points
1,308
Location
Serbia
Activity points
1,980
wp100 said:
Would have thought if you are designing for such accuracy then you need to move to a higher level of circiut design to reliably achieve that.
Yeah, that's my primary concern about this setup...
I'm thinking since it will not be continuous timing, but rather start-stop in that small time range, the error should not accumulate enough to cause concern. But tests will show how that works out.
The jitter will be the bigger issue than the overall accuracy drift itself.
 

ZASto

Advanced Member level 3
Joined
Jan 9, 2008
Messages
820
Helped
158
Reputation
321
Reaction score
150
Trophy points
1,323
Location
Messy Corner, 44°47'31.56"N, 20°28'9.16"E
Activity points
5,717
Not only jitter, but also the crystal's temperature coefficient. Every crystal has the variation of it's resonant frequency caused by temperature (you know, matter tends to expand/shrink with temperature) :wink:
 

bjuric

Advanced Member level 4
Joined
May 4, 2011
Messages
115
Helped
32
Reputation
64
Reaction score
30
Trophy points
1,308
Location
Serbia
Activity points
1,980
Thanks for the input.
That also did cross my mind. I'll see how it goes in testing.

I've done some tests with that plastic orange resonator to see if the principle itself would work and was surprised to get some nice results. But the resonator itself has high jitter (can't remember the figures now).
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
49,914
Helped
14,484
Reputation
29,238
Reaction score
13,396
Trophy points
1,393
Location
Bochum, Germany
Activity points
286,608
You didn't tell about your actual accuracy requirements, so it's hard to decide if a PIC on-chip crystal oscillator is good for the project. i assume, that ready made crystal oscillators have better parameters.

I agree, that crystal t.c. will be the most serious problem. Usually, high precission instruments (e.g. generators, spectrum analyzers) are using temperature compensated (TCXO) or temperature controlled (OCXO) crystal oscillators. Some have an additional frequency adjustment option. With OCXOs, long term frequency deviations below 1 ppm can be achieved.
 

bjuric

Advanced Member level 4
Joined
May 4, 2011
Messages
115
Helped
32
Reputation
64
Reaction score
30
Trophy points
1,308
Location
Serbia
Activity points
1,980
You didn't tell about your actual accuracy requirements, so it's hard to decide if a PIC on-chip crystal oscillator is good for the project. i assume, that ready made crystal oscillators have better parameters.
Yes I know. That's because I don't have any specific requirements. This is still a developing idea for a new product. In the end I can just put +/-
accuracy, but I'm going for the best I can get.

It will not see large temperature oscillations and I was looking at AT-cut characteristics and it seems it should work.
I can get those more easily, so I will test with it, but I will leave a place for TCXO.

Thanks guys...
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
49,914
Helped
14,484
Reputation
29,238
Reaction score
13,396
Trophy points
1,393
Location
Bochum, Germany
Activity points
286,608
Seriously speaking, I don't know exactly, how the PIC18F oscillator block would perform in a high accuracy oscillator. It's simply not specified for this purpose. In the usual enviroment, you can expect additional jitter caused by other digital chip activities that aren't present with a dedicated oscillator component. But jitter doesn't necessarily involve drift of the average frequency.

You should also asume, that Microchip is satisfied with basic crystal oscillator accuracy and don't implement special measures to reduce drift effects introduced by the oscillator circuits. As already clarified, there's no tunung for the crystal oscillator.

I recently evaluated electronical programmable capacitors from Intersil, Maxim and incide-semi, they are surely a possible option for a simple crystal oscillator fine adjustment. But TCXO or OCXO methods would be usually needed to cancel the residual crystal t.c.
 

bjuric

Advanced Member level 4
Joined
May 4, 2011
Messages
115
Helped
32
Reputation
64
Reaction score
30
Trophy points
1,308
Location
Serbia
Activity points
1,980
Seriously speaking, I don't know exactly, how the PIC18F oscillator block would perform in a high accuracy oscillator. It's simply not specified for this purpose. In the usual enviroment, you can expect additional jitter caused by other digital chip activities that aren't present with a dedicated oscillator component. But jitter doesn't necessarily involve drift of the average frequency.

You should also asume, that Microchip is satisfied with basic crystal oscillator accuracy and don't implement special measures to reduce drift effects introduced by the oscillator circuits.
Very good point.

You guys are right, I'll go for the TCXO and eliminate all the hassle.

Now only to explain to the older people that new technology doesn't need calibrating all the time like they used to do LOL

Thank you very much, everybody....
I'll marking as solved... as soon as i figure out how... :)
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top