Accessing GPIO from User space for LED Board Control.

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

Accessing GPIO from User space for LED Board Control.

298 Views
MJD
Contributor II

Hello,

I am using UART3_RXD_3V3 (GPIO5_IO08), UART3_TXD_3V3 (GPIO5_IO07) gpios connected with LED Board.

When i try to check the GPIO Set value i am not to able set this with sysfs 
Bellow are the gpio
root@imx8mp-lpddr4-evk:~# find / -name "gpio"
find: '/proc/2514': No such file or directory
/lib/modules/6.1.55+g770c5fe2c1d1/kernel/drivers/gpio
/sys/kernel/debug/gpio
/sys/bus/gpio
/sys/firmware/devicetree/base/regulator-pcie/gpio
/sys/firmware/devicetree/base/regulator-vbus/gpio
/sys/firmware/devicetree/base/regulator-audio-pwr/gpio
/sys/firmware/devicetree/base/regulator-can2-stby/gpio
/sys/firmware/devicetree/base/regulator-can1-stby/gpio
/sys/firmware/devicetree/base/regulator-usdhc2/gpio
root@imx8mp-lpddr4-evk:~#

Is there any specific config need to enable to operate from sysyfs, apart from the bellow 
CONFIG_SYSFS=y
CONFIG_PWM_SYSFS=y

root@imx8mp-lpddr4-evk:~# ls /sys/class/g
gpu_class/ graphics/
root@imx8mp-lpddr4-evk:~# ls /sys/class/g


As with the blow attached document i tried to check.

Is there anything need to be enabled?
Guide me to SET and read the value form the GPIO5_IO08 GPIO5_IO07.
Is there any Dts configuration has reference will be helpful.

ThankYou




0 Kudos
Reply
2 Replies

252 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

 

You need to add the GPIO on device tree and change the IOMUX configuration.

 

You can take as a reference the EVK device tree.

 

Best regards.

0 Kudos
Reply

212 Views
MJD
Contributor II

Hi @JorgeCas 


I have configured Dts to use GPIO5_IO07 pin from user space has bellow.

MJD_0-1716023735578.png

#define MX8MP_IOMUXC_ECSPI1_MOSI__GPIO5_IO07 0x1E4 0x444 0x000 0x5 0x0

root@imx8mp-lpddr4-evk:~# echo 135 > /sys/class/gpio/export
root@imx8mp-lpddr4-evk:~# echo out > /sys/class/gpio/gpio135/direction
root@imx8mp-lpddr4-evk:~# cat /sys/class/gpio/gpio135/value
0
root@imx8mp-lpddr4-evk:~# echo 1 > /sys/class/gpio/gpio135/value
root@imx8mp-lpddr4-evk:~# cat /sys/class/gpio/gpio135/value
1
root@imx8mp-lpddr4-evk:~#

I am able set the value but when i probe with that pin, i do not see any changes on the pin, will always be High. 

Is there any changes need to be done in my dts?

Any one give any me pin configuration with Dts to use GPIO in Userspace.
 
With the bellow link i am not able to set.
root@imx8mp-lpddr4-evk:~#
root@imx8mp-lpddr4-evk:~# gpioset -c gpiochip4 7=1

The above command doesn't execute  

https://variwiki.com/index.php?title=MX8M_GPIO

0 Kudos
Reply