I want to be able to turn the power led on the dev kit board on and off from a python script. This pin is GPIO04 and it’s not controlable by default. I would like to make the necessary changes to the device tree to allow me to control it. Also how can I use Jetson.GPIO to control this LED?
Hi Jaime_Element,
What’s your Jetpack version in use?
Do you mean the following pin?
If so, please run the following commands to use sysfs to control this pin.
$ sudo su
# cd /sys/class/gpio
# echo 329 > export
# echo out > PCC.01/direction
# echo 0 > PCC.01/value
# echo 1 > PCC.01/value
Please just refer to the following instruction for Jetson.GPIO.
NVIDIA/jetson-gpio: A Python library that enables the use of Jetson’s GPIOs (github.com)
Thanks for the answer, yes that’s the pin, I was able to control it with the above commands. But I’m confused as to the naming on the GPIO library.
What mode would allow the name GPIO04 or channel 4 to be used to control it?
Jetpack is 5.1.2 btw
“ The mode must be one of GPIO.BOARD, GPIO.BCM, GPIO.CVM, GPIO.TEGRA_SOC or None”
What do you mean about “the naming on the GPIO library”?
You could just check the pinmux spreadsheet for the naming in different perspective for each pin.
Yes but that’s the issue there is no provision on the jetson-gpio library to control GPIO04. So what needs to be modified in order to be able to access that port using the library? There are specifically some numbers on this table which I am not sure where to get:
It seems not declared GPIO04 in this python script you shared so that you would need add the pin according to your use case if you want to control GPIO04 with jetson-gpio.
Thanks yes, I figured out how to add it. I had to add this line to that file:
(13, 'PCC.01', "tegra234-gpio-aon", 4, 1, 'GPIO04', 'GP07_SPI2_MISO', None, None),
I have one more question regarding the values that go into that line. If the pin has PWM capabilities, how do you figure out the values that go into the last two fields of the table?
For example in this PR update pwm pin by anhmiuhv · Pull Request #88 · NVIDIA/jetson-gpio · GitHub
32e0000.pwm and 0 were added.
You can use this https://developer.nvidia.com/downloads/jetson-orin-nx-and-orin-nano-series-pinmux-config-template pinmux spreadsheet to see if the pin is PWM capable.
And then you can use NVIDIA Orin Series System-on-Chip Technical Reference Manual from Jetson Download Center to see which register the PWM is connected to. For example, in update pwm pin by anhmiuhv · Pull Request #88 · NVIDIA/jetson-gpio · GitHub , the PWM connected to the pin is PWM7 which is connected to 32e0000
Then you can use
cat /sys/kernel/debug/pwm
to see which PWM ID is available to use. In the example above, it is 0
Thank you!!
Hi,Jaime_element
I saw you get the values of GPIO04.BCM(1) and GPIO04.BOARD(4). Now I using these two values also. But I don’t know how to get it. I using other GPIO. So I really hope to get your reply.
Thanks.