iav Posted March 30, 2020 Share Posted March 30, 2020 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. Link to comment Share on other sites More sharing options...
Burschi500 Posted April 11, 2020 Share Posted April 11, 2020 I'm in the same boat, as it seems. Can you use your GPIO? Link to comment Share on other sites More sharing options...
martinayotte Posted April 11, 2020 Share Posted April 11, 2020 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 1 Link to comment Share on other sites More sharing options...
iav Posted April 11, 2020 Author Share Posted April 11, 2020 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 :) Link to comment Share on other sites More sharing options...
martinayotte Posted April 11, 2020 Share Posted April 11, 2020 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 1 Link to comment Share on other sites More sharing options...
iav Posted April 11, 2020 Author Share Posted April 11, 2020 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? Link to comment Share on other sites More sharing options...
martinayotte Posted April 11, 2020 Share Posted April 11, 2020 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 ... 1 Link to comment Share on other sites More sharing options...
iav Posted April 26, 2020 Author Share Posted April 26, 2020 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? Link to comment Share on other sites More sharing options...
martinayotte Posted April 26, 2020 Share Posted April 26, 2020 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 ! Link to comment Share on other sites More sharing options...
iav Posted April 26, 2020 Author Share Posted April 26, 2020 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. Link to comment Share on other sites More sharing options...
opfer15 Posted May 22, 2020 Share Posted May 22, 2020 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 Link to comment Share on other sites More sharing options...
iav Posted August 7, 2020 Author Share Posted August 7, 2020 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. Link to comment Share on other sites More sharing options...
iav Posted September 10, 2020 Author Share Posted September 10, 2020 Now i2c3 in armbian patches https://github.com/armbian/build/blob/master/patch/kernel/meson64-current/hardkernel-0007-N2-ARM64-dts-add-i2c2-i2c3-node.patch Link to comment Share on other sites More sharing options...
Solution iav Posted October 25, 2020 Author Solution Share Posted October 25, 2020 Now RTC patch for N2 in armbian build system. Hope problem is solved. 1 Link to comment Share on other sites More sharing options...
opfer15 Posted November 12, 2020 Share Posted November 12, 2020 Reporting back Working out of the box now with latest focal image. Thanks for the effort 1 Link to comment Share on other sites More sharing options...
Recommended Posts