How can I check the correspondence between GPIO pins and /sys/class/gpio/export
?
Hi liuyuhangpro,
Are you using the devkit or custom board for Xavier NX?
What’s your Jetpack version in use?
Which pin would you like to control?
I could give an example for how to map them.
I’m using a custom board with JetPack version 4.6 (ver3), and the pins I need to control are GPIO0 to GPIO14. Can you provide an example mapping for GPIO3 (126)?
Let me take GPIO03
as example:
(1) Find this pin in pinmux spreadhseet
=> You would know it is also PCC.00
(2) Run the following command on your board
$ sudo cat /sys/kernel/debug/gpio|grep PCC.00
gpio-317 (PCC.00 )
=> You would know this pin is 317
(3) Export the pin and check its state
$ sudo su
# echo 317 > /sys/class/gpio/export
# cat /sys/class/gpio/PCC.00/direction
# cat /sys/class/gpio/PCC.00/value
Why is PCC.00 not being displayed?
nvidia@nx:~$ sudo cat /sys/kernel/debug/gpio | grep PCC.00
[sudo] password for nvidia:
nvidia@nx:~$ sudo cat /sys/kernel/debug/gpio | grep 317
gpio-317 ( )
nvidia@nx:~$
Oh sorry, it seems you are using the JP4 rather than JP5.
Please share the full dmesg for further check.
klog.txt (79.7 KB)
Yes, I am using JetPack 4.6 (ver3).
(1) run the following command on your board
$ sudo cat /sys/kernel/debug/gpio|grep aon
gpiochip1: GPIOs 248-287, parent: platform/c2f0000.gpio, tegra-gpio-aon:
=> You would know the base number for AON GPIO is 248
(2) refer to tegra194-gpio.h
#define TEGRA194_AON_GPIO(port, offset) \
((TEGRA194_AON_GPIO_PORT_##port * 8) + offset)
..
#define TEGRA194_AON_GPIO_PORT_CC 2
=> PCC.00
will result 16 (= 2*8 + 0)
=> You would know the gpio number for PCC.00
is 248+16 = 264
(3) Export the pin and check its state
$ sudo su
# echo 264 > /sys/class/gpio/export
# cat /sys/class/gpio/PCC.00/direction
# cat /sys/class/gpio/PCC.00/value
Alright, I understand. Thank you.
When I try to set GPIO04 (265), I get the following message. Is this pin already in use? How should I configure this pin as a GPIO?
root@nx:/sys/class/gpio# echo 265 > export
bash: echo: write error: Device or resource busy
root@nx:/sys/class/gpio#
Yes, it seems this pin has been used by others.
Please run the following command to check.
sudo cat /sys/kernel/debug/gpio|grep 265
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.