Closed MichaelZhuxx closed 3 years ago
make linux-menuconfig
to enable CONFIG_GPIO_SYSFS, after that, make -jx
and generate new image.fit
then system reboot and load new image. Input the follow commands in shell:
Set output and use multimeter to measure level:
# cd /sys/class/gpio/
# ls
export gpiochip0 unexport
# echo 9 > export
# echo out > gpio9/direction
# echo 1 > gpio9/value
# echo 0 > gpio9/value
Set input and read the level of gpio:
echo in > gpio9/direction
#
# cat gpio9/value
1
# cat gpio9/value
0
Plan to set GPIO after system boot, but failed.
cd /sys/class/gpio
-sh: cd: can't cd to /sys/class/gpio: No such file or directory