We have issue with our GPIO pins which are configured as either input or output and are set as 0 or 1 for output direction type using
echo… command
Problem is when we try to print the value set using cat command, it prints wrongly and again it prints correct value… again after 1-2 seconds it’s prints wrong value.
But when we check the value using multimeter we observe that it shows correct voltage values
0 volts of active 0
Approx 5 volts for active 1
Let us know how to get the correct constant value printed using Cat command.
What might be the issue here?
Is it a software issue or hardware issue?
We dont have Devkit right now so cannot tell you about that
However, came to know with discussion in detail about these so called hardware loop connections( loop back cable used) to test GPIO input and Output pins, that the cat commands we are using to read the output pin, is not the right logical way.
We need to write 0/1 to output pin and do the cat command for the GPIO input pin which is connected to the GPIO output through loop back.
Please see the correct set of commands which should work fine:
4.3.3.8 GPIO TEST
Make sure the following loop back connection should be done in the J1 I/O cable, D-Sub connector with the loom name GPIO_CAN.
Signal Name From GPIO_CAN Dsub Signal Name To GPIO_CAN Dsub
GPIO1 2 GPIO2 3
GPIO3 4 GPIO4 5
Enter the below command to set GPIO1 as output High (1) and GPIO2 as input for loop back test.
echo 419 > /sys/class/gpio/export
echo out > /sys/class/gpio/PN.01/direction
echo 1 > /sys/class/gpio/ PN.01/value
echo 460 > /sys/class/gpio/export
echo in > /sys/class/gpio/PT.03/direction
cat /sys/class/gpio/ PT.03/value
Observe PT.03 GPIO input is high (1)
Set GPIO PN.01 to low.
echo 0 > /sys/class/gpio/ PN.01/value
cat /sys/class/gpio/ PT.03/value
Observe PT.03 GPIO input is low (0)
Enter the below command to set GPIO2 as output High (1) and GPIO1 as input for loop back test.
echo out> /sys/class/gpio/PT.03/direction
echo 1 > /sys/class/gpio/ PT.03/value
echo in> /sys/class/gpio/PN.01/direction
cat /sys/class/gpio/ PN.01/value
Observe PN.01 GPIO input is high (1)
Set GPIO PT.03 to low.
echo 0 > /sys/class/gpio/ PT.03/value
cat /sys/class/gpio/ PN.01/value
Will let you know soon in couple of days.
One of our engineers will be visiting customer site tmrw or they after and tests these commands, it should work fine.
Its not working correctly .
We had set “1” using echo command to the output pin.
we execute cat command back to back continously and read the looped back input gpio pin, we observe some times it gives “0” intermittently.
1)Any idea for this variation to see value “0” some times?
2) how exactly cat works inside Jetson at the kernel level?
3) Is there any delay we should give between two cat commands back to back?
4) Is using loop back cable method to test both input and output pin, having any current level variations, voltage difference etc some thing related to hardware??
So we will try to test output and input gpio pin seperately with multimeter , power supply etc.
So with this I assume this has nothing to do with cat command execution. It should print constant value all the time even if it executed back to back ?
When we test gpio output pins(configured as output pins) with multimeter, by echoing “1” or “0”, we see equivalent 5v or 0v
When we test gpio input pins( configurer as input pins) by providing input through power supply 5v or by shorting with wire to gnd to provide 0v inputs
We see correct value with the cat command.
“1” for 5v input and “0” for Gnd input.
Hence we are concluding that, when we use the loop back cable used with the connector loom cable of the unit, the voltage levels drops by the time the value reach e from output pin to input pin, that’s why the variation in the state 0 and 1.