Patent ID: 8825170

Claim:
An implantable medical device (IMD) comprising: a processor; a system clock that comprises a low power oscillator, according to which the processor operates the IMD; a reference clock that comprises a high accuracy oscillator; and a clock calibrator that periodically performs a calibration routine to calibrate the system clock based on the reference clock, wherein the system clock is continuously powered and the reference clock is powered during the calibration routine, wherein the clock calibrator comprises: a controller that powers on the reference clock at a start of the calibration routine, and disables the reference clock at an end of the calibration routine; a clock comparator that determines a clock error of the system clock based on a difference between frequencies of the system clock and the reference clock over a fixed number of clock cycles of the system clock, wherein the clock comparator includes: a system clock counter that is set equal to the fixed number of clock cycles and decrements by one for each clock cycle of the system clock, wherein the system clock counter stops when equal to zero; and a reference clock counter that is set equal to the fixed number of clock cycles and decrements by one for each clock cycle of the reference clock, wherein the reference clock counter stops at a reference count value when the system clock counter is equal to zero, wherein the reference count value is indicative of the clock error of the system clock; and a clock adjuster that adjusts a trim value of the system clock to compensate for the clock error.