rpi3 clock drift
James Shuriff
james at opentech.cc
Wed Nov 27 08:33:22 UTC 2019
I've read that the Pi 4 may have a 54 MHz oscillator and anything prior to that would have 19.2 MHz, which agrees with what everyone on this thread is contributing. That makes me think I have a bad FDT. I looked at generic_timer.c, which creates the ARM MPCore Timecounter and I think it's getting the frequency itself from FDT. Do you know where in particular it's getting this frequency from?
The RPI3 build provided by FreeBSD uses an overlay called "pwm". It grabs it from the Raspberry Pi binary blob repo, in addition to "pi3-disable-bt" and "mmc". I decompiled it and took a look at the source but there's no reference to a 54 MHz clock. There is an "assigned-clock-rates = <0x5f5e100>;". I built my Raspberry Pi 3 B as close to how the FreeBSD image was set up as possible. I build everything from source but I grabbed my config.txt file from /usr/ports/sysutils/rpi-firmware/files/config_rpi3.txt. You can see the attached file for details on how I set up the FAT partition. I had started adding support for the I2C RTC because I was hoping to use that as the timecounter.
Here is config.txt, straight from sysutils/rpi-firmware:
arm_control=0x200
dtparam=audio=on,i2c_arm=on,spi=on
dtoverlay=mmc
dtoverlay=pwm
dtoverlay=pi3-disable-bt
device_tree_address=0x4000
kernel=u-boot.bin
Aside from the VideoCore elfs, the overlays referenced in config.txt, bcm2710-rpi-3-b.dtb, and the PSCI Monitor I build everything from source and copy the remaining DTBs from the FreeBSD build. I also configure U-Boot with OF_EMBED=n and OF_BOARD=y. OF_EMBED=n tells U-Boot not to embed a Device Tree into the image and OF_BOARD=y tells U-Boot to grab the Device Tree from the board itself (if supported). I don't know enough about Device Trees to determine where it's actually getting FDT from or where the definition for the clock is.
- James Shuriff
-----Original Message-----
From: owner-freebsd-arm at freebsd.org <owner-freebsd-arm at freebsd.org> On Behalf Of Per Hedeland
Sent: Tuesday, November 26, 2019 7:18 PM
To: freebsd-arm at freebsd.org
Subject: Re: rpi3 clock drift
On 2019-11-27 00:17, Stefan Parvu wrote:
>
>>
>> Can someone else with an rpi3 (which keeps good time) confirm that
>> that's the usual number?
>
>
> this is slightly different model: rpi3+ . I think it does use a different SOC than rpi3.
>
> krmx at k1:~ % sysctl kern.timecounter
> kern.timecounter.fast_gettime: 1
> kern.timecounter.tick: 1
> kern.timecounter.choice: ARM MPCore Timecounter(1000) dummy(-1000000)
> kern.timecounter.hardware: ARM MPCore Timecounter
> kern.timecounter.alloweddeviation: 5
> kern.timecounter.stepwarnings: 0
> kern.timecounter.tc.ARM MPCore Timecounter.quality: 1000
> kern.timecounter.tc.ARM MPCore Timecounter.frequency: 19200000
> kern.timecounter.tc.ARM MPCore Timecounter.counter: 3645432288
> kern.timecounter.tc.ARM MPCore Timecounter.mask: 4294967295
The same on what is a 3B w/o '+' AFAIR, keeping very good time:
pi3 2> sysctl kern.timecounter
kern.timecounter.fast_gettime: 1
kern.timecounter.tick: 1
kern.timecounter.choice: ARM MPCore Timecounter(1000) dummy(-1000000)
kern.timecounter.hardware: ARM MPCore Timecounter
kern.timecounter.alloweddeviation: 5
kern.timecounter.stepwarnings: 0
kern.timecounter.tc.ARM MPCore Timecounter.quality: 1000 kern.timecounter.tc.ARM MPCore Timecounter.frequency: 19200000 kern.timecounter.tc.ARM MPCore Timecounter.counter: 27058350 kern.timecounter.tc.ARM MPCore Timecounter.mask: 4294967295
and
pi3 3> cat /var/db/ntp/ntpd.drift
-5.333
pi3 4> uname -a
FreeBSD pi3.hedeland.org 12.0-STABLE FreeBSD 12.0-STABLE r345358 GENERIC arm64
--Per Hedeland
_______________________________________________
freebsd-arm at freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "freebsd-arm-unsubscribe at freebsd.org"
________________________________
DISCLAIMER: This message and any attachments are intended solely for the use of the recipient and may contain confidential information. If you have received this message in error please delete it and promptly notify the sender, James Shuriff (james at opentech.cc<mailto:james at opentech.cc>).
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sdboot.txt
URL: <http://lists.freebsd.org/pipermail/freebsd-arm/attachments/20191127/1cc6a436/attachment.txt>
More information about the freebsd-arm
mailing list