Connect GPIO on IMX7ULP evk

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

Connect GPIO on IMX7ULP evk

569 Views
LegoBox
Contributor II

Hello,

 

I need some explanation for driving a button knob on my IMX7ULP evk.

What i've tried:

Adding to custom dts:

 

    gpio-keys {
		compatible = "gpio-keys";
		autorepeat;

		enter {
			label = "GPIO Key Enter";
			linux,code = <KEY_ENTER>;
			gpios = <&gpio_ptf 9 GPIO_ACTIVE_HIGH>;
		};
    };

 

Added to imx7ulp-evk.dts

 

	pinctrl_enter: enter_grp {
		fsl,pins = <
			IMX7ULP_PAD_PTF9__PTF9        0x0b0b0 
		>;
	};

 

The button is connected from GND & Target(D10 arduino header == PTF9)

Evtest shows me that the event is available, so the probing is completed. But when i hit the button nothing happens. I assume it has something to do with pull-up input that the button requires. But it never triggers.

When i change:

 

GPIO_ACTIVE_HIGH -> GPIO_ACTIVE_LOW

 

It keeps spamming the enter key. And i can't abort it.

 

How do i handle GPIO input buttons correctly with IMX7?

 

Tags (2)
0 Kudos
3 Replies

532 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hi @LegoBox 

I hope you are doing well.

It seems input voltage of the mentioned GPIO is not accurate and doesn't match the VIH and VIL levels of the processor.

Can you please measure the input voltage on GPIO pin with both the changes GPIO_ACTIVE_HIGH and GPIO_ACTIVE_LOW? Please share the results here.

Can you please share the schematic  connection between button and processor?

Thanks & Regards

Sanket Parekh

 

528 Views
Sanket_Parekh
NXP TechSupport
NXP TechSupport

Hi @LegoBox 

Waiting for your answer.

Thanks & Regards

Sanket Parekh

0 Kudos

536 Views
edwardtyrrell
Senior Contributor I

Hi @LegoBox,

You may need to break the problem down, first confirm you have the correct pin and GPIO number. It's probably fine but GPIO numbers can catch anyone out. Make the GPIO pin toggle or read back from it first then once that's confirmed readdress your interrupt issue. Reading back from the pin will also confirm if you need a pullup etc. 

Depending on your kernel you may have /sys/class/gpio available, this method is being deprecated in favour of the gpiod method for newer kernels. If you have the /sys/class/gpio ABI then make sure the pin has not been used in the device tree.  

https://www.kernel.org/doc/Documentation/gpio/sysfs.txt

Quote "Export the pin:  Example: "echo 19 > export" will create a "gpio19" node
for GPIO #19, if that's not requested by kernel code."

Set and use GPIO5 (in userspace / terminal)

echo 5 > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio5/direction
echo 1 > /sys/class/gpio/gpio5/value   // set pin high

Read from GPIO84

echo 84 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio84/direction
cat /sys/class/gpio/gpio84/value     // Read the pin

Hope it helps.