Patent ID: 6925402

Claim:
A method of operating a microcontroller chip having a central processing unit, memory means for storing programs and data, at least one peripheral unit for interacting with the outside of the chip, and an internal RC oscillator for providing clock signals to the central processing and peripheral units, wherein the at least one peripheral unit comprises a timer unit having a counter incremented at a frequency proportional to an oscillation frequency of the RC oscillator, the method comprising the steps of: connecting an external calibration source to a capture input of the timer unit, the calibration source providing a calibration signal having a predefined reference frequency; sampling a value of the counter on active edges of the calibration signal; processing the sampled values of the counter to derive a calibration ratio; and performing software correction of at least one parameter handled by a program stored in the memory means based on the calibration ratio to compensate for frequency variations of the RC oscillator.