Unable to access GPIO in the latest L4T 35.3.1

You could use the following commands to add the permission for specific group (e.g gpio).

$ sudo chown root:gpio /sys/class/gpio/unexport /sys/class/gpio/export
$ sudo chmod 220 /sys/class/gpio/unexport /sys/class/gpio/export
1 Like

Hi Kevin,

Thanks for the quick help. I can do it manually, but did something change in the latest kernel, forcing the GPIO to be owned by the root?

Ramakrishna

It seems the kernel version the same for these 2 releases.
Could you help to share the result of the following command on both releases?

$ sudo ls -l /sys/class/gpio/export

Hi Kevin,

Sorry for the late response. Here’s the result of the above command.
--w------- 1 root root 4096 Jul 14 08:39 /sys/class/gpio/export

-Ramakrishna

I would like to know the difference of above command between these two releases(R35.1 and R35.3.1).

It is the same for both releases (older invalid response)
--w------- 1 root root 4096 Jul 13 18:40 /sys/class/gpio/export

Corrected response:
L4T 35.3.1
--w------- 1 root root 4096 Jul 13 18:40 /sys/class/gpio/export
L4T 35.1
--w--w---- 1 root gpio 4096 Jul 14 13:41 /sys/class/gpio/export

Could you also help to compare if there’s the different results with the following command for both releases?

$ sudo busybox devmem 0x0243d028

Should I install busybox? it is not available by default

L4T 35.3.1
0x00001055
L4T 35.1
0x00001055

Sorry, I just provide the wrong address for this pin.
Please check with the following command for both release.

$ sudo busybox devmem 0x0243d810
and also 
$ sudo busybox devmem 0x0243d020

L4T 35.3.1

0x1800FFFF
0x00001055

L4T 35.1

0x1800FFFF
0x00001055

Both have similar output

Hi Kevin,

Sorry for the confusion. I am working with multiple boards because of this, I gave the output for both L4T 35.3.1.

Here is the correct output
L4T 35.3.1
--w------- 1 root root 4096 Jul 13 18:40 /sys/class/gpio/export
L4T 35.1
--w--w---- 1 root gpio 4096 Jul 14 13:41 /sys/class/gpio/export

Ramakrishna

Hi Kevin,

Any update on this issue? in the latest L4T release, the permissions for GPIO file sys is changed and only root has the access.

Ramakrishna

I’m checking if there’s any change for this with internal.

Are you sure this would work in R35.1 w/o permission denied issue?

Yes, Kevin. It works on L4T 35.1 without any manual steps (providing permissions).

sysfs GPIO way has been deprecated. The recommanded way is using the new GPIO character device API.
https://blog.lxsang.me/post/id/33

One way to use it from command line is gpiod: https://www.acmesystems.it/gpiod

Hi lhoang,

Thanks for the response. Is there any documentation available on this? I might have missed it. Kindly share.

Ramakrishna

You could refer to the following link for the usage of jetson-gpio.
GitHub - NVIDIA/jetson-gpio: A Python library that enables the use of Jetson’s GPIOs

For you original issue, you could also do similar things to add udev rule like the following to make it always set to what you need.
linux - udev doesn't want to run chgrp and chmod - Unix & Linux Stack Exchange
Or just write an auto script to execute it every time it boots up.

Thanks, Kevin.

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