Calibrated internal rc oscillator, Oscillator calibration register – osccal, Atmega128(l) – Rainbow Electronics ATmega128L User Manual

Page 38

Advertising
background image

38

ATmega128(L)

2467B–09/01

Calibrated Internal RC
Oscillator

The calibrated internal RC oscillator provides a fixed 1.0 MHz, 2.0 MHz, 4.0 MHz, or 8.0
MHz clock. All frequencies are nominal values at 5V and 25

°C. This clock may be

selected as the system clock by programming the CKSEL fuses as shown in

Table 13. If

selected, it will operate with no external components. The CKOPT fuse should always
be unprogrammed when using this clock option. During reset, hardware loads the cali-
bration byte into the OSCCAL register and thereby automatically calibrates the RC
oscillator. At 5V, 25

°C and 1.0 MHz oscillator frequency selected, this calibration gives a

frequency within

± 1% of the nominal frequency. When this oscillator is used as the chip

clock, the Watchdog Oscillator will still be used for the Watchdog Timer and for the reset
time-out. For more information on the pre-programmed calibration value, see the section
“Calibration Byte” on page 282.

Note:

1. The device is shipped with this option selected.

When this oscillator is selected, start-up times are determined by the SUT fuses as
shown in

Table 14. XTAL1 and XTAL2 should be left unconnected (NC).

Note:

1. The device is shipped with this option selected.

Oscillator Calibration Register
– OSCCAL

Note:

OSCCAL register is not available in ATmega103 compatibility mode.

• Bits 7..0 - CAL7..0: Oscillator Calibration Value

Writing the calibration byte to this address will trim the internal oscillator to remove pro-
cess variations from the oscillator frequency. This is done automatically during chip
reset. When OSCCAL is zero, the lowest available frequency is chosen. Writing non-
zero values to this register will increase the frequency of the internal oscillator. Writing
$FF to the register gives the highest available frequency. The calibrated oscillator is
used to time EEPROM and Flash access. If EEPROM or Flash is written, do not cali-
brate to more than 10% above the nominal frequency. Otherwise, the EEPROM or Flash
write may fail. Note that the Oscillator is intended for calibration to 1.0 MHz, 2.0 MHz,
4.0 MHz, or 8.0 MHz. Tuning to other values is not guaranteed, as indicated in

Table 15.

Table 13. Internal Calibrated RC Oscillator Operating Modes

CKSEL3..0

Nominal Frequency (MHz)

0001

(1)

1.0

0010

2.0

0011

4.0

0100

8.0

Table 14. Start-up Times for the Internal Calibrated RC Oscillator Clock Selection

SUT1..0

Start-up Time from Power-

down and Power-save

Additional Delay from

Reset (V

CC

= 5.0V)

Recommended Usage

00

6 CK

-

BOD enabled

01

6 CK

4 ms

Fast rising power

10

(1)

6 CK

64 ms

Slowly rising power

11

Reserved

Bit

7

6

5

4

3

2

1

0

CAL7

CAL6

CAL5

CAL4

CAL3

CAL2

CAL1

CAL0

OSCCAL

Read/Write

R/W

R/W

R/W

R/W

R/W

R/W

R/W

R/W

Initial value

Device specific calibration value

Advertising