2 2
iav

ODroid-N2 RTC not work in linux-image-current-meson64=20.02.8 5.4.28-meson64

Recommended Posts

I use image linux-image-current-meson64=20.02.8 5.4.28-meson64, kernel set by apt upgrade

RTC battery connected. Try to perform setup by instruction

seems nwclock can't work:


 

lsmod|grep rtc
rtc_meson_vrtc         20480  1


ls -l /dev/rt*
lrwxrwxrwx 1 root root      4 Mar 30 18:28 /dev/rtc -> rtc0
crw------- 1 root root 252, 0 Mar 30 18:28 /dev/rtc0


 hwclock
hwclock: select() to /dev/rtc0 to wait for clock tick timed out
root@droid:~# hwclock -w
hwclock: ioctl(RTC_SET_TIME) to /dev/rtc0 to set the time failed: Invalid argument

How to set hardware clock correctly?

 

 

Previously I use earlier ubuntu-based armbian kernel 4.* on same device, and hardware clock woks. It brokes after swtching to a new image with new kernel.

 

Share this post


Link to post
Share on other sites
Want Armbian t-shirt or a cup?

On 3/30/2020 at 12:19 PM, iav said:

How to set hardware clock correctly?

Odroid-N2 external RTC is attached on I2C3 which isn't enabled by default.

To enable it, use this overlay source and compile it and load it.

/dts-v1/;
/plugin/;

/ {
    compatible = "amlogic,meson-g12b";
    fragment@0 {
        target-path = "/aliases";
        __overlay__ {
            i2c3a = "/soc/bus@ffd00000/i2c@1c000";
        };
    };
    fragment@1 {
        target-path = "/soc/bus@ffd00000/i2c@1c000";
        __overlay__ {
            status = "okay";
            pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>;
            pinctrl-names = "default";
            pcf8563: rtc@51 { /*I2C-bus slave address: read A3h and write A2h*/
		compatible = "nxp,pcf8563";
		reg = <0x51>;
            };
        };
    };
};

Then, the i2c will appear as well as module for PCF8563 will be loaded, it will be hookup as /dev/rtc1, you can then set the clock and re-read it using :

hwclock -w -f /dev/rtc1
hwclock -f /dev/rtc1

 

Share this post


Link to post
Share on other sites
1 hour ago, martinayotte said:

Odroid-N2 external RTC is attached on I2C3 which isn't enabled by default.

To enable it, use this overlay source and compile it and load it.


/dts-v1/;
/plugin/;

/ {
    compatible = "amlogic,meson-g12b";
    fragment@0 {
        target-path = "/aliases";
        __overlay__ {
            i2c3a = "/soc/bus@ffd00000/i2c@1c000";
        };
    };
    fragment@1 {
        target-path = "/soc/bus@ffd00000/i2c@1c000";
        __overlay__ {
            status = "okay";
            pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>;
            pinctrl-names = "default";
            pcf8563: rtc@51 { /*I2C-bus slave address: read A3h and write A2h*/
		compatible = "nxp,pcf8563";
		reg = <0x51>;
            };
        };
    };
};

en, the i2c will appear as well as module for PCF8563 will be loaded, it will be hookup as /dev/rtc1, you can then set the clock and re-read it using :


hwclock -w -f /dev/rtc1
hwclock -f /dev/rtc1

 

Thank you for help.

Could you please point to faq, howto or something like it to read how to "use this overlay source and compile it and load it"? Sorry, I am not "in context" for a while. But I will :)

Share this post


Link to post
Share on other sites
8 minutes ago, iav said:

read how to "use this overlay source and compile it and load it"?

Install DT compiler from http://ftp.debian.org/debian/pool/main/d/device-tree-compiler/device-tree-compiler_1.4.7-3_arm64.deb

Then, compile the DTS I've provided and then load it dynamically :

dtc -@ -I dts -O dtb -o odroid-n2-ic2@1c000.dtbo odroid-n2-ic2@1c000.dts
mkdir /sys/kernel/config/device-tree/overlays/i2c3a
cat odroid-n2-ic2@1c000.dtbo > /sys/kernel/config/device-tree/overlays/i2c3a/dtbo

 

Share this post


Link to post
Share on other sites
31 minutes ago, martinayotte said:

Install DT compiler from http://ftp.debian.org/debian/pool/main/d/device-tree-compiler/device-tree-compiler_1.4.7-3_arm64.deb

Then, compile the DTS I've provided and then load it dynamically :


dtc -@ -I dts -O dtb -o odroid-n2-ic2@1c000.dtbo odroid-n2-ic2@1c000.dts
mkdir /sys/kernel/config/device-tree/overlays/i2c3a
cat odroid-n2-ic2@1c000.dtbo > /sys/kernel/config/device-tree/overlays/i2c3a/dtbo

 

It works!

Thank you!

 

Do you think I have to ask armbian kernel builders to include your code into kernel image?

Share this post


Link to post
Share on other sites
2 hours ago, iav said:

Do you think I have to ask armbian kernel builders to include your code into kernel image?

I'm one of the main Armbian devs, so, yes, I will add the DT overlay in builds in the near future ...

Share this post


Link to post
Share on other sites
On 4/12/2020 at 2:59 AM, martinayotte said:

I'm one of the main Armbian devs, so, yes, I will add the DT overlay in builds in the near future ...

