How enable GPIO on VIM3?

Which Khadas SBC do you use?

VIM3

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

debian

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

Distributor ID: Debian
Description: Armbian 23.11.1 bookworm
Release: 12
Codename: bookworm
Linux 6.1.63-current-meson64 aarch64

Please describe your issue below:

i try to control GPIO with commands:

echo 431 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio431/direction
echo 1 > /sys/class/gpio/gpio431/value

i see that GPIO changes state at least on software side. But not on hardware side. Is it not configured? How to configure and enable it? Maybe /boot/armbianEnv.txt needs to be edited? Have no idea what and how after extensive googling :slight_smile:

Post a console log of your issue below:


root@baffless:~# echo 1 > /sys/class/gpio/gpio431/value
root@baffless:~# cat /sys/kernel/debug/gpio
gpiochip2: GPIOs 404-411, parent: i2c/0-0020, 0-0020, can sleep:
 gpio-409 (                    |red:status          ) out lo 

gpiochip1: GPIOs 412-426, parent: platform/ff800000.sys-ctrl:pinctrl@14, aobus-banks:
 gpio-416 (                    |white:status        ) out lo 
 gpio-419 (                    |power               ) in  hi ACTIVE LOW

gpiochip0: GPIOs 427-511, parent: platform/ff634400.bus:pinctrl@40, periphs-banks:
 gpio-431 (                    |sysfs               ) out hi 
 gpio-433 (                    |sysfs               ) out hi 
 gpio-434 (                    |sysfs               ) out hi 
 gpio-451 (                    |regulator-vcc_5v    ) out hi 
 gpio-464 (                    |reset               ) out hi ACTIVE LOW
 gpio-474 (                    |cd                  ) in  hi ACTIVE LOW
 gpio-482 (                    |regulator-usb_pwr   ) out hi 
 gpio-498 (                    |reset               ) out hi ACTIVE LOW
 gpio-509 (                    |shutdown            ) out hi 
root@baffless:~# echo 0 > /sys/class/gpio/gpio431/value
root@baffless:~# cat /sys/kernel/debug/gpio
gpiochip2: GPIOs 404-411, parent: i2c/0-0020, 0-0020, can sleep:
 gpio-409 (                    |red:status          ) out lo 

gpiochip1: GPIOs 412-426, parent: platform/ff800000.sys-ctrl:pinctrl@14, aobus-banks:
 gpio-416 (                    |white:status        ) out hi 
 gpio-419 (                    |power               ) in  hi ACTIVE LOW

gpiochip0: GPIOs 427-511, parent: platform/ff634400.bus:pinctrl@40, periphs-banks:
 gpio-431 (                    |sysfs               ) out lo 
 gpio-433 (                    |sysfs               ) out hi 
 gpio-434 (                    |sysfs               ) out hi 
 gpio-451 (                    |regulator-vcc_5v    ) out hi 
 gpio-464 (                    |reset               ) out hi ACTIVE LOW
 gpio-474 (                    |cd                  ) in  hi ACTIVE LOW
 gpio-482 (                    |regulator-usb_pwr   ) out hi 
 gpio-498 (                    |reset               ) out hi ACTIVE LOW
 gpio-509 (                    |shutdown            ) out hi 
root@baffless:~# cat /boot/armbianEnv.txt
verbosity=1
console=both
overlay_prefix=meson
fdtfile=amlogic/meson-g12b-a311d-khadas-vim3.dtb
rootdev=UUID=5e84494c-edca-4159-bd14-41b8cc62f078
rootfstype=ext4
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
root@baffless:~#