8-bit AVR Microcontrollers

Oscillator Calibration Register

Name:
OSCCAL
Offset:
0x66
Reset:
Device Specific Calibration Value
Access:
-
Bit76543210
CAL [7:0]
AccessR/WR/WR/WR/WR/WR/WR/WR/W
Resetxxxxxxxx

Bits 7:0 – CAL [7:0]: Oscillator Calibration Value

Oscillator Calibration Value

The oscillator calibration register is used to trim the calibrated internal RC oscillator to remove process variations away from the oscillator frequency. A preprogrammed calibration value is automatically written to this register during chip reset, giving the factory calibrated frequency as specified in the Clock Characteristics section of chapter Electrical Characteristics.The application software can write this register to change the oscillator frequency. The oscillator can be calibrated to frequencies as specified in the Clock Characteristics section of chapter Electrical Characteristics. Calibration outside that range is not recommended.

Note that this oscillator is used to time EEPROM and Flash write accesses, and these write times will be affected accordingly. If the EEPROM or Flash are written, do not calibrate to more than 8.8 MHz. Otherwise, the EEPROM or Flash write may fail.

The CAL7 bit determines the range of operation for the oscillator. Setting this bit to 0 gives the lowest frequency range, setting this bit to 1 gives the highest frequency range. The two frequency ranges are overlapping, in other words, a setting of OSCCAL=0x7F gives a higher frequency than OSCCAL=0x80.

The CAL[6:0] bits are used to tune the frequency within the selected range. A setting of 0x00 gives the lowest frequency in that range and a setting of 0x7F gives the highest frequency in the range.