[imx8mm] Not able to access GPIO through sysfs

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

[imx8mm] Not able to access GPIO through sysfs

3,482 Views
avijitnsec
Contributor III

Hi 

I am working on a custom board based on imx8mm + Yocto . I am not able to access the GPIOs through sysfs. I have a button connected to GPIO5_IO0 and LED connected to GPIO1_IO23. I am trying to turn the LED on when the button is pressed from user-space.  It is not working.

I am able to export the GPIO pin in sysfs. I can change the entry in the value, it is reflecting properly. But no changes on the device. Also when the button is presses, I expect the value to change. But not happening.

Although I managed to access the LED through Linux driver, and I am trying to access the button using one of the existing driver.

I have tried similar thing with imx8mm evk + Android default image.

Tried to export the gpio connected to LED. It is not creating any directory.

evk_8mm:/sys/class/gpio # echo 80 > export                                    

1|evk_8mm:/sys/class/gpio # ls

export    gpiochip128 gpiochip496 gpiochip96

gpiochip0 gpiochip32  gpiochip64  unexport

Tried to change the brightness.

evk_8mm:/sys/class/leds/status # echo 1 > brightness

There is no change in LED brightness.

Any idea why we are not able to access the GPIO through sysfs ?

Thanks,

Avijit

0 Kudos
Reply
2 Replies

3,472 Views
kef2
Senior Contributor V

GPIO5_IO00 should be either 5*32+0 = 160 or (5-1)*32+0=128, depending on what is GPIOx block numbering in your i.MX, counting from 0 (GPIO0 is the first) or counting from 1 (GPIO1 is the first). So either 160 or 128, but you do

evk_8mm:/sys/class/gpio # echo 80 > export 

 

0 Kudos
Reply

3,476 Views
igorpadykov
NXP Employee
NXP Employee

Hi Avijit

 

may be useful to look at below link

https://community.nxp.com/t5/i-MX-Processors/how-does-it-control-the-GPIO-as-input-output-in-DTS/td-...

 

Best regards
igor

0 Kudos
Reply