My pins don't seem to be working

I am following the code in the bottom half of this tutorial.

It’s a C++ script that should send a signal out of pin 7 that should be able to make an LED blink.

Sorry, the code is through a link, but it’s all there. I’m following the code and I installed the library for running gpio on C++ for a Jetson correctly.

Do I have any options for troubleshooting?

Hi,

Are you talking about the hardware setup is all fine but you cannot see LED blink?

The pin 7 of 40 pin header is in use here?

The AGX Xavier white LED light works fine when it’s powered on. My only problem is with using the pins as gpio pins. I’m not getting anything from them no matter if I use C++ or Python gpio libraries.

Hi,

This is jetson AGX forum. What is the exact platform you are using?

I’m aware this is a Jetson AGX forum. My Jetson AGX Xavier doesn’t seem to have working gpio pins.
I’m using Jetpack 4.6. I used Python3. I used import Jetson.GPIO as GPIO to try using GPIO pins. I used the C++ Jetson library git clone at GitHub - pjueon/JetsonGPIO: A C++ library that enables the use of Jetson's GPIOs

How can I get the GPIO pins to work?
Can I test them somehow?
I just totally reinstalled Jetpack and everything on the machine. It doesn’t seem to work.

Hi,

Then I think we need to know which pin is in use here.

We are not sure if this script would work on AGX or not.

Please make sure the pinmux of this pin is set to gpio.

If you are sure the pinmux is set to GPIO, you can use the most simple way to enable the gpio signal.

https://www.kernel.org/doc/Documentation/gpio/sysfs.txt

According to the page here, NVIDIA Jetson AGX Xavier GPIO Header Pinout - JetsonHacks
pin7 is gpio 422. You can use the sysfs to output it first. Also try more gpio pins and see if any of them can work.

If you don’t know then I’m sure I don’t know. Something like this would work with an Arduino or Raspberry Pi with little effort.
Is there no sample script from Nvidia that can get the AGX Xavier to control an LED or a stepper motor?
I’ve been going back and forth with the author of this library trying to get the Xavier’s pins to work. Nvidia makes this product and nobody knows how to use it.
Is there something other than gpio I can use software with to control motors and LEDs?

Hi,

Just want to clarify, I am not sure why you ignored half of my comment.
I already shared the method that does not need any script to test the GPIO in previous comment. That method uses the sysfs to control the GPIO.

If you have any problem in running that, please let me know so that I can give you a more easy way to understand that.

I believe most of the “GPIO lib” python scripts are also based on this method. Thus, you can use this to test. If even that fails, then no lib in python would work and we may need some hardware guy to check what is going on. But I think this may not happen easily.

Please make sure you have pinmux setting correctly first. If you don’t understand what does “pinmux” mean here, please let me know.

I am sorry that this may not sound a easy way because I want to share a thorough solution which makes sure everything is ok.

Not every jetson project over the Github is maintained by us. Sometimes we do see some bugs. Thus, I prefer to using some basic system control method to test the function.

The document for configure the pinmux of the expansion header.

https://docs.nvidia.com/jetson/archives/l4t-archived/l4t-3261/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/hw_setup_jetson_io.html#

Please maks sure the pin you want to use is set to “unused”.

Is there a test I can do to find out if the device is broken? Only the 3.3V and 5V pins do what they are supposed to do.
Do I need a PN2222 transistor for any GPIO signal?

The pins I try to use as GPIO are labelled as ‘unsued’ at $ sudo /opt/nvidia/jetson-io/jetson-io.py

Because this link to a text document is confusing. It starts with "THIS ABI IS DEPRECATED, THE ABI DOCUMENTATION HAS BEEN MOVED TO
Documentation/ABI/obsolete/sysfs-gpio AND NEW USERSPACE CONSUMERS
ARE SUPPOSED TO USE THE CHARACTER DEVICE ABI. THIS OLD SYSFS ABI WILL
NOT BE DEVELOPED (NO NEW FEATURES), IT WILL JUST BE MAINTAINED.

