8-bit AVR Microcontroller

Oscillator Calibration Register

Name:
OSCCAL
Offset:
0x39
Reset:
xxxxxxxx
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 from the oscillator frequency. A pre-programmed calibration value is automatically written to this register during chip reset, giving the Factory calibrated frequency as specified in Accuracy of Calibrated Internal Oscillator section of Electrical Characteristics chapter.

The application software can write this register to change the oscillator frequency. The oscillator can be calibrated to frequencies as specified in Accuracy of Calibrated Internal Oscillator section of Electrical Characteristics chapter. Calibration outside that range is not guaranteed.

The lowest oscillator frequency is reached by programming these bits to zero. Increasing the register value increases the oscillator frequency.

Note that this oscillator is used to time Flash write accesses, and write times will be affected accordingly. Do not calibrate to more than 8.8MHz if Flash is to be written. Otherwise, the Flash write may fail.

To ensure stable operation of the MCU the calibration value should be changed in small steps. A step change in frequency of more than 2% from one cycle to the next can lead to unpredictable behavior. Also, the difference between two consecutive register values should not exceed 0x20. If these limits are exceeded the MCU must be kept in reset during changes to clock frequency.