How to control gpio from user space in imx8m plus

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

How to control gpio from user space in imx8m plus

1,752 Views
kamalesh
Contributor II

Hi,

I am using custom board having yocto image version-6.6.52. Here there is no /sys/class/gpio. Because it is depreceated here. So i need to use lipgpiod.

I am having external gpio pin in board which is GPIO1_IO15. I have checked the device tree. There is no other operations for this pin. So how can i proceed with libgpiod. I have tried, whenever i am trying to access, it is hanging.

Please share any relevant document or methods to try?

Please respond as soon as possible.


Regards,
Kamalesh

0 Kudos
Reply
6 Replies

1,737 Views
Chavira
NXP TechSupport
NXP TechSupport

Hi @kamalesh!

 

You only have to configure your device tree to manage the gpio.

 

Please share your device tree and I will help you.

 

Best Regards!

Chavira

0 Kudos
Reply

1,732 Views
kamalesh
Contributor II

Hi Chavira,

Here, I attached the dts. Please give me some details, how it will link also to get some knowledge?

Regards,
kamalesh

0 Kudos
Reply

1,694 Views
Chavira
NXP TechSupport
NXP TechSupport

Hi @kamalesh!

 

I have added the GPIO1_IO15 to the device tree as a GPIO, please ensure that the same pin is not configured in imx8mp-axon.dtsi file.

 

After that you should be able to use the GPIO using the next commands:

 

$ gpioset -c gpiochip0 15=0
$ gpioset -c gpiochip0 15=1
$ gpioget -c gpiochip0 15

 

You can consult our documentation in the link below:

Embedded Linux for i.MX Applications Processors

The Linux Kernel documentation 

 

Best Regards!

Chavira

0 Kudos
Reply

1,677 Views
kamalesh
Contributor II
Hi Chavira,

After uploading the updated device tree, I have used the libgpiod API to set the gpio high, it does not responding anything.
What may be the issue?

Note: I am using Yocto-6.6.52_2.2.0-stable version


Regards,
Kamalesh
0 Kudos
Reply

1,665 Views
Chavira
NXP TechSupport
NXP TechSupport

Hi @kamalesh!

 

please check if the same pin is not configured in imx8mp-axon.dtsi file.

 

0 Kudos
Reply

1,619 Views
kamalesh
Contributor II
Hi,
I have taken other gpio instead of this GPIO1_IO15. I have done the same device tree changes. It worked.

Thank you for the support.

Regards,
Kamalesh