Using Different Crystal then specified.

Go To Last Post
18 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If the data-sheet for the micro-controller specify for example 8MHz crystal and I use a lower or higher frequency crystal, does the micro still work?

If I am using timer or clock, does that get effected?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Normally the datasheet specifies the maximum frequency. You can use a slower crystal and everything will still work. You can always try a higher speed, but it is not sure it will work. Better not.

Of course it will influence clock and timers etc.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

See the data sheet for the maximum clock rate, any crystal lower in frequency can be used. If software is written for a particular clock frequency it will probably need to be modified if a different frequency is used.

Leon Heller G1HSM

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Some AVR models feature a system clock prescaler that can be used with all clock source options and affects CPU clock and all synchronous peripherals.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If I am using this micro to build a simple clock, does the frequency of crystal effect the clock time accuracy?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You need to look at the specs for the crystal you are considering as you are talking about two different parameters - frequency and accuracy (of frequency).

You can get all 4 combinations - low frequency/high accuracy, high frequency/high accuracy etc.

Crystal accuracy is highly likely to equate to clock accuracy.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As you may also have seen that some digital clocks run ahead or fall behind by a minute or two over time, is that dependent on oscillator performance?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Crystal frequency does not matter in accuracy, just the accuracy itself that matters. But there are usually minimum and maximum limits for what frequency crystal you can connect to an AVR for example. If I recall with AVRs the minimum limit is so low you really cannot get so low frequency crystals. I'd guess 1MHz is the minimum frequency crystal you can still easily buy.

Not the oscillator (inside AVR), but mainly the (external) crystal whose oscillating frequency is temperature dependent.

Other components affect performance too. Most people do not realize/know that the crystal oscillates at the specified frequency only when it is placed in certain environment - for example the crystal datasheet specifies a load capacitance it is supposed to have, or the frequency is not exactly what it reads on the label.

You can get crystals with typical initial accuracy of 50ppm cheaply, if you want them to be 10ppm accurate, you get to pay more for a better crystal. Then, crystal frequency changes when it gets older (aging).

There are also ceramic resonators, but they are cheaper and less accurate than crystals.

If you want to build an accurate wall clock or otherwise keep accurate time, buy a ready-made RTC chip with on-board crystal from some manufacturer like Maxim, they say it is about 2ppm accurate. 2ppm means time will not drift more than about 63 seconds per year.

But whatever crystal you use, or if you use wrong loading capacitance on crystal so it runs too fast or slow, you can still use some tricks to fine-tune in software. For example if you see that your time is running slower than it really is, then just count faster. If a 1000000Hz crystal is really oscillating at 999999Hz, then increase seconds after 999999 crystal ticks instead of the nominal 1000000 ticks.

Or just use mains frequency to keep time, it could lag or lead by minute or two at any time, but on average the error is very minimal.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

evev700 wrote:
If I am using this micro to build a simple clock, does the frequency of crystal effect the clock time accuracy?

Crystals in MHz range are typically less temperature sensitive and more stable, but need calibration.

Watch crystals (32kHz) rely on a relative constant room temperature.

Peter

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

evev700, I rather continue discussion here instead of replying to your questions in private messages.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Interesting discussion. What would be more accurate?
Using internal oscillator for the clock and an 32,768KHz on a timer to give one second pulses, or a 7 or 8 MHZ crystal for the clock and creating the 1 sec pulses by software.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A crystal with 10ppm accuracy is still a crystal with 10ppm accuracy, regardless of frequency.

Usually if power consumption is not an issue, the normal crystals are easier to get working than 32768Hz watch crystals, if a crystal must be put there for timekeeping.

But putting a 32768Hz crystal there is no magic bullet for accurate clock, as it needs even more controlled environment to work (load capacitance as low as about 6pF and oscillator that allows 50k or more crystal ESR, compared to about 10-16pF and 100 ohms for normal crystal), and might work at 32767.9Hz so that is still 3ppm too slow over a year's period.

Besides if you have a bigger frequency (1MHz-20MHz) crystal, you have more pulses per second to do time calibration in software. For example if you count crystal ticks to get 1 second pulses, 1MHz +/- 1 count is 1ppm, 20MHz +/- 1 count is 0.05ppm, so you have better fine-tuning. Of course you could use scaled numbers.

So having a ready-made RTC module keeps time best, within 2ppm, they have temperature compensation and maybe even user calibration values.

Last Edited: Sat. Jan 15, 2011 - 07:29 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jepael wrote:
So having a ready-made RTC module keeps time best, within 2ppm, they have temperature compensation and maybe even user calibration values.

There are only some expensive Maxim parts with temperature compensation, but this is in general not usual.

Peter

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I know a RTC is the best.

It was just a theoretical question. So far, I always used a high frequency cristal and fine tuning in software instead of that 32768, and for my needs, it is sufficiently accurate. But I was wondering if a 32768 crystal would give a better result. That's all.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The average $0.10 watch crystal has a 20ppm.
The average $0.20 8MHz crystal has a 50ppm.

Neither will be as good as your wristwatch.
Both will keep good enough time over 24 hours. They will both be wrong after a week or a year.

You can 'pull' crystals to adjust the frequency to achieve 5ppm or so. Or add / subtract seconds every day in software.

However well you 'tune' your crystal the temperature variations will probably be significant. Your wristwatch stays at 37C. You could always carry your AVR board in your underpants.

You can pay more money for more accurate crystals.
You can pay a lot of money for a crystal oven.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

danni have answered

Quote:
Watch crystals (32kHz) rely on a relative constant room temperature.

So what is the temp range?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
There are only some expensive Maxim parts with temperature compensation, but this is in general not usual.
Microchip MCP79410

On-Chip Digital Trimming/Calibration:
Range -127 to +127 ppm
Resolution 1 ppm

Mouser - $1.08 single lot

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bphillips wrote:
MCP79410

Exact, as I stated. Most RTC and also this part are without temperature compensation.

It include only a way for software calibration and thus no trimming capacitor was needed.

RTC with temperature compensation include already the crystal, since the compensation depend on the crystal itself.

RTC with TCXO are e.g. the DS32B35

Peter