Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Pine64-R18 - Setup GPIO inputs via Device Tree

Featured Replies

Hi

 

I have been trying to allocate specific gpio's as input via the Device Tree, this ultimately being for a custom made board.

I can and have successfully allocated pins PB0, PB1, PB3 & PB5, which are showing in /dev/inputs/by-path and have been verified working with evtest.

 

Working code :-

/dts-v1/;
/plugin/;

/ {

  fragment@0 {
    target = <&pio>;
    __overlay__ {
      input_0: input_0 {
        pins = "PB0";
        function = "gpio_in";
        bias-pull-up;
      };
    };
  };

  fragment@1 {
    target-path = "/";
    __overlay__ {
      button_1 {
        compatible = "gpio-keys";
        pinctrl-names = "default";
        pinctrl-0 = <&input_0>;
        
        Button_1 {
          label = "Button_1";
          linux,code = <2>;
          gpios = <&pio 1 0 1>;
        };
      };
    };
  };
};

However, I need to use GPIO PG2, PG3 PG4 & PG5.

When changing the allocation, both 'pins = "PB0";' in fragment0 and 'gpios = <&pio 1 0 1>;' to PG2 and &pio 6 2 1, then overlay is successfully installed, but however not working.

 

/dts-v1/;
/plugin/;

/ {

  fragment@0 {
    target = <&pio>;
    __overlay__ {
      input_0: input_0 {
        pins = "PG2";
        function = "gpio_in";
        bias-pull-up;
      };
    };
  };

  fragment@1 {
    target-path = "/";
    __overlay__ {
      button_1 {
        compatible = "gpio-keys";
        pinctrl-names = "default";
        pinctrl-0 = <&input_0>;
        
        Button_1 {
          label = "Button_1";
          linux,code = <2>;
          gpios = <&pio 6 2 1>;
        };
      };
    };
  };
};

I have verified that the pins I intend to use are in fact IRQ pins, and can control the pins via sysfs, by manually exporting, setup and echo to toggle them.

I've haven't seen anything that stands out in the balance of the std Device Tree structure that might be causing this issue.

 

Any suggestions as to where else I could look into resolving this would be appreciated.

 

Regards

Gavin B

  • Author

I agree the pins are used for the WiFi module, however I do not have a physical device connected. I am in the process of trying to isolate those pins from it.

However there seems to be a different issue that's arisen with the current merges going on, in the sense that the working PB based overlay, tested in 4.14.41, causes the board to go into kernel-panic mode when the kernel starts up on any newer version, I.e 42 and 43.

I'll open a different thread for that after a bit more testing, as this can wait until we start piecing everything together in the project with it own full device-tree.

 

 

 

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.