Change GPIO active state to low?

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

Change GPIO active state to low?

4,181 Views
triedgetech
Contributor III

Okay so I have i.imx8m mini, and the gpiod commands seem to work, however, the command:

 

sudo gpioget --active-low /dev/gpiochip2 6

 

 Doesn't change the voltage on the pin.

When I run:

 

sudo gpioset /dev/gpiochip2 6=0

 

It does change the pin voltage to low, however, if I try to read the value:

sudo gpioget 2 6

It returns "1" and sets the pin voltage to high

sudo gpioinfo gpiochip2

 Shows all pins as "active-high"

Is it possible to change any of the pins to "active-low"? Or are they hardwired that way in hardware? E.g. have pull up resistors to 3.3V.

Tags (3)
0 Kudos
3 Replies

4,168 Views
igorpadykov
NXP Employee
NXP Employee

Hi Ed

 

for gpio control may be useful below :

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

3,971 Views
triedgetech
Contributor III

let's say I want to change state of GPIO3_IO0, which is described in device tree within node iomuxc

 

pinctrl_gpio3: gpio3grp {
fsl,pins = <
			MX8MM_IOMUXC_NAND_ALE_GPIO3_IO0 0x41

// ...
>;
	};

 

Now I'm a bit confused, does the value 0x41 set in "General Purpose Register 3 (IOMUXC_GPR_GPR3)"

or simply IOMUXC pad features (8.2.3.1 GPIO pad features / Pad Control Register)? So parameter value 0x41 (01000001) would change:

PE (Pull Resistors Enable Field)

HYS (Hysteresis Enable Field)

PUE (Control IO ports PS)

ODE (Control the IO ports ODE)

FSEL (Slew Rate Field)

DSE (Drive Strength Field)

?

A value of 0x41, which is in binary 0 1 0 00 001, means PE => Disabled, HYS => CMOS input, PUE => Enabled, ODE => Disabled, FSEL => SLOW, DSE => X1

Correct?

 

How do I set state of signal GPIO3_IO0 to be in active-low by default? Set "PUE" bit in PAD control register to 0? By default, all my detected gpios:

sudo gpioinfo gpiochip2

show up as "active-high"

 

In these NXP slides, it's only shown how to do it in userspace using a deprecated method.

How do I do change GPIO's state in userspace using libgpiod library?

0 Kudos

4,172 Views
kunyichen
Contributor IV

you can run "gpioset -h"

remind read "Note" sections or read this

0 Kudos