Problems with PCF8563 RTC Module on C2/modprobe errors

Post Reply
graysky
Posts: 168
Joined: Wed Jul 13, 2016 9:11 am
languages_spoken: english
ODROIDs: C2
Has thanked: 1 time
Been thanked: 0
Contact:

Problems with PCF8563 RTC Module on C2/modprobe errors

Post by graysky »

I purchased a RTC shield for my ODROID-C2. The system run Arch ARM (current kernel version is 3.16.61). When I try to manually load the requisite aml_i2c module, dmesg gets populated with some errors:

Code: Select all

% sudo modprobe aml_i2c
% dmesg
...
[  +5.410385] aml_i2c version: 20140813
[  +0.011234] rtc-pcf8563 1-0051: chip found, driver version 0.4.3
[  +0.001690] rtc-pcf8563 1-0051: rtc core: registered rtc-pcf8563 as rtc0
[  +0.005707] aml-i2c c1108500.i2c: add adapter aml_i2c_adap1(ffffffc059c4e0e0)
[  +0.019613] sx865x 2-0049: sx865x_probe()
[  +0.002440] sx865x 2-0049: swap_xy (1)
[  +0.000245] sx865x 2-0049: invert_x (0)
[  +0.003419] sx865x 2-0049: invert_y (1)
[  +0.003794] sx865x 2-0049: gpio pendown (218)
[  +0.004728] sx865x 2-0049: gpio reset (224)
[  +0.003798] sx865x 2-0049: gpio irq (96)
[  +0.003969] i2c i2c-2: [aml_i2c_xfer] error ret = -5 (-EIO)
[  +0.005354] i2c i2c-2: token 1, master_no(2) 300K addr 0x49
[  +0.005667] i2c i2c-2: [aml_i2c_xfer] error ret = -5 (-EIO)
[  +0.005371] i2c i2c-2: token 1, master_no(2) 300K addr 0x49
[  +0.005638] i2c i2c-2: [aml_i2c_xfer] error ret = -5 (-EIO)
[  +0.005402] i2c i2c-2: token 1, master_no(2) 300K addr 0x49
[  +0.005636] i2c i2c-2: [aml_i2c_xfer] error ret = -5 (-EIO)
[  +0.005405] i2c i2c-2: token 1, master_no(2) 300K addr 0x49
[  +0.005626] i2c i2c-2: [aml_i2c_xfer] error ret = -5 (-EIO)
[  +0.005451] i2c i2c-2: token 1, master_no(2) 300K addr 0x49
[  +0.005551] i2c i2c-2: [aml_i2c_xfer] error ret = -5 (-EIO)
[  +0.005476] i2c i2c-2: token 1, master_no(2) 300K addr 0x49
[  +0.005518] sx865x: probe of 2-0049 failed with error -5
[  +0.005291] aml-i2c c11087c0.i2c: add adapter aml_i2c_adap2(ffffffc059c4c0e0)
lsmod shows they are loaded despite these errors but I'm thinking this isn't normal.

Code: Select all

% lsmod | grep -i 'i2c\|rtc'
rtc_pcf8563             4380  0
aml_i2c                17967  0
What's worse is that the module is not auto loaded... I created /etc/modprobe.d/99-load.conf which simply contains a single line:

Code: Select all

% cat /etc/modprobe.d/99-load.conf 
aml_i2c
When I reboot the machine, these modules are not loaded. When I try to manually load them, I get this error:

Code: Select all

% sudo modprobe aml_i2c
libkmod: kmod_config_parse: /etc/modprobe.d/99-load.conf line 1: ignoring bad line starting with 'aml_i2c'
If I include the aml_i2c module in the MODULES array of /etc/mkinitcpio.conf and regenerate the image, it does load on boot but is seemly non-functional. I cannot call hwclock despite it being loaded:

Code: Select all

% sudo hwclock --systohc --utc
hwclock: Cannot access the Hardware Clock via any known method.
hwclock: Use the --verbose option to see the details of our search for an access method.
Battery is fully charged (also tried another one) and I believe I have it installed correctly. Any thoughts are appreciated.
Image

User avatar
odroid
Site Admin
Posts: 42937
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 3873 times
Been thanked: 2212 times
Contact:

Re: Problems with PCF8563 RTC Module on C2/modprobe errors

Post by odroid »

Did you configure the device-tree file?
But, I'm not sure whether this Ubuntu/Debian instruction can be applied to Arch or not.
https://wiki.odroid.com/accessory/add-o ... rtc_shield

graysky
Posts: 168
Joined: Wed Jul 13, 2016 9:11 am
languages_spoken: english
ODROIDs: C2
Has thanked: 1 time
Been thanked: 0
Contact:

Re: Problems with PCF8563 RTC Module on C2/modprobe errors

Post by graysky »

@odroid - I'm not sure what package Arch has that would provide the device-tree step... any info?

User avatar
odroid
Site Admin
Posts: 42937
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 3873 times
Been thanked: 2212 times
Contact:

Re: Problems with PCF8563 RTC Module on C2/modprobe errors

Post by odroid »

No. I have no experience of using Arch.

graysky
Posts: 168
Joined: Wed Jul 13, 2016 9:11 am
languages_spoken: english
ODROIDs: C2
Has thanked: 1 time
Been thanked: 0
Contact:

Re: Problems with PCF8563 RTC Module on C2/modprobe errors

Post by graysky »

OK... I had it all along:

Code: Select all

% pacman -Qo fdtput
/usr/bin/fdtput is owned by dtc 1.4.7-1
And I did run the command:

Code: Select all

# fdtput -t s /boot/dtbs/meson64_odroidc2.dtb /i2c@c1108500/pcf8563@51 status "okay"

