GPIO toggling inconsistently between 0 and 1 always - Jetson AgX xavier industrial

Hi,

Jetpack 5.1.2 l4t version 35.4.1

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?

Thanks

DevKit/custom board?

What exact commands did you run?
Better ask your colleague to join discussion here.

Custom board.

Commands used:

echo 419 > /sys/class/gpio/export
echo out > /sys/class/gpio/PN.01/direction
echo 1 > /sys/class/gpio/ PN.01/value
cat /sys/class/gpio/ PN.01/value

Then does the same set of operation work fine on a DevKit board?

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

  1. 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

  1. 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
  2. Observe PT.03 GPIO input is high (1)
  3. Set GPIO PN.01 to low.
    echo 0 > /sys/class/gpio/ PN.01/value
    cat /sys/class/gpio/ PT.03/value
  4. Observe PT.03 GPIO input is low (0)
  5. 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
  6. Observe PN.01 GPIO input is high (1)
  7. Set GPIO PT.03 to low.
    echo 0 > /sys/class/gpio/ PT.03/value
    cat /sys/class/gpio/ PN.01/value
  8. Observe PN.01 GPIO input is low (0)

YES, you should be doing that.
So is loopback test working as expected?

1 Like

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.

Thanks for your acknowledgment.

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??

Please let us know your thoughts on this.
Thanks.

You should check your hardware design if even loopback is not working.

1 Like

Ok fine. thanks.

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 ?

YES.
cat just outputs whatever it sees.

1 Like

Just to conclude on this topic:

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.

1 Like

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