Accuracy of external resonator

johndk

Senior Member
I'm running a 28x2 at 64MHz using an external 16MHz resonator. A second 28x2 runs at the nominal 8MHz on the internal resonator. I'm trying to calibrate the frequencies against a 32.768k square wave generated by a DS1307 with the appropriate crystal. I'm doing some very close timing and would therefore want to document the accuracy of the clocks on both chips.

To do this, I count square wave pulses for 0.5 sec several intervals and do the high/low/mean calculations. Here's my surprise. Using calibfreq I can zero in the 8MHz chip to within a 3-4 ms/sec of the square wave signal with a drift of about +/- 170 us between counts ... not bad. However, the external resonator starts off very nicely, like 2-3 ms/sec but then quickly moves to around 35ms/sec with a drift of about +/- 30 us between counts. So a tighter frequency, but off the mark.

I'm assuming the external resonator is reacting to temperature, although the board doesn't get very warm, maybe 5C above ambient. It seems to stabilize pretty well once it's warmed up. I thought resonators were supposed to be temperature compensated, but apparently not.

I'm assuming the DS1307 puts out an accurate frequency and both chips are using the same DS1307 to calibrate. Is there any way I can tweak the frequency with an external resonator like we can with calibfreq? I would like to get the two chips operating as close to 'nominal' frequencies as possible. Or can I use a 16MHz crystal with a couple of caps instead of the resonator?

Suggestions welcome.

John
 

Circuit

Senior Member
Or can I use a 16MHz crystal with a couple of caps instead of the resonator?

Suggestions welcome.

John
Yes, absolutely you can use an external crystal and loading capacitors for the maximum accuracy. See PICAXE manual 1 page 48 for reference. Just make sure that you buy decent crystals and caps if you want best reliability/accuracy. I obtained branded versions from one of the major electronic suppliers and they work well.
 

johndk

Senior Member
I found a helpful related thread here: http://www.picaxeforum.co.uk/showthread.php?27634-Resonator-Accuracy

Are there packages with crystals and loading caps together, like the ceramic resonator packages? That would be ideal, if not too expensive.

Can anyone suggest if the frequency shift at 64MHz is due to the temperature of the resonator changing or the temperature of the 28x2? I've noticed that the chip runs quite a bit warmer when at the higher speed. But the resonator temperature doesn't change that much. I'm asking because if it is the chip temperature, then a crystal resonator wouldn't help me much.

John
 

johndk

Senior Member
Just to close this out properly, I discovered that I was working with a bad resonator. I replaced the component and I'm getting much better and consistent results. I also purchased the components for a 16MHz crystal oscillator and we'll see how that stacks up for the next "deluxe" version. In the meantime, I hope some found my dilemma and solution helpful.

John
 
Top