[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Calibrate internal RC oscilator FAQ

From: Joerg Wunsch
Subject: Re: [avr-gcc-list] Calibrate internal RC oscilator FAQ
Date: Mon, 30 Nov 2009 20:34:51 +0100 (MET)

max2009tiny <address@hidden> wrote:

> 1. when i program and select 4MHz internal RC osc. what OSCAL
> constatnt is loaded by reset if Atmel have more constants from
> factory?

The AVR hardware only loads the default (i.e., 8 MHz) OSCCAL value
itself.  It's the responsibility of the developer to maintain the
OSCCAL values of the other frequencies outside (e.g. through an EEPROM
cell), or somehow perform a run-time calibration (against whatever
that could be used as a calibration source, 32 kHz oscillator,
external clock of some kind, ...).

If you don't want to bother with that, use a more modern AVR: they
only have a single (and much better, e.g. regarding the frequency
stability vs. Vcc variations) RC oscillator, and thus also only a
single OSCCAL value which is loaded automatically.

> 2. where in code can change OSCAL and where not

You could change it everywhere you want.

> 3. exist math function to recalc new OSCAL for a correct freq or
> only probing?

There is no (guaranteed) mathematical formula for that.

> If diference between Tiny Mega ... please write simply about this.

I outlined the major difference above: recent AVRs ship with only a
single RC oscillator anymore which has been improved.  For example,
with an ATmega128, it was basically unavoidable to recalibrate the RC
oscillator (even the 8 MHz one) if you wanted to use Vcc = 3 V when
the calibration value the device ships with has been obtained for Vcc
= 5 V.  Replacing the ATmega128 by an ATmega1281, there's a good
chance you could run an RS-232 communication without recalibrating the
RC oscillator even at Vcc = 3 V (but of course, it's not guaranteed it
will work).

cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]