Datasheet

29
8024A–AVR–04/08
ATmega8HVA/16HVA
Figure 9-2. Oscillator Sampling Interface Block Diagram
Note: 1. One prescaled Slow RC/ULP oscillator period corresponds to 128 times the actual Slow
RC/ULP oscillator period.
The osi_posedge signal pulses on each rising edge of the prescaled Slow RC/ ULP oscillator
clock. This signal is not directly accessible by the CPU, but can be used to trigger the input cap-
ture function of Timer/Counter0. Using OSI in combination with the input capture function of
Timer/Counter0 facilitates accurate measurement of the oscillator frequencies with a minimum
of CPU calculation. Refer to ”Timer/Counter(T/C0,T/C1)” on page 77 for details on how to
enable the Input Capture function.
9.12.3 Usage
The Slow RC oscillator represents a highly predictable and accurate clock source over the entire
temperature range and provides an excellent reference for calibrating the Fast RC oscillator
runtime. Typically, runtime calibration is needed to provide an accurate Fast RC frequency for
asynchronous serial communication in the complete temperature range. An accurate time refer-
ence is also needed to calculate accumulated charge during a CC-ADC measurement.
The Slow RC frequency at T
HOT
(calibration temperature) and the Slow RC temperature coeffi-
cient are stored in the signature row. The value of T
HOT
is also stored in the signature row. These
characteristics can be used to calculate the actual Slow RC clock period at a given temperature
with high precision. Refer to ”Slow RC Oscillator” on page 26 for details.
By measuring the number of CPU cycles of one or more prescaled Slow RC clock periods, the
actual Fast RC oscillator clock period can be determined. The Fast RC clock period can then be
adjusted by writing to the FOSCCAL register. The new Fast RC clock period after calibration
should be verified by repeating the measurement and repeating the calibration if necessary. The
Fast RC clock period as a function of the Slow RC clock period is given by:
where n is the number of prescaled Slow RC periods that is used in the measurement. Using
more prescaled Slow RC periods decreases the measurement error, but increases the time con-
sumed for calibration. Note that the Slow RC Oscillator needs very short time to stabilize after
osi_posedge
Databus
Ultra Low
Power RC
Oscillator
Slow RC
Oscillator
OSCILLATOR SELECT
7 bit prescaler
Edge
Detector
OSISEL0
OSICSR
Fast RC
Oscillator
(1)
T
FastRC
T
SlowRC
128
n
number of CPU cycles in n prescaled Slow RC period
s
---------------------------------------------------------------------------------------------------------------------------------------------
--- -
=