Refer to the examples in tools/gpio/* for an introduction to the new
character device ABI. Also see the userspace header in
include/uapi/linux/gpio.h"

And this quote…

“Board documentation should in most cases cover what GPIOs are used for
what purposes. However, those numbers are not always stable; GPIOs on
a daughtercard might be different depending on the base board being used,
or other cards in the stack. In such cases, you may need to use the
gpiochip nodes (possibly in conjunction with schematics) to determine
the correct GPIO number to use for a given signal.”

Numbers are not always stable and I might need to use “gpiochip nodes”.

We’ve been going back and forth a few times and I don’t know how to get anything out of the pins on the Xavier. If I could just have some examples in C++ and Python, or the command line that make the device do the things people buy the device for I would appreciate it. Controlling LEDs, stepper motors, encoders. Arduinos and Raspberry Pis take a few minutes to get going with these things.
Can I do any tests to a pin that would show on an electrometer?

If there is some deeper layer of industrial robotics computing that I need to learn I would learn it.

Ok, forget about that document. Maybe too much details there make you confused.

Just follow the " Terminal Access to GPIO pins" in below website.

If you want to use “pin7” on jeton AGX, check the website I shared in previous comment.

There is a gpio “422” under the “sysfs” in the table. This “422” is what you need to use in the “export” of that “Terminal Access to GPIO pins” section.

image

The “gpio number will change” means this “422” is not always representing “pin7” when different platform comes to use. For example, “gpio422” is not pin 7 on jetson nano.

Hope this would be more easier to understand.

I have the pin numbers down. I know what the pins are supposed to be.

Things in this website don’t work on my AGX Xavier.

$ sudo cp /opt/nvidia/jetson-gpio/etc/99-gpio.rules /etc/udev/rules.d/ cp: cannot stat '/opt/nvidia/jetson-gpio/etc/99-gpio.rules': No such file or directory

# sudo echo 79 > /sys/class/gpio/export
echo: write error: Invalid argument

You seem like you’re getting mad but I would just like a way to use the pins. You link to many things that are not from Nvidia. I don’t understand why Nvidia doesn’t have good documentation and troubleshooting for the pins. I’ve been trying to get something out of the pins every day this week and I can’t tell if the device is broken.

It’s not necessarily the customers fault for not understanding. I understand all I need to use Arduino and Raspberry Pi. I need something like that but with more memory. I thought that’s what I’d be getting with Nvidia.

Not 79. Use 422.

# sudo echo 422 > /sys/class/gpio/export
echo: write error: Device or resource busy

Looks like it is already in use.

Is there a node /sys/class/gpio/gpio422 over there?

I’m sorry, I don’t know what a ‘node’ is. I would like to learn.
# cd /sys/class/gpio/gpio422
# dir
active_low device direction edge power subsystem uevent value

SUCCESS!
I tried pin 37 and I’m able to use it to turn an LED off and on for the first time working with the Xavier all week.

# sudo echo 249 > /sys/class/gpio/export
# echo out > /sys/class/gpio/gpio249/direction
# echo 1 > /sys/class/gpio/gpio249/value
# echo 0 > /sys/class/gpio/gpio249/value

Just take the node as a path… since you have gpio422 now, just do similar things to 422 as 249 and see if pin7 can be toggled or not…

No. I have only been able to toggle the pins labelled gpio that say ‘3.3V’ and not the ones that say ‘1.8/3.3V’ on this website with a pin diagram

Checking the pins with an electrometer they are toggling from 0V to 3.3V.
I think I mentioned before, I tried an electrometer on pins 7 and 11 and they always showed about 0.1V, whether they were toggled on or off. Pins 7 and 11 are among the ones labelled ‘1.8/3.3V’.

Can I change a mode or pinmux option, or something for these pins?
Eventually I’d like to hook up a robot to this device. I see PWM is only available on three pins. I’m still in the dark with what most of these pins are and how to use them. PWM is limited to three motors?