GPIO Input

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:


image


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?

You may need to read the appnote of 40-pin header to make sure your circuit design can meet the load requirement of the pin of 40-pin header. Jetson Nano Developer Kit 40-Pin Expansion Header GPIO Usage Considerations Applications Note

Having read the recommended document DA-09753-001_v1.0.pdf, if I want to configure GPIO76 as an input pin connected to a switch according to the circuit diagram, is there a mistake in the resistor value in the circuit designed by our hardware engineer? Should the resistor be 1.5KΩ or ≥1.65KΩ?
image

DA-09753-001_v1.0.pdf The example given in the document is as follows:

Did you probe the voltage of the pin with oscilloscope to find out why it is sometimes high and sometimes low? And then you can try different pull up/down to optimize.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.