Raspberry Pi hardware real-time-clock?

Oliver Grawert ogra at ubuntu.com
Sat Dec 31 11:15:05 UTC 2016


hi,
Am Freitag, den 30.12.2016, 13:52 +0000 schrieb roger peppe:
> On 29 December 2016 at 19:15, roger peppe <roger.peppe at canonical.com>
> wrote:
> > 
> > It seems to work well, with one caveat: for about a minute after
> > rebooting,
> > the time is wrong - it becomes correct eventually:
> I spoke too soon - I'm not seeing the clock updated from the RTC any
> more,
> however long I wait.
> 
> For some reason it seems to like 17:37 on 26th December - it seems to
> return to that time when rebooted.

hmm, let me guess... this is the time you created the SD card ?

our initrd has a function that is supposed to set the system time to
the last mount date or fall back to the initial filesystem creation
timestamp if no hwclock is found (this is to prevent that you end up
with 01/01/1970 if you have no network and no hwclock at all, which can
cause nasty things in some userspace apps). this is done by the
"fixrtc" option you found below in the kernel cmdline and should be
overwritten once the userspace kicks in to set it from /dev/rtc.

> 
> The value in the RTC device is correct AFAICS.
> 
> Some things that may or may not be relevant: the hwclock command says
> it can't find the rtc device:
> 
>     # hwclock --debug
>     hwclock from util-linux 2.27.1
>     hwclock: cannot open /dev/rtc: No such file or directory
>     No usable clock interface found.
>     hwclock: Cannot access the Hardware Clock via any known method.
> 
> A couple of lines in /var/log/kern.log mention "rtc":
> 
>     Dec 26 17:37:01 localhost kernel: [    0.000000] Kernel command
> line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656
> bcm2708_fb.fbheight=416 bcm2709.boardrev=0xa01041
> bcm2709.serial=0x1917350 smsc95xx.macaddr=B8:27:EB:91:73:50
> bcm2708_fb.fbswap=1 bcm2709.uart_clock=3000000
> bcm2709.disk_led_gpio=47 bcm2709.disk_led_active_low=0
> vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000
> dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty0
> elevator=deadline root=/dev/disk/by-label/writable net.ifnames=0
> init=/lib/systemd/systemd ro panic=-1 fixrtc snap_core=core_645.snap
> snap_kernel=pi2-kernel_22.snap
>     Dec 26 17:37:01 localhost kernel: [    6.560643] hctosys: unable
> to open rtc device (rtc0)
> 
> Any ideas?

the above seems to happen before userspace (before the module is loaded
by kmod during boot), both lines are written in the same second on
initial kernel start ...

do you actually not have any rtc device at all in /dev after the module
was loaded (else the message is a red herring) ?
> 
> FWIW time keeping is particularly important for my application as
> it's
> acting as a time clock for
> a household's electricity supply.
> 
no worries, we'll get it working, but it might take a bit to find all
the pieces needed and make sure they work correctly, this is simply a
hw setup that has not come around yet ;)

ciao
	oli
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20161231/1c323788/attachment.sig>


More information about the Snapcraft mailing list