Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Feb 1996 04:52:09 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        current@freebsd.org
Subject:   calibrating clocks
Message-ID:  <199602101752.EAA05969@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
I plan to calibrate all the system clocks relative to the MC14618A (RTC)
clock and perhaps use the results automatically.  Sample results on a
P133 for a sequence of calibrations run at boot time:

i586 clock: 132622900 Hz, i8254 clock: 1193105 Hz
i586 clock: 132622822 Hz, i8254 clock: 1193103 Hz
i586 clock: 132622698 Hz, i8254 clock: 1193102 Hz
i586 clock: 132623058 Hz, i8254 clock: 1193106 Hz
i586 clock: 132623478 Hz, i8254 clock: 1193109 Hz
i586 clock: 132622866 Hz, i8254 clock: 1193103 Hz
i586 clock: 132622752 Hz, i8254 clock: 1193102 Hz
i586 clock: 132622934 Hz, i8254 clock: 1193104 Hz
i586 clock: 132623418 Hz, i8254 clock: 1193108 Hz
i586 clock: 132623486 Hz, i8254 clock: 1193109 Hz
i586 clock: 132623470 Hz, i8254 clock: 1193109 Hz
i586 clock: 132623470 Hz, i8254 clock: 1193109 Hz
i586 clock: 132623368 Hz, i8254 clock: 1193108 Hz
i586 clock: 132622782 Hz, i8254 clock: 1193103 Hz
i586 clock: 132622858 Hz, i8254 clock: 1193103 Hz
i586 clock: 132622870 Hz, i8254 clock: 1193103 Hz
i586 clock: 132622814 Hz, i8254 clock: 1193103 Hz

The calibration method and all the clocks were relatively accurate to
within about 5 ppm in all of my tests.  The current method of
calibrating the i586 (using DELAY()) should be at most 20 ppm less
accurate (it apparently isn't).

The nominal frequency of the i8254 clock is 1193182.  This agrees well
with the above.  On another system, the calibration gives about 1192100,
which turns out to be very accurate, so automatically adjusting
TIMER_FREQ to it works well.  On a third system, the calibration gives
about 1193650, which turns out to be less accurate than the nominal
frequency.

I use r/w sysctl variables to tweak the frequencies.

machdep.i586_freq: 132622930
machdep.i8254_freq: 1193105

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199602101752.EAA05969>