Jump to content

Recommended Posts

Posted

Hello,

im trying to map the i2c-2 to some GPIO ports and have to rewrite the device-tree on armbian 22.04.
I'm failing miserably and have no idea how-to do it. I managed to compile the i2c-gpio.ko kernel module as it is not part of the armbian 5.15.89-sunxi kernel.

However, here i'm stuck and cant manage to make it happen.

 

On RPi it was simple adding an overlay to config.txt:

    dtoverlay=i2c-gpio,bus=2,i2c_gpio_sda=27,i2c_gpio_scl=17
    /boot/overlays/i2c-gpio.dtbo  


I'm trying to replicate that for Armbian, here is my dts file:

 

	// Overlay for i2c_gpio bitbanging host bus.
    /dts-v1/;
    /plugin/;
    / {
        compatible = "allwinner,sun8i-h3";
        fragment@0 {
            target-path = "/";
            __overlay__ {
                i2c_gpio: i2c@2 {
                    reg = <0>;
                    compatible = "i2c-gpio";
                    gpios = <&pio 17 0     /* sda */
                         &pio 27 0    /* scl */
                    >;    
                    i2c-gpio,delay-us = <2>;
                    #address-cells = <1>;
                    #size-cells = <0>;
                };
            };
        };
        fragment@1 {
            target-path = "/aliases";
            __overlay__ {
                i2c_gpio = "/i2c@2";
            };
        };
        fragment@2 {
            target-path = "/__symbols__";
            __overlay__ {
                i2c_gpio = "/i2c@2";
            };
        };
        __overrides__ {
            i2c_gpio_sda = <&i2c_gpio>,"gpios:4";
            i2c_gpio_scl = <&i2c_gpio>,"gpios:16";
            i2c_gpio_delay_us = <&i2c_gpio>,"i2c-gpio,delay-us:0";
            bus = <&i2c_gpio>, "reg:0";
        };
    };

 

What am I doing wrong?

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...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines