# How to use and setup GPIO (gpiod library) for Hummingboard Mate?

**URL:** <https://community.solid-run.com/t/how-to-use-and-setup-gpio-gpiod-library-for-hummingboard-mate/486>\
**Category:** NXP i.MX8M Plus\
**Created:** [October 13, 2022, 3:02pm UTC](https://community.solid-run.com/t/how-to-use-and-setup-gpio-gpiod-library-for-hummingboard-mate/486 "2022-10-13T15:02:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Juan](https://avatars.discourse-cdn.com/v4/letter/j/a698b9/32.png) [@Juan](https://community.solid-run.com/u/Juan)\
**Post date:** [October 13, 2022, 3:02pm UTC](https://community.solid-run.com/t/how-to-use-and-setup-gpio-gpiod-library-for-hummingboard-mate/486/1 "2022-10-13T15:02:15Z")

</div>

Hi everyone,

I’m trying to set up the mikrobus pinout configuration, but I can’t find how to set up this. I have found this page:

[https://solidrun.atlassian.net/wiki/spaces/developer/pages/396197889/GPIO+Pins+Control+-+HummingBoard+Pulse+Mate+i.MX8M+Plus+SOM](https://solidrun.atlassian.net/wiki/spaces/developer/pages/396197889/GPIO+Pins+Control+-+HummingBoard+Pulse+Mate+i.MX8M+Plus+SOM)

And this (gpiod):

> **[Python gpiod | loliot](https://wiki.loliot.net/docs/lang/python/libraries/gpiod/python-gpiod-about/)**
>
> gpiod pure Python library with almost the same usage as libgpiodcxx

But on gpiod examples on python, I have to use a gpio chip parameter, but I don’t know what is that, I can’t find any documentation about this on solidrun web. How can i do this?

Thank you so much.

---

<div class="post-metadata">

**Author:** ![Juan](https://avatars.discourse-cdn.com/v4/letter/j/a698b9/32.png) [@Juan](https://community.solid-run.com/u/Juan)\
**Post date:** [October 17, 2022, 10:03am UTC](https://community.solid-run.com/t/how-to-use-and-setup-gpio-gpiod-library-for-hummingboard-mate/486/2 "2022-10-17T10:03:58Z")

</div>

Following this guide (using Yocto Hardknott):

[https://solidrun.atlassian.net/wiki/spaces/developer/pages/396197889/GPIO+Pins+Control+-+HummingBoard+Pulse+Mate+i.MX8M+Plus+SOM](https://solidrun.atlassian.net/wiki/spaces/developer/pages/396197889/GPIO+Pins+Control+-+HummingBoard+Pulse+Mate+i.MX8M+Plus+SOM)

It does nothing by pin 119. Configuring 141 pin I get this error:

root@imx8mpsolidrun:~# echo 141 \> /sys/class/gpio/export  
-sh: echo: write error: Device or resource busy  
root@imx8mpsolidrun:~# echo 141 \> /sys/class/gpio/unexport  
-sh: echo: write error: Invalid argument

What have I to do for this works properly?

---

<div class="post-metadata">

**Author:** ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)\
**Post date:** [October 18, 2022, 5:28am UTC](https://community.solid-run.com/t/how-to-use-and-setup-gpio-gpiod-library-for-hummingboard-mate/486/3 "2022-10-18T05:28:29Z")

</div>

Due to board design changes the now mikrobus GPIO is allocated to the LEDs group which is why you are getting the error that the resource is busy. I will push patches to fix this oversight.

---

<div class="post-metadata">

**Author:** ![Juan](https://avatars.discourse-cdn.com/v4/letter/j/a698b9/32.png) [@Juan](https://community.solid-run.com/u/Juan)\
**Post date:** [October 18, 2022, 6:56am UTC](https://community.solid-run.com/t/how-to-use-and-setup-gpio-gpiod-library-for-hummingboard-mate/486/4 "2022-10-18T06:56:03Z")

</div>

Thank you so much for your answer Jon.

With Debian all this works fine, this malfunction is only in Yocto system, is it normal?

---

<div class="post-metadata">

**Author:** ![jnettlet](https://dub1.discourse-cdn.com/flex005/user_avatar/community.solid-run.com/jnettlet/32/62_2.png) [@jnettlet](https://community.solid-run.com/u/jnettlet)\
**Post date:** [October 18, 2022, 6:57am UTC](https://community.solid-run.com/t/how-to-use-and-setup-gpio-gpiod-library-for-hummingboard-mate/486/5 "2022-10-18T06:57:16Z")

</div>

It is possible the Debian kernel isn’t building or loading the leds module, which would allow the GPIOs to work properly. Regardless I will fix it properly in the device-tree.
