Accessing RTC pcf8563 on the Odroid-c2?

This forum is for topics dealing with problems with software specifically in the AArch64 repo.

Accessing RTC pcf8563 on the Odroid-c2?

Postby mcloaked » Wed Jun 08, 2016 3:48 pm

I have a new odroid-c2 and have the rtc shield. I am not sure how to set up using the rtc. Some details are that the rtc shield is pcf8563 by NXP and am running arch linux arm on the odroid. I have checked what seems to be the relevant the modules as per:

Code: Select all
[root@odroid-c2 ~]# modinfo aml_i2c
filename:       /lib/modules/3.14.65-8-ARCH/kernel/drivers/amlogic/i2c/aml_i2c.ko.gz
license:        GPL
description:    I2C driver for amlogic
author:         AMLOGIC
depends:       
intree:         Y
vermagic:       3.14.65-8-ARCH SMP preempt mod_unload aarch64
[root@odroid-c2 ~]# modinfo rtc-pcf8563
filename:       /lib/modules/3.14.65-8-ARCH/kernel/drivers/rtc/rtc-pcf8563.ko.gz
version:        0.4.3
license:        GPL
description:    Philips PCF8563/Epson RTC8564 RTC driver
author:         Alessandro Zummo <a.zummo@towertech.it>
srcversion:     0F5F66E259F9C7FC908586C
alias:          i2c:rtc8564
alias:          i2c:pcf8563
alias:          of:N*T*Cnxp,pcf8563*
depends:       
intree:         Y
vermagic:       3.14.65-8-ARCH SMP preempt mod_unload aarch64



and there is some data at http://www.nxp.com/documents/data_sheet/PCF8563.pdf on the device. There also seems to be some setup info at http://odroid.com/dokuwiki/doku.php?id= ... figuration for linux but when I run hwclock -r I get:

Code: Select all
[root@odroid-c2 ~]# hwclock -r
hwclock: Cannot access the Hardware Clock via any known method.
hwclock: Use the --debug option to see the details of our search for an access method.


I tried to insert the module using:

Code: Select all
[root@odroid-c2 ~]# insmod rtc-pcf8563
insmod: ERROR: could not load module rtc-pcf8563: No such file or directory


But that didn't work. I am guessing that the system needs to have some config to detect the i2c devices and enable the rtc on boot but I don't know how to do that. Does anyone have any hints on how to get this going?

The system time in the device is set within a few seconds after boot with the systemd-timesyncd daemon, so the device has the correct time soon after booting up but it would be nice to have the rtc working in addition.

Thanks in advance.
mcloaked
 
Posts: 43
Joined: Thu Oct 16, 2014 4:16 pm

Re: Accessing RTC pcf8563 on the Odroid-c2?

Postby beaker » Thu Jun 09, 2016 1:36 am

I just did this on mine here's how I did it, follow instructions here:

http://odroid.com/dokuwiki/doku.php?id=en:pcf8563rtc

Difference on arch the meson64_odroidc2.dtb is in a different location, its located in /boot/dtbs

Code: Select all
# pacman -S dtc
# fdtput -t s /boot/dtbs/meson64_odroidc2.dtb /i2c@c1108500/pcf8563@51 status "okay"


Then I made sure the kernel module loaded manually

Code: Select all
# modprobe aml_i2c


Worked fine and showed with lsmod so then I created a aml_i2c.conf file at /etc/modules-load.d/aml_i2c.conf with the text "aml_i2c" without the quotes so the module will load on boot automatically. Per the arch wiki here: https://wiki.archlinux.org/index.php/Ke ... e_handling

After reboot the RTC is available via the hwclock command.

Once it rebooted I did...

Code: Select all
# hwclock --systohc --utc


That sets the hardware clock to utc based off the systemclock and then its good to go.
beaker
 
Posts: 1
Joined: Thu Jun 09, 2016 1:21 am

Re: Accessing RTC pcf8563 on the Odroid-c2?

Postby moonman » Thu Jun 09, 2016 5:52 am

Image beaker
Pogoplug V4 | GoFlex Home | Raspberry Pi B 512 | CuBox-i4 Pro | ClearFog | BeagleBone Black | Odroid U2 | Odroid C1 | Odroid XU4
-----------------------------------------------------------------------------------------------------------------------
[armv5] Updated U-Boot | |[armv5] How to install my.pogoplug.com service | [armv5] NAND Rescue System
moonman
Developer
 
Posts: 3147
Joined: Sat Jan 15, 2011 3:36 am

Re: Accessing RTC pcf8563 on the Odroid-c2?

Postby mcloaked » Thu Jun 09, 2016 9:15 am

Thank you beaker, that worked perfectly. The RTC is running flawlessly on my odroid-c2 now.
mcloaked
 
Posts: 43
Joined: Thu Oct 16, 2014 4:16 pm

Re: Accessing RTC pcf8563 on the Odroid-c2?

Postby cmsigler » Wed Jul 20, 2016 5:24 pm

Thanks for these instructions. Just right! :D For more info, here's a thread from forum.odroid.com:

http://forum.odroid.com/viewtopic.php?f=139&t=20001

But if you follow beaker's instructions you should have RTC working.

Clemmitt
- Raspberry Pi 3
- Odroid-C2
- Raspberry Pi Zero
cmsigler
 
Posts: 37
Joined: Wed May 25, 2016 6:01 pm

Re: Accessing RTC pcf8563 on the Odroid-c2?

Postby cmsigler » Tue Aug 02, 2016 12:36 pm

Hi,

I decided to try creating a libalpm hook in /usr/share/libalpm/hooks/ in order to write the needed i2c RTC info to meson64_odroidc2.dtb when the linux-odroid-c2 package is upgraded. This is what I'm using and it seems to work.

/usr/share/libalpm/hooks/99-linux-odroid-c2-install.hook:

Code: Select all
[Trigger]
Operation = Install
Operation = Upgrade
Type = Package
Target = linux-odroid-c2

[Action]
Description = Write updated i2c RTC status to meson64 .dtb
Depends = dtc
When = PostTransaction
Exec = /usr/bin/fdtput -t s /boot/dtbs/meson64_odroidc2.dtb /i2c@c1108500/pcf8563@51 status "okay"

Please post any corrections or improvements to this. HTH.

Clemmitt
- Raspberry Pi 3
- Odroid-C2
- Raspberry Pi Zero
cmsigler
 
Posts: 37
Joined: Wed May 25, 2016 6:01 pm


Return to ARMv8

Who is online

Users browsing this forum: No registered users and 2 guests