[SOLVED] Problem setting rtc on c2

Hi all,
I recently installed coreelec on my c2 and everything is working perfectly except for the rtc shield (pcf8563 from HK).
I see the ‘rtc_fpc8563’ module is present but it is missing ‘aml_i2c’ so no rtc device is created in /dev.
Not sure if aml_i2c is built-in to the kernel but when I modprobe rtc_fpc8563 it doesnt give me any error and lsmod show it is not loaded.
I just checked last nightly build and it is the same.
Any chance to get aml_i2c built as a module in a future version of CE?
I had a LE custom build (from a few years back on odroid forums) previously where I could set up the rtc.
Thank you for everything! coreelec is awesome!

It’s likely your problem is that the the pcf8563 is disabled by default.

Give the following a try.

mount -o remount,rw /flash
fdtput -t s /flash/dtb.img /i2c@c1108500/pcf8563@51 status "okay"
mount -o remount,ro /flash
reboot

Thanks cdu13a

I actually did that for sure :slight_smile: As I said I have previously had it working on an old LE build (pre CE I think it was raybuntu build)
But no rtc0 device was created this time…

I will try again on a new install and see if I did any mistakes anywhere. I just installed HK’s official ubuntu to make sure my shield was still working and it does work.

So I retried and it is still the same…

CoreELEC:~ # modprobe aml_i2c
modprobe: FATAL: Module aml_i2c not found in directory /lib/modules/3.14.29
CoreELEC:~ # modprobe rtc_pcf8563
CoreELEC:~ # lsmod|grep rtc
CoreELEC:~ #

and for sure hwclock doesnt work :wink:

Instead of editing the dtb try adding the following to your config.ini file then rebooting.
rtc_shield='1'

You also really shouldn’t need all the modprobe stuff.

just did that and no change… but thanks nonetheless

and when I look at dmesg I get this:

CoreELEC:~ # dmesg |grep rtc
[    0.440307@1] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
CoreELEC:~ #

I unfortunately don’t have the rtc shield, I’m digging through my box of IC to see if I have an
pcf8563 ic to try with instead.

The thing is nothing has changed in relation to this in something like 2 years.

Everything should be there.

Well it was a community build of LE that enabled it. Ill try and find that thread on the HK forums.
But to me it seems that it is just missing aml_i2c module
I would love to try and build CE myself but I aint familiar with the build process for LE/CE

EDIT : just realised that you got it right in your previous answer putting rtc_shield=1 in config.ini works as well. I dont know how I managed to typo that, but I did… And I suppose that keeps my settings even when I upgrade?

I got it to work :slight_smile:
I feel like an idiot… Answer was in boot.ini…
@cdu13a that maybe what has changed in 2 years cause I remember having to patch dtb myself.

setenv rtc_shield "0"
...
if test "${rtc_shield}" = "1"; then fdt set "/i2c@c1108500/pcf8563@51" status ok; else fdt set "/i2c@c1108500/pcf8563@51" status disabled; fi

Basically it was overwriting the change I made to dtb every time it booted…
Anyway changing

setenv rtc_shield "1"

I am now getting

CoreELEC:~ # dmesg |grep rtc
[    0.277820@1] rtc-pcf8563 1-0051: chip found, driver version 0.4.3
[    0.278513@1] rtc-pcf8563 1-0051: rtc core: registered rtc-pcf8563 as rtc0
[    0.425238@3] rtc-pcf8563 1-0051: setting system clock to 2020-02-03 11:19:36 UTC (1580728776)
CoreELEC:~ #

thanks for your help cdu13a!!

About | FAQ | Terms of Service | Privacy Policy | Legal Notice