From owner-freebsd-current Sat Feb 10 09:56:49 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id JAA02730 for current-outgoing; Sat, 10 Feb 1996 09:56:49 -0800 (PST) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id JAA02714 for ; Sat, 10 Feb 1996 09:56:40 -0800 (PST) Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.9/8.6.9) id EAA05969 for current@freebsd.org; Sun, 11 Feb 1996 04:52:09 +1100 Date: Sun, 11 Feb 1996 04:52:09 +1100 From: Bruce Evans Message-Id: <199602101752.EAA05969@godzilla.zeta.org.au> To: current@freebsd.org Subject: calibrating clocks Sender: owner-current@freebsd.org Precedence: bulk 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