GPIOs: pull-up, pull-down or open-drain configuration

Hi all!

How can be the GPIOs of the Dragonboard configured as open-drain, pull-up or pull-down? I need to use an open-drain input-output GPIO and I think thaht it’s configured as pull-up, because the other device can’t pull low the GPIO line.

Thank you!

Hi @andribiotic

Please take a look at mraa library. It has the support for configuring GPIO’s in various modes you mentioned.

If you are interested in GPIO source, it can be found here

Thanks,
Mani

Hi @Mani, thank you for your response.

I will try to use this library. If finally I can configure GPIOs I’ll let you know.

Only a doubt. Looking the code of the library, it seems to be a very heavy code, knowing that it’s only for control the GPIOs?

Hi @andribiotic,

mraa library is for controlling most of the peripherals from userspace in linux. ATM 96Boards CE boards supports peripherals like gpio,i2c,spi and uart in mraa.

Hope this helps!

-Mani

Hi @andribiotic,

Sorry I was wrong! mraa has the support for pull up/down mode but not for Dragonboard410c. Only some SBC’s like Intel Galileo exposes these parameters via sysfs, which is used by mraa. In case of Dragonboard, you have no way of configuring from userspace through sysfs. If you do want to change the pull up/down mode you have to modify the device tree source for a specific gpio similar to below:

		pinmux {
			function = "gpio";
			pins = "gpio38";
		};
		pinconf {
			pins = "gpio38";
			drive-strength = <2>;
			bias-pull-up;
		};

Sorry for the wrong pointer.

Thanks,
Mani

Hi @Mani, at the moment, I think that modify the device tree it’s a little hard task for me. I only have a few weeks with Linux embedded. I’m reading the Embedded Linux Primer, so may, in some weeks more I will be capable.
At the moment, I read the GPIO, then I write the value to notify the salve, and finally I do a “dummy” read, so the slave can put the line down again. Thank you for the tip