What kernel  I have to install to got it work?

linux-image-current, -dev, -legacy, other sources?

Share this post


Link to post
Share on other sites
39 minutes ago, iav said:

What kernel  I have to install to got it work?

I've not done the commit yet, "time is the missing ingredient" ...

But feel free to compile above DT overlay !

Share this post


Link to post
Share on other sites
30 minutes ago, martinayotte said:

I've not done the commit yet, "time is the missing ingredient" ...

But feel free to compile above DT overlay !

yes, I did it already... but I not understand how to avoid manual path creation and dt copying with manual hwclock run. To let it work as it should — set system clock at a boot time.

Share this post


Link to post
Share on other sites

Alan in Sydney, Australia.

I've loaded: eoan desktop, Linux aml 5.5.0-rc6-aml-s9xxx #rc1.038 SMP PREEMPT Thu Feb 6 10:21:51 MSK 2020

from the 20200205.zip file and upgraded. 

root# mkdir -p /sys/kernel/config/device-tree/overlays/i2c3a 

cannot create directory ‘/sys/kernel/config/device-tree’: Operation not permitted

 

What am I trying to do?

On an Odroid N2 compile with GCC 10 (from Fedora) "neural networks" code (FreeDV) using the ARMv8 SVE extensions.

(Odroid N2 is not supported on Fedora) 

Share this post


Link to post
Share on other sites
5 hours ago, AlanB said:

Alan in Sydney, Australia.

 

Hi Alan and welcome.

 

6 hours ago, AlanB said:

I've loaded: eoan desktop, Linux aml 5.5.0-rc6-aml-s9xxx #rc1.038 SMP PREEMPT Thu Feb 6 10:21:51 MSK 2020


You are using some unofficial Armbian with EOL kernel without any support ...
https://www.armbian.com/download/?device_support=Supported

https://docs.armbian.com/User-Guide_Getting-Started/#how-to-check-download-authenticity
 

5 hours ago, AlanB said:

Odroid N2 is not supported on Fedora

 

That is expected. All those devices needs some work to be ready for end users and upstream distributions, some never are. For them (mainstream distributions), unique upstream mainline kernel must cover all functions, or they don't "support it".

 

We have two kernels. Stock 4.9.y, which is in a good state, but obviously old and 5.4.y which is best possible modern one. All (most) functionalities from old (a lot of work) and more recent kernels are regularly ported into it but still not everything is working alright. Running kernel 5.5 or 5.7 on this devices is pointless (we are preparing 5.6.y which is a bit further than 5.4.y but still its a development kernel, no end user support attached to it - too expensive). Anything else than this is fragile kernel with no support. You might find some Arch / Manjaro, but this is exactly on the same level as "eoan desktop linux amp 5.5.0-rc6", something from scrapyard. We stay on LTS kernel and port newly developed functions for particular hardware platform.

 

Your first step is to download official builds. This way you can count on some hints, but if something serious doesn't work but you must have it, it is your cost.

Share this post


Link to post
Share on other sites
On 4/12/2020 at 1:59 AM, martinayotte said:

I'm one of the main Armbian devs, so, yes, I will add the DT overlay in builds in the near future ...

  

On 4/12/2020 at 1:59 AM, martinayotte said:

I'm one of the main Armbian devs, so, yes, I will add the DT overlay in builds in the near future ...

Hi martinayotte,

 

thanks for providing quick fix via device tree overlay. Also i am very happy to see we got Armbian and a much more recent kernel running on HK Odroid N2! Thx for all your hard work!

 

Do we lack full support for overlays atm? Even if we do as described for allwiner based boards?

'Cause i tried to use "user_overlays" and "overlay" options in "ArmbianEnv.txt" as described here:

https://docs.armbian.com/Hardware_Allwinner_overlays/

but couldn't get it to work.

Just wanna know if i am missing something/ doing it wrong or It's known/intended

 

/boot/armbianEnv.txt

verbosity=1
user_overlays=odroid-n2-ic2@1c000
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u <= AutoAdded so file seems to be found

adding the entries and copying the files myself didn't change anything.

adding useroverlay via armbian-add-overlay  => Overlays are supported only on A10... => Removing the allwiner sanity check from

/usr/sbin/armbian-add-overlay line 38-41

edits armbianEnv.txt correctly by adding "user_overlays" option and copying the files to "/boot/overlay-user/" which seems be the desired location. But no pcf8563 modules are loaded after boot. 

I also tried adding the dtbo to /boot/dtb/overlay /boot/dtb/amlogic/overlays and so on.

 

Your mentioned example rc.local works fine instead.

mkdir /sys/kernel/config/device-tree/overlays/i2c3a
cat /root/odroid-n2-ic2@1c000.dtbo > /sys/kernel/config/device-tree/overlays/i2c3a/dtbo

systemctl stop ntp
ntpd -qg
systemctl start ntp
hwclock --systohc -f /dev/rtc1

 

TIA

Share this post


Link to post
Share on other sites
On 4/26/2020 at 11:47 PM, martinayotte said:

I've not done the commit yet, "time is the missing ingredient" ...

But feel free to compile above DT overlay !

@martinayotte pleeease.

so long present, but not in armbian trunk.

@chewitt have same patches too, but not push.

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
2 2