Jump to content

Control a relay by Orange PI with Armbian


aoleynik

Recommended Posts

Hello, I'm trying to control a relay (Bigtreetech Relay) by Orange PI 3 with Armbian 22.08.8 Jammy on it: the relay should be active as soon as PI started and deactivated on PI shutdown.

 

As result I got the following device-tree overlay: 

 

/dts-v1/;
/plugin/;

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

	fragment@0 {
		target = <&r_pio>;
		__overlay__ {
			poweroff_pins:poweroff_pins {
				allwinner,pins = "PL2";
				allwinner,function = "gpio_out";
			};
		};
	};

	fragment@1 {
		target-path = "/";
        	__overlay__ {
            		poweroff: poweroff {
				compatible = "gpio-poweroff";
				gpios = <&pio 11 2 1>;
 			};
    		};
	};
};

 

It has been successfully compiled and added to the system, but it does not work as expected: there is no voltage on PL2 pin.

What I'm doing wrong?
 

orangepi3-lts:~:% ls /proc/device-tree/soc/pinctrl@7022000/poweroff_pins/
allwinner,function  allwinner,pins  name  phandle

 

orangepi3-lts:~:% sudo cat /sys/kernel/debug/gpio
gpiochip1: GPIOs 0-255, parent: platform/300b000.pinctrl, 300b000.pinctrl:
 gpio-79  (                    |usb0_id_det         ) in  hi
 gpio-102 (                    |gmac-3v3            ) out hi
 gpio-110 (                    |snps,reset          ) out hi ACTIVE LOW
 gpio-111 (                    |dc                  ) out hi
 gpio-112 (                    |reset               ) out hi ACTIVE LOW
 gpio-166 (                    |cd                  ) in  hi IRQ ACTIVE LOW
 gpio-226 (                    |ddc-en              ) out hi
 gpio-227 (                    |spi0 CS0            ) out hi ACTIVE LOW
 gpio-231 (                    |vcc33-wifi          ) out hi

gpiochip0: GPIOs 352-415, parent: platform/7022000.pinctrl, 7022000.pinctrl:
 gpio-356 (                    |red-led             ) out lo
 gpio-359 (                    |green-led           ) out hi
 gpio-360 (                    |spi0 CS1            ) out hi ACTIVE LOW
 gpio-362 (                    |ads7846_pendown     ) in  hi IRQ
 gpio-387 (                    |reset               ) out hi ACTIVE LOW

 

orangepi3-lts:~:% gpio readall
 +------+-----+----------+------+---+   OPi 3  +---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 |      |     |     3.3V |      |   |  1 || 2  |   |      | 5V       |     |      |
 |  122 |   0 |    SDA.0 |  OFF | 0 |  3 || 4  |   |      | 5V       |     |      |
 |  121 |   1 |    SCL.0 |  OFF | 0 |  5 || 6  |   |      | GND      |     |      |
 |  118 |   2 |    PWM.0 |  OFF | 0 |  7 || 8  | 0 | OFF  | PL02     | 3   | 354  |
 |      |     |      GND |      |   |  9 || 10 | 0 | OFF  | PL03     | 4   | 355  |
 |  120 |   5 |    RXD.3 | ALT4 | 0 | 11 || 12 | 0 | OFF  | PD18     | 6   | 114  |
 |  119 |   7 |    TXD.3 | ALT4 | 0 | 13 || 14 |   |      | GND      |     |      |
 |  362 |   8 |     PL10 | ALT6 | 1 | 15 || 16 | 1 | OUT  | PD15     | 9   | 111  |
 |      |     |     3.3V |      |   | 17 || 18 | 1 | OUT  | PD16     | 10  | 112  |
 |  229 |  11 |   MOSI.1 | ALT2 | 0 | 19 || 20 |   |      | GND      |     |      |
 |  230 |  12 |   MISO.1 | ALT2 | 0 | 21 || 22 | 0 | OFF  | PD21     | 13  | 117  |
 |  228 |  14 |   SCLK.1 | ALT2 | 0 | 23 || 24 | 1 | OUT  | CE.1     | 15  | 227  |
 |      |     |      GND |      |   | 25 || 26 | 1 | OUT  | PL08     | 16  | 360  |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+   OPi 3  +---+------+----------+-----+------+

 

Edited by aoleynik
Link to comment
Share on other sites

  • aoleynik changed the title to Control a relay by Orange PI with Armbian

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