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
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