This has gotten the better of me. What am I missing?
I have a button I want to read from GPIO. Here’s the schematic:
root@ubuntu:~# echo 76 > /sys/class/gpio/export
root@ubuntu:~# echo in > /sys/class/gpio/gpio76/direction
root@ubuntu:~# cat /sys/class/gpio/gpio76/direction
in
root@ubuntu:~# cat /sys/class/gpio/gpio76/value
0
root@ubuntu:~# cat /sys/class/gpio/gpio76/value
0
root@ubuntu:~# cat /sys/class/gpio/gpio76/value
0
Pressing the push button, then executing:
root@ubuntu:~# cat /sys/class/gpio/gpio76/value
1
root@ubuntu:~# cat /sys/class/gpio/gpio76/value
1
root@ubuntu:~# cat /sys/class/gpio/gpio76/value
1
root@ubuntu:~# cat /sys/class/gpio/gpio76/value
0
root@ubuntu:~# cat /sys/class/gpio/gpio76/value
0
releasing the push button and then executing:
root@ubuntu:~# cat /sys/class/gpio/gpio76/value
1
root@ubuntu:~# cat /sys/class/gpio/gpio76/value
1
root@ubuntu:~# cat /sys/class/gpio/gpio76/value
1
root@ubuntu:~# cat /sys/class/gpio/gpio76/value
0
root@ubuntu:~# cat /sys/class/gpio/gpio76/value
0
root@ubuntu:~# cat /sys/class/gpio/gpio76/value
1
root@ubuntu:~# cat /sys/class/gpio/gpio76/value
0
root@ubuntu:~# cat /sys/class/gpio/gpio76/value
1
root@ubuntu:~# cat /sys/class/gpio/gpio76/value
1
root@ubuntu:~# cat /sys/class/gpio/gpio76/value
0
The GPIO value is sometimes 0 and sometimes 1 without moving the button, uncertain.
So what am I missing or bungling? Does there need to be a dtb overlay for using the GPIO like this?