2 2
Burschi500

Odroid N2 - No RTC and GPIO not working

Recommended Posts

Armbianmonitor:

Good morning,

 

after some time using armbian on my OdroidN2 with great success (got Nextcloud with working Talk installed, external USB, Minecraft server, nginx, LetsEncrypt, Netdata...) I encountered some problems I am not able to solve by myself:

I bought a RTC battery and a LED power button to "finalize" my Odroid (hardwarewise), and to my surprise both did not work as expected. 

 

RTC:

 It says:

chris@OdroidN2:~$ sudo hwclock
hwclock: select() to /dev/rtc0 to wait for clock tick timed out
cat /proc/interrupts |grep rtc

...gives me also no return (empty string), so i guess there is a module missing in the kernel :

chris@OdroidN2:~$ uname -a
Linux OdroidN2 5.4.28-meson64 #20.02.8 SMP PREEMPT Mon Mar 30 09:12:52 CEST 2020 aarch64 aarch64 aarch64 GNU/Linux

There is a post on RTC here in the forums which looks like my problem, its here. Maybe it is the same problem?

 

Next problem is GPIO:

As mentioned above i tried to install a LED power button, and used this to set it up. I got the LED working as expected (Pin 1 and 6), but the power on-off is not working (Pin 9 and 11). The button i purchased is a NO-switch, and after checking the correct wiring i also tested the button for funcion. Everything is fine according to the multimeter. After some reading i tested for working GPIO (installed wiringpi with this instruction), and it looks like this is the problem:

chris@OdroidN2:~$ sudo gpio readall
No "Hardware" linechris@OdroidN2:~$

 

It looks to me as there is also some module missing or am i wrong? I also have no i2c bus, in /dev/ there is only i2c-0.

 

Now - what is wrong and what can i do about it? Is there information missing i should provide to solve my problem?

Share this post


Link to post
Share on other sites
Armbian is a community driven open source project. Do you like to contribute your code?
11 hours ago, Burschi500 said:

I also have no i2c bus, in /dev/ there is only i2c-0.

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

Thank you very much,

I used your instructions from over there, and it works (i got warnings but i guess these are ok)! Do I have to issue these commands at every boot, or is it "done" now? I read here that you have to put something in config.txt which might translate to boot.ini?

 

Any chance that i can get the GPIO working in a similar manner?

Share this post


Link to post
Share on other sites
8 hours ago, Burschi500 said:

Do I have to issue these commands at every boot

To load the overlay ? Yes, it requires to be loaded at every boot, for example thru calls from /etc/rc.local, or using useroverlays variable in /boot/armbianEnv.txt.

8 hours ago, Burschi500 said:

Any chance that i can get the GPIO working in a similar manner?

I don't know, I've not used the WiringPi mentioned above, but you can try using sysfs gpio.

 

EDIT: Something looks a bit fishy : I've not been able to make gpio sysfs working ...

Share this post


Link to post
Share on other sites

Actually i don't want to program with WiringPi, i just want to use the hardwarepins for a hardwarebutton. WiringPi and gpio readall was just a test if basic functionality is present (which is not). But as your EDIT says there might be a different problem than in WiringPi. It does not break Armbian on OdroidN2 for me, but ... i just want to have this shiny button working and not just shining :).

Share this post


Link to post
Share on other sites
On 4/13/2020 at 4:24 AM, Burschi500 said:

But as your EDIT says there might be a different problem than in WiringPi

I've decided to take a look at the WiringPi issue, and I figured out that "cat /proc/cpuinfo" doesn't give same output under Armbian that WiringPi is expecting with HardKernel version.

But I figured out to comment out all the Hardware/Revision parsing of /proc/cpuinfo, and hard coded the the result as a OdroidN2 board, and the rest of the library is working fine.

I didn't the same with WiringPi python wrapper too ...

 

This is the recipe :

 

Comment out those lines : https://github.com/hardkernel/wiringPi/blob/master/wiringPi/wiringPi.c#L328-L449

and hardcode the following, just after the commenting :

               libwiring.model = MODEL_ODROID_N2;
               libwiring.maker = MAKER_AMLOGIC;
               libwiring.mem   = 4;
               libwiring.rev   = 1;

 

EDIT: Now, I will go back to gpio sysfs issue, but there is less hurry ...

Share this post


Link to post
Share on other sites

Thanks for your effort.

 

I fear that i need more detailed instructions. Can you give me the command set i must use or a direction where to look?

Share this post


Link to post
Share on other sites
7 hours ago, Burschi500 said:

I fear that i need more detailed instructions. Can you give me the command set i must use or a direction where to look?

As I said, after doing "git clone", simply commenting the whole detection code from line 328 to 449, and then hardcode the OdroidN2 definition mentioned above, then compile the library ...

Share this post


Link to post
Share on other sites

Just noticed that an update for wiringpi was available - thank you - gpio readall is now working as expected as i get the table the link was referring to. Unfortunately the powerbutton is still not working when using the lines given above in boot.ini. I tested the same with a kernel from hardkernel (which i tried because my trial to move the system to ssd failed miserably) and there the button worked as expected. I guess it is still an issue of the kernel?

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