iMX7ULP accessing GPIO from user-mode

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iMX7ULP accessing GPIO from user-mode

362 Views
djones7777
Contributor I

Hello,

I am having trouble accessing GPIO from user-mode. I am trying to use PTC_5 as an output pin. Under my calculations this should correspond to pin 5 in sysfs gpio. Technically I am using the gpio character interface in a c++ program but for simplicity I will refer to using sysfs to control the gpio because the results are the same. Without any modification to the device tree, I can export a pin but cannot change the direction of the pin. I end up getting a write error, invalid parameter. I added a pinctrl group under iomuxc1 and I can change direction as well as set the value of the pin. But the pin only works in input mode. Linux reports the value changes when writing to /sys/class/gpio/gpio5/value in output mode but the voltage of the pin is always 0. Is there something I am missing, I was under the assumption that any pin not claimed in the device tree can be used via user-mode. Thank you

0 Kudos
Reply
1 Reply

339 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello,

If you are working with the BSP, it has enable you don't need to write to the iomux, it works on C++ as well. As example:

root@imx7ulp:/sys/class/gpio# ls
export gpiochip128 gpiochip224 gpiochip472 gpiochip96
gpio32 gpiochip160 gpiochip32 gpiochip480 unexport
gpiochip0 gpiochip192 gpiochip464 gpiochip64
root@imx7ulp:/sys/class/gpio#

 

Regards

0 Kudos
Reply