Hi,
I've been following this guide: https://www.emcraft.com/som/vf6/controlling-gpio-from-linux
trying to add a keypad to my imx8mm based board.
I added this to my device tree:
[...]
gpio-keys {
compatible = "gpio-keys";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_gpio_keys>;
col0_btn {
label = "COL0_BTN";
gpios = <&gpio1 5 GPIO_ACTIVE_LOW>;
gpio-key,wakeup;
linux,code = <BTN_0>;
};
};
[...]
&iomuxc {
pinctrl_gpio_keys: keys0grp {
fsl,pins = <
MX8MM_IOMUXC_GPIO1_IO05_GPIO1_IO5 0x1d6 /* KEY_C0 */
>;
};
[...]
Checking with 'gpioinfo' command in linux:
root@asdf:~# gpioinfo 0
gpiochip0 - 32 lines:
line 0: unnamed unused input active-high
line 1: unnamed unused input active-high
line 2: unnamed unused input active-high
line 3: unnamed "interrupt" input active-high [used]
line 4: unnamed unused input active-high
line 5: unnamed "COL0_BTN" input active-low [used]
Looks good.
Checking with evtest /dev/input/event0
root@asdf:/# evtest /dev/input/event0
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x1 product 0x1 version 0x100
Input device name: "gpio-keys"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 256 (BTN_0)
Properties:
Testing ... (interrupt to exit)
However, no push of the button is ever registered. I'm wondering if somehow the mapping between
gpios = <&gpio1 5 GPIO_ACTIVE_LOW> and MX8MM_IOMUXC_GPIO1_IO05_GPIO1_IO5 is incorrect and is something other than what seems obvious?
Solved! Go to Solution.
Hello,
It seems that you need to consider Pad Control Register and Pad Mux Register. Please check it on page 1360 and 1516 of reference manual.
Best regards.
Hello,
It seems that you need to consider Pad Control Register and Pad Mux Register. Please check it on page 1360 and 1516 of reference manual.
Best regards.
On our IMX6 board (in which the key press is detected), using the same keypad we have defined the same button as follows:
MX6QDL_PAD_GPIO_9__KEY_COL6 0x1b0b1 // TX6 COL0
Hello,
Your device tree configuration and logs from gpioinfo command seems to be ok. Your input it is detected correctly.
The next we can check is hardware connection, could you please share me your connections?
Best regards.
Hi Jorge,
Here is the schematic for the keypad. It goes to a connector and then on to another custom board which in turn connects to the imx8. We've used this same keypad in an IMX6 based application.
I switched to open drain instead of active low and I get response from COL_0 now though not the buttons themselves.
I suppose I am missing something in how to implement a matrix keyboard. I did some googling but did not manage to find anything useful for the imx8, a lot of stuff just for the imx6 which has a driver for it. Do you have any examples at NXP?