User VIM3 Android GPIO to control relay

Which Khadas SBC do you use?

VIM3 Pro

Which system do you use? Android, Ubuntu, OOWOW or others?

Android 9

Which version of system do you use? Khadas official images, self built images, or others?

Khadas Official image VIM3_Pie_V211220

Please describe your issue below:

Hi, I need to use GPIO pin to control 3.3V-DC relay, I want to use GPIOH_8 to send HIGH/LOW level voltage to relay.
Where is GPIOH_8 on real VIM3 device?
I need to use GPIOH_8 because it not used by other functions.
Or I can use other GPIO Pin?
**Note: Previously on VIM1 I use GPIOH_5 to control the relay.
According to this document, I found that GPIOH_8 is available for use.
[https://dl.khadas.com/products/vim3/datasheet/a311d_datasheet_04_wesion.pdf]

image

Relay image

Post a console log of your issue below:

Full command that I used

% adb shell
kvim3:/ $ cat /sys/kernel/debug/pinctrl/pinctrl@ff634480/gpio-ranges
GPIO ranges handled:
0: periphs-banks GPIOS [410 - 495] PINS [0 - 85]

kvim3:/ $ cat /sys/kernel/debug/pinctrl/pinctrl@ff634480/pins
registered pins: 86
...
pin 20 (GPIOH_3)  pinctrl@ff634480
pin 21 (GPIOH_4)  pinctrl@ff634480
pin 22 (GPIOH_5)  pinctrl@ff634480
pin 23 (GPIOH_6)  pinctrl@ff634480
pin 24 (GPIOH_7)  pinctrl@ff634480
pin 25 (GPIOH_8)  pinctrl@ff634480
...

Hi all,
I got answer my self, I use GPIOH_4 to control relay.
I use followings command

 % adb shell
kvim3:/ $ cat /sys/kernel/debug/pinctrl/pinctrl@ff634480/gpio-ranges
GPIO ranges handled:
0: periphs-banks GPIOS [410 - 495] PINS [0 - 85]

kvim3:/ $ cat /sys/kernel/debug/pinctrl/pinctrl@ff634480/pins
registered pins: 86
...
pin 20 (GPIOH_3)  pinctrl@ff634480
pin 21 (GPIOH_4)  pinctrl@ff634480
pin 22 (GPIOH_5)  pinctrl@ff634480
pin 23 (GPIOH_6)  pinctrl@ff634480
pin 24 (GPIOH_7)  pinctrl@ff634480
pin 25 (GPIOH_8)  pinctrl@ff634480
...
kvim3:/ $ su
kvim3:/ # echo 431 > /sys/class/gpio/export
kvim3:/ # echo out > /sys/class/gpio/gpio431/direction
kvim3:/ # echo 1 > /sys/class/gpio/gpio431/value
kvim3:/ # echo 0 > /sys/class/gpio/gpio431/value

My case GPIOH_4 number is 410 + 21 = 431

@pinij

For the usage of GPIO, refer to the following documents