Atmega Internal clock source accuracy

Aug 31, 2005 5 Replies

Hi,



I find that Atmega internal 1MHz RC clock source is inaccurate. It is about 95% of 1MHz. I used 3V.



I have tried to check the oscillator calibration byte by AVRStudio and then load the value into OSCCAL in the beginning of the program. However, the problem is still present.



Could anyone tell me how to calibrate under this condition?



The internal RC source varies across V and T.

You don't need to do this for the 1MHz value (usually, it depends on the specific chip). The 1MHz cal byte is loaded automatically at powerup.

The freqency accuracy is so large even the clock value is calibrated. I find that it is about 5% which is so large for measurement purpose applications.

Quite certainly. So don't use it if you need an accurate clock. Use what the gods intended for the purpose: a quartz or something even better, external tot he CPU.

Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de) Even if all the snow were burnt, ashes would remain.

The problem is that you use 3V. The nominal internal RC frequency is for 5V. The OP didn't say what device he is using, but I looked at the ATmega8 datasheet, and at shows in Fig 180 that you should indeed get about

0.95MHz at 3V, 25 °C

You could use AVRStudio to calibrate, or just try loading higher values for OSCCAL in your program.

You can expect +/- 1% accuracy, but it highly depends on the voltage and temperature. If needed, you can adjust OSCCAL at runtime, but do not change the frequency by more than 2% at a time.

The most recent devices, like ATtiny2313 and ATmega48/88/168 has a clock output option, so you can measure the frequency directly.

There is also an application note, AVR053: Calibration of the internal RC oscillator

formatting link
and the corresponding code files
formatting link

Tom

Yes, the RC clock is there for application that can tolerate this margin. There are ceramic resonators giving better accuracy and stability and there are quartz cristals that give even better values. What is the problem ? Oh, you wanted to save another dollar.

Rene

Ing.Buero R.Tschaggelar - http://www.ibrtses.com & commercial newsgroups - http://www.talkto.net

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required