i.MX8MM EVK. Unable to configure GPIO lines using libgpiod.

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

i.MX8MM EVK. Unable to configure GPIO lines using libgpiod.

1,756 Views
dhananjay896
Contributor I

Dear NXP Support Team,

I am experiencing an issue while trying to configure GPIO lines on the i.MX8MM EVK using the libgpiod utilities. Despite following the documented steps, I am unable to set GPIO pins as output or manipulate their state correctly.

Details:

  • Board: i.MX8MM EVK
  • Kernel Version: 6.6.36-lts-next-gd23d64eea511
  • Build Environment: Yocto build system
  • Issue Summary:
    • The /dev/gpiochip* devices are present
    • The command gpiodetect works as expected and lists all available GPIO chips.
      • dhananjay896_1-1733459824395.png

         

    • The command gpioinfo also functions correctly, displaying information about GPIO lines.
    • dhananjay896_3-1733459961355.png

       

    • However, when I attempt to use the gpioset command to set a GPIO line, the terminal becomes unresponsive. The GPIO pin does not change its state (remains low), and I must terminate the process manually using Ctrl + C
    • dhananjay896_4-1733460180216.png

       

    • After forcefully exiting the gpioset command, if I run gpioget, it fails to retrieve the state of the GPIO pin, indicating that the state was not successfully modified.
    • dhananjay896_5-1733460281946.png

       

  • This behavior persists across multiple GPIO lines and is consistent regardless of the chip index or line number used.

I am seeking assistance to identify the root cause of this issue and ensure the proper functionality of GPIO configuration using libgpiod.

Thank you for your support.

0 Kudos
Reply
4 Replies

1,557 Views
pengluo
Contributor III

@danielchen

I used the command: gpioset -c gpiochip0 8=0 Then I tested the level of gpio0_8 and it was low, but when I used the command gpioget -c gpiochip0 8, gpio0_8 showed a high level. Why is that? Does gpioget initialize the IO port?

pengluo_1-1734950760087.png

 

0 Kudos
Reply

1,413 Views
danielchen
NXP TechSupport
NXP TechSupport

you can check if the gpio  can keep the "value"  after you use "^c" in your side.

0 Kudos
Reply

1,483 Views
danielchen
NXP TechSupport
NXP TechSupport

No, I didn't get the result as you mentioned. I will double check this and get it back to you later.

0 Kudos
Reply

1,644 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi @dhananjay896 :

 

In order to configure GPIO using libgpiod library, you need to 

  1. make sure no other driver this this GPIO
  2. configure the pin as gpio in dts file

please see my test result:

 

root@imx8mmevk:~# gpioset -c gpiochip2 16=1 //you will see the led light on
//ctrl +c force quit
root@imx8mmevk:~# gpioget -c 2 16
"16"=active
root@imx8mmevk:~# gpioset -c gpiochip2 16=0 //you will see the led light off
//ctrl+c force quit
root@imx8mmevk:~# gpioget -c 2 16
"16"=inactive
root@imx8mmevk:~#

 

 

Regards

Daniel

0 Kudos
Reply