10.7.2 Oscillator Calibration Register
Name: | OSCCAL |
Offset: | 0x39 |
Reset: | xxxxxxxx |
Property: | - |
Bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | |
CAL[7:0] | |||||||||
Access | R/W | R/W | R/W | R/W | R/W | R/W | R/W | R/W | |
Reset | x | x | x | x | x | x | x | x |
Bits 7:0 – CAL[7:0] 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.