EmbeddedRelated.com
Forums

Atmega Internal clock source accuracy

Started by eeh August 31, 2005
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?

> I find that Atmega internal 1MHz RC clock source is inaccurate. It is > about 95% of 1MHz. I used 3V.
The internal RC source varies across V and T.
> I have tried to check the oscillator calibration byte by AVRStudio and > then load the value into OSCCAL in the beginning of the program.
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.

eeh <eehobbyist@yahoo.com.hk> wrote:
> Hi,
> I find that Atmega internal 1MHz RC clock source is inaccurate.
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.
On 31 Aug 2005 04:03:27 -0700, "larwe" <larwe@larwe.com> wrote:

> >> I find that Atmega internal 1MHz RC clock source is inaccurate. It is >> about 95% of 1MHz. I used 3V. > >The internal RC source varies across V and T. > >> I have tried to check the oscillator calibration byte by AVRStudio and >> then load the value into OSCCAL in the beginning of the program. > >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 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 &#4294967295;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 http://atmel.com/dyn/resources/prod_documents/doc2555.pdf and the corresponding code files http://atmel.com/dyn/resources/prod_documents/AVR053.zip Tom
Thanks!

eeh wrote:

> Hi, > > I find that Atmega internal 1MHz RC clock source is inaccurate.
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