For example, to operate IO1 on the Core-3588JD4 main module (GPIO 36), you need:
Export the GPIO, run as root user:
echo 36 > /sys/class/gpio/export
Operate GPIO, set to read input or output specified value:
cd /sys/class/gpio/gpio36# set input modeecho in > directioncat value# set output modeecho out > direction# output low levelecho 0 > value# output high levelecho 1 > value
There are a few things to note:
If the GPIO has been applied by other drivers, it cannot be exported successfully, and subsequent read and write operations cannot be performed.
Involving the multiplexing of IO functions, if the function of the pin is already GPIO, the above method can be used; otherwise, the pinctrl state must be specified in the device tree.