graysky
Posts: 168
Joined: Wed Jul 13, 2016 9:11 am
languages_spoken: english
ODROIDs: C2
Has thanked: 1 time
Been thanked: 0
Contact:

Re: Problems with PCF8563 RTC Module on C2/modprobe errors

Post by graysky »

@odroid - I removed the RTC shield and rebooted into 3.16.61, then I executed the manual modprobe command and got the same result.

Code: Select all

% sudo modprobe aml_i2c
% dmesg
...
[Dec19 20:39] aml_i2c version: 20140813
[  +0.000804] aml-i2c c1108500.i2c: add adapter aml_i2c_adap1(ffffffc05a3320e0)
[  +0.012562] sx865x 2-0049: sx865x_probe()
[  +0.002259] sx865x 2-0049: swap_xy (1)
[  +0.000151] sx865x 2-0049: invert_x (0)
[  +0.003632] sx865x 2-0049: invert_y (1)
[  +0.003918] sx865x 2-0049: gpio pendown (218)
[  +0.004159] sx865x 2-0049: gpio reset (224)
[  +0.004131] sx865x 2-0049: gpio irq (96)
[  +0.004058] i2c i2c-2: [aml_i2c_xfer] error ret = -5 (-EIO)
[  +0.005348] i2c i2c-2: token 1, master_no(2) 300K addr 0x49
[  +0.005678] i2c i2c-2: [aml_i2c_xfer] error ret = -5 (-EIO)
[  +0.005361] i2c i2c-2: token 1, master_no(2) 300K addr 0x49
[  +0.005714] i2c i2c-2: [aml_i2c_xfer] error ret = -5 (-EIO)
[  +0.005384] i2c i2c-2: token 1, master_no(2) 300K addr 0x49
[  +0.005539] i2c i2c-2: [aml_i2c_xfer] error ret = -5 (-EIO)
[  +0.005497] i2c i2c-2: token 1, master_no(2) 300K addr 0x49
[  +0.005545] i2c i2c-2: [aml_i2c_xfer] error ret = -5 (-EIO)
[  +0.005596] i2c i2c-2: token 1, master_no(2) 300K addr 0x49
[  +0.005551] i2c i2c-2: [aml_i2c_xfer] error ret = -5 (-EIO)
[  +0.005366] i2c i2c-2: token 1, master_no(2) 300K addr 0x49
[  +0.005509] sx865x: probe of 2-0049 failed with error -5
[  +0.005301] aml-i2c c11087c0.i2c: add adapter aml_i2c_adap2(ffffffc059a878e0)
So loading the module even without the hardware installed gives these errors. Does that mean there is something wrong with module code itself or something on my ODROID-C2 that is damaged?
Last edited by graysky on Sat Dec 22, 2018 9:36 pm, edited 1 time in total.

User avatar
odroid
Site Admin
Posts: 42937
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 3873 times
Been thanked: 2212 times
Contact:

Re: Problems with PCF8563 RTC Module on C2/modprobe errors

Post by odroid »

Add "sx865x" driver in to the blacklist to remove the error message. That driver should be used with our 3.5inch LCD shield.

Check i2cdetect -y -r 1 and i2cdetect -y -r 2 outputs first.

I will try to help you next week since it is already Friday 10:00 PM in Korea.

graysky
Posts: 168
Joined: Wed Jul 13, 2016 9:11 am
languages_spoken: english
ODROIDs: C2
Has thanked: 1 time
Been thanked: 0
Contact:

Re: Problems with PCF8563 RTC Module on C2/modprobe errors

Post by graysky »

@odroid - Thanks for the help. I created the blacklist file:

Code: Select all

% cat /etc/modprobe.d/blacklist.conf 
blacklist sx865x
The output of the two i2cdetect commands:

Code: Select all

# i2cdetect -y -r 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- 51 -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --

# i2cdetect -y -r 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --
Have a good weekend!

graysky
Posts: 168
Joined: Wed Jul 13, 2016 9:11 am
languages_spoken: english
ODROIDs: C2
Has thanked: 1 time
Been thanked: 0
Contact:

Re: Problems with PCF8563 RTC Module on C2/modprobe errors

Post by graysky »

I think I got it working. The solution seems to be blacklisting the sx865x module. Once I did that, everything worked as expected.

I made a simple Makefile providing a pacman hook for updating the i2c RTC status on kernel updates (credit to cmsigler from this thread), blacklist file, and a simple systemd service to load the time from the RTC to sysclock on boot.

The initial setup shown at this link is automated when the user install the package thanks to a this little pacman scriplet that will run post install.

Upstream code: https://github.com/graysky2/odroid-c2-rtc
AUR package: https://aur.archlinux.org/packages/odroid-c2-rtc

... so why does the sx865x module mess up everything and why is it getting called to load?

User avatar
odroid
Site Admin
Posts: 42937
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean
ODROIDs: ODROID
Has thanked: 3873 times
Been thanked: 2212 times
Contact:

Re: Problems with PCF8563 RTC Module on C2/modprobe errors

Post by odroid »

Glad to hear you made it work.

I think a device-tree configuration might force to load the sx865x driver.

graysky
Posts: 168
Joined: Wed Jul 13, 2016 9:11 am
languages_spoken: english
ODROIDs: C2
Has thanked: 1 time
Been thanked: 0
Contact:

Re: Problems with PCF8563 RTC Module on C2/modprobe errors

Post by graysky »

I'm happy with the blacklist solution, but if there is a way I can fix the behavior of the modprobing pulling in the sx865x modules too, I ould like to try.

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 1 guest