Jump to content

Activation of GPIO pins using overlays


aknigin

Recommended Posts

Hello there. I'm trying to set up GPIO pins PD15 and PD16 on my OrangePi 3 LTS to work as input pins using device tree overlays. The overlay I have created is the following (for PD15 only):

 

/dts-v1/;
/plugin/;

/ {
	compatible = "allwinner,sun50i-h6";	

	fragment@0 {
		target = <&pio>;

		__overlay__ {
			my_pins:my_pins {
				pins = "PD15";
				function = "gpio_in";
				default-state = "on";
			};
		};
	};
	
	fragment@1 {
		target-path = "/";
		__overlay__ {
			my@0 {
				compatible = "my-gpio";
				pinctrl-names = "default";
				pinctrl-0 = <&my_pins>;
				gpios = <&pio 3 15 0>;
				status = "okay";
			};
		};
	};	
};

Probably it is incorrect, because when I check the GPIO state using "gpio readall" command, I still get OFF state for the PD15 pin. Of course, I could change the pin mode using the "gpio" command itself (it does work, like "gpio mode 9 in" does set the PD15 pin mode to input), but I would prefer the overlays method.

Link to comment
Share on other sites

Armbian & Khadas are rewarding contributors

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