Crystal oscillator variability between PICs?
I have a timing critical application and am running an 8Mhz xtal with a 16F628a. When I program chip 1 with given HEX code (compiled with PBP), it runs roughly 23 ppm slow. I programmed a different 16F628a with the exact same code (same xtal and osc caps, same board, same ambient temperature, same spot on the table), and it runs about 800 ppm slow. What could explain this much variation between PICs with the same external crystal oscillator? Could some threshold or internal capacitance be slightly different between the two chips to affect oscillator freq that much? Everything's soldered on the board except the chip, which uses a socket.
Also here's the obligatory monkey wrench: chip 1 seemed to run just fine with an 8Mhz crystal with the XT osc setting, so I am using the XT osc setting for both chips. Could that have something to do with it? When I have a chance to get back to the workbench, I plan on changing to HS to see if that does anything to either chip, but wanted to see if anyone had any experience with something like this.
Thanks in advance!
Dave
Re: Crystal oscillator variability between PICs?
You should be using HS. Try it...
Re: Crystal oscillator variability between PICs?
Yeah, that was it. After switching to HS it went from about 800ppm slower than I wanted to about 125ppm faster. The first chip also went from 23ppm slower to roughly 125ppm faster. For clarity, being 125ppm faster doesn't mean the crystal is off by 125ppm, it just means I need to add some pauseus statements to get my code spot-on.
Thanks,
Dave
Re: Crystal oscillator variability between PICs?
You got me thinking; you are using an old PIC. The PIC itself has a part in driving the oscillator crystal. Would a newer PIC, with "better" technology be more accurate than 125 ppm?? I have a time-critical project I'm using a PIC18F27Q43 with a 16 MHz crystal to generate a 64 MHz Fosc (w/PLL). It seems to be as accurate as my scope can show. Just thinking out loud.
Re: Crystal oscillator variability between PICs?
Yeah, I've read somewhere the new internal oscillators are supposed to be better than the old PICs.
Some things to also keep in mind for really time critical applications - temperature of the oscillator which is manageable, but also acceleration if the oscillator is used in a dynamic environment. This includes substantial vibration. It has been suggested by some that this is the primary reason why all off-the-shelf GPS/GNSS modules are nominally limited to 4g acceleration before losing positional lock.
Troy
Re: Crystal oscillator variability between PICs?
By internal oscillator you mean the RC internal oscillator, that has nothing to do with eternal Xtal oscillator.
The RC will always be off because of tolerances and temperatures.
Now, regarding the Xtal itself, will be off a bit by construction. But little and well defined on the datasheet. The most important factor though, for the precision of the frequency is the loading of the xtal (some are loaded in series, most are parallel loaded). User have to read the datasheet and see what capacitance needs the Xtal so it operates as expected. Too much or too little loading may result in slower or no oscillation. One of the loading capacitors may be a trimmer cap and be adjusted to obtain precise frequency.
Ioannis
Re: Crystal oscillator variability between PICs?
If you need high precision timing ... just do use external oscillators like those : https://www.mouser.fr/datasheet/2/96...HS-1665263.pdf
just my two cents ... :rolleyes:
poor man will add a trimmer capacitor in the Xtal circuit, but to be trimmed for each chip ...
Other cheap solution is to turn to a 16F88 or 87 ( pin compatible ) and play with the OSCTUNE register ...
Alain
Re: Crystal oscillator variability between PICs?
Once again I do not receive notifications of new post. Does anyone else have the same problem?
Ioannis
Re: Crystal oscillator variability between PICs?
Yes same problem here. I used to but not anymore.
Re: Crystal oscillator variability between PICs?
Lester has taken care of this and hopefully we do receive replies now.
Please post to test others.
Ioannis
Re: Crystal oscillator variability between PICs?
Well I didn't receive a notification that this thread was replied to. I guess it's still not working.
Re: Crystal oscillator variability between PICs?
I am sure it does work. Check it please.
Ioannis
Re: Crystal oscillator variability between PICs?
Hi, Ioannis
I didn't receive any notification nor for posts 8 to 11 ... just for the last one ( Yours )
Best Regards
Alain
Re: Crystal oscillator variability between PICs?
Re: Crystal oscillator variability between PICs?
Alain, about the time I posted Lester resolved the problem.
It should be OK now.
Ioannis