Raspberry Pi hardware real-time-clock?

roger peppe roger.peppe at canonical.com
Sat Dec 31 11:38:06 UTC 2016


On 31 December 2016 at 11:15, Oliver Grawert <ogra at ubuntu.com> wrote:
> 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 ?

Yup, that seems about right. Boxing Day fun with Raspberry Pis :)

> 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) ?

I don't see any files matching *rtc* in /dev.

What's odd is that it definitely worked at least once.

If I wanted to start delving into kernel source to see what's going on, have you
got any suggested starting points? I'm not sure which layer is responsible
for setting up the RTC device or setting the current time from it.

  cheers,
    rog.




More information about the Snapcraft mailing list