[time-nuts] x86 CPU Timekeeping and clock generation

Tom Holmes tholmes at woh.rr.com
Thu Jan 7 00:06:30 UTC 2021


Thanks to Chris, Magnus, and Trent for clearing
things up. Never would have expected going to the
effort of putting in a cheap clock, only to use it
very little. 

Who knows what evil lurks in the minds of
engineers? And I am one!

Tom Holmes, N8ZM

-----Original Message-----
From: time-nuts <time-nuts-bounces at lists.febo.com>
On Behalf Of Trent Piepho
Sent: Wednesday, January 06, 2021 6:36 PM
To: Discussion of precise time and frequency
measurement <time-nuts at lists.febo.com>
Subject: Re: [time-nuts] x86 CPU Timekeeping and
clock generation

On Wed, Jan 6, 2021 at 6:26 AM Tom Holmes
<tholmes at woh.rr.com> wrote:
>
> Am I missing something or maybe I don't
understand
> the situation , but I am under the impression
that
> the RTC has it's own battery and crystal
unrelated
> to the processor clock. Seems like in that case,
> the 24 MHz won't have any effect on the
> timekeeping drift.

It was like that, but the days of external RTC
chips, e.g. from
Dallas, are largely over.  PC now have it
integrated into the chipset.
Though it still has a power source and 32.768kHz
xtal of its own.

In the embedded SoC world of phones, Raspberry
PIs, and the OP's
Tinkerboard, there would virtually always be an
RTC available in the
SoC with the CPU, or in the PMIC, or in both.
This would usually have
its own 32.768kHz xtal, but often there is an
option to reduce the BoM
and use an internal RC oscillator instead of an
external xtal or clock
signal, at greatly reduced accuracy.

The 32k xtal isn't for timekeeping accuracy, but
for power savings.
In the lowest power modes the main PLLs will be
shut down.  Certain
parts of the SoC will still be able to run using
the 32kHz clock
domain and a low power output from the PMIC.

Linux doesn't use the RTC as the system clock.
During boot, the
kernel will usually set the system time from the
RTC, and then the RTC
doesn't get used much, if at all.  There is a mode
where the system
time is periodically copied back into the RTC,
which can be enabled
with NTP.  And software like chrony has the
ability to manage the RTC
and keep it in sync more intelligently, though I
don't think any
distro uses this by default.

There are a number of sources that Linux can use
as the system clock.
An on x86 system, it would usually be tsc, hpet,
and acpi_pm.  On an
ARM board, arch_sys_counter.  The kernel
subsystems for RTCs and for
clocksources are totally separate and the RTC,
e.g. rtc-cmos, isn't a
clocksource.

Using adjtimex, it's possible to see what the
current kernel
parameters are for clock adjustment.  The
frequency adjustment would
need to be zero.

_______________________________________________
time-nuts mailing list -- time-nuts at lists.febo.com
To unsubscribe, go to
http://lists.febo.com/mailman/listinfo/time-nuts_l
ists.febo.com
and follow the instructions there.






More information about the Time-nuts_lists.febo.com mailing list