When using imx6ul the rid_device_info_keyboard matrix function, after the completion of the configuration in the device tree, found the following phenomena:
- (1) input GPIO default for high level 3 lines, press the button, will be down to less than 1 V (about 0.8 V),
- (2) according to the hexdump) log observation, found that the output seems wrong, press a button for all input column GPIO test to high level, (log) at the end of the article attached
Free of big help to look at, analyze the reasons for the potential problems? Isn't me to reuse the node value of the register allocation in it? KPP node configuration in the device tree is wrong?
2, project background
1, use imx6ul implement matrix keyboard function, USES the matrix framework;
2, and 3 row by 8 column matrix keyboard, eight columns GPIO all external 3.3 k pulldown resistor, schematic diagram below (each intersection represents a key) :
3, the development process:
1, first of all use GPIO export function combined with C language in the application layer function of matrix keyboard tests pass, so it can conclude that
- (1) the keyboard corresponding row, column GPIO are controlled,
- (2) the matrix keyboard circuit design and correct physics,
2, matrix keyboard configuration in the device tree code, as follows:
& amp; KPP {
Compatible="gpio - matrix - keypad";
Pinctrl - names="default";
Pinctrl - 0=& lt; & Pinctrl_key & gt;;
Debounce delay - ms=& lt; 20 & gt;;
Col - scan - delay - us=& lt; 20 & gt;;
/* 4 */
The row - gpios=& lt; & Gpio2 16 GPIO_ACTIVE_LOW
& 17 GPIO_ACTIVE_LOW gpio2
& 19 GPIO_ACTIVE_LOW gpio2 & gt;;
/* * 8 column/
Col - gpios=& lt; & 8 GPIO_ACTIVE_LOW gpio2
& Gpio2 9 GPIO_ACTIVE_LOW
& Gpio2 10 GPIO_ACTIVE_LOW
& 11 GPIO_ACTIVE_LOW gpio2
& 12 GPIO_ACTIVE_LOW gpio2
& 13 GPIO_ACTIVE_LOW gpio2
& 14 GPIO_ACTIVE_LOW gpio2
& 15 GPIO_ACTIVE_LOW gpio2 & gt;;
/* row0 */
Linux, keymap=& lt; 0 x00000069/* KEY_left - & gt; 105 - & gt; 69 */
0 x00010067/* KEY_up - & gt; 103 - & gt; 67 */
0 x0002003b/* KEY_f1 - & gt; 59 - & gt; 3 b */
0 x0003002d/* KEY_fx - & gt; 45 - & gt; 2 d KEY_X */
0 x00040008/* KEY_7 - & gt; 8 - & gt; 8 */
0 x00050005/* KEY_4 - & gt; 5 - & gt; 5 */
0 x00060002/* KEY_1 - & gt; 2 - & gt; 2 */
0 x00070032/* KEY_m - & gt; 50 - & gt; 32 */
Row1/* */
0 x0100006c/* KEY_down - & gt; 108 - & gt; 6 c */
0 x0101006a/* KEY_right - & gt; 106 - & gt; 6 a */
0 x0102003c/* KEY_f2 - & gt; 60 - & gt; 3 c */
0 x01030018/* KEY_f0 - & gt; 24 - & gt; 18 KEY_O */
0 x01040009/* KEY_8 - & gt; 9 - & gt; 9 */
0 x01050006/* KEY_5 - & gt; 6 - & gt; 6 */
0 x01060003/* KEY_2 - & gt; 3 - & gt; 3 */
0 x0107000b/* KEY_0 - & gt; 11 - & gt; B */
Row2/* */
/* 0 x0200001c */
/* 0 x0201001c */
0 x0202001c/* KEY_Enter - & gt; 28 - & gt; 001 c */
0 x02030017/* KEY_Fi - & gt; 23 - & gt; 0017 */
0 x0204000a/* KEY_9 - & gt; 10 - & gt; A * 000/
0 x02050007/* KEY_6 - & gt; 7 - & gt; 0007 */
0 x02060004/* KEY_3 - & gt; 4 - & gt; 0004 */
0 x02070034/* KEY_dot - & gt; 52 - & gt; 0034 */
& gt;;
Gpio - activelow;
The status="okay";
//status="disabled".
}
3, reuse node configuration code is as follows:
pinctrl_key: KPPGRP {
FSL, pins=& lt;
/* line row: output mode, take turns to output high level, at the same time can only have a high level */
MX6UL_PAD_SD1_CMD__GPIO2_IO16 0 x70a1
MX6UL_PAD_SD1_CLK__GPIO2_IO17 0 x70a1
MX6UL_PAD_SD1_DATA1__GPIO2_IO19 0 x70a1
/* the column column: input mode, collection level, when the switch is 0, switch to press 1 */
MX6UL_PAD_ENET2_RX_DATA0__GPIO2_IO08 0 xb0b1
MX6UL_PAD_ENET2_RX_DATA1__GPIO2_IO09 0 xb0b1
MX6UL_PAD_ENET2_RX_EN__GPIO2_IO10 0 xb0b1
MX6UL_PAD_ENET2_TX_DATA0__GPIO2_IO11 0 xb0b1
MX6UL_PAD_ENET2_TX_DATA1__GPIO2_IO12 0 xb0b1
MX6UL_PAD_ENET2_TX_EN__GPIO2_IO13 0 xb0b1
MX6UL_PAD_ENET2_TX_CLK__GPIO2_IO14 0 xb0b1
MX6UL_PAD_ENET2_RX_ER__GPIO2_IO15 0 xb0b1
Just a few things, you might suppose shouldn't be hard, but every time I press a button for all buttons are pressed, card for several days, really don't know where the problem is, the bosses, genuflect is begged help see the analysis reason, thank you thank you!!!!!!
Use the command hexdump)/dev/input/event0 test, the log is as follows:
root @ imx6ulevk: ~ # hexdump)/dev/input/event0
Click on the 7:
0000000, 3981, 59 c6 58 cf 0002 0004 0004 0000 0000
0000010, 3981, 59 c6 58 cf 0002 0001 0069 0001 0000
0000020, 3981, 59 c6 58 cf 0002 0004 0004 0001 0000
0000030, 3981, 59 c6 58 cf 0002 0001 0067 0001 0000
0000040, 3981, 59 c6 58 cf 0002 0004 0004 0002 0000
0000050, 3981, 59 c6 58 cf, 0002, 0001, 003 b, 0001, 0000
0000060, 3981, 59 c6 58 cf 0002 0004 0004 0003 0000
0000070, 3981, 59 c6 58 cf, 0002, 0001, 002 d, 0001, 0000
0000080, 3981, 59 c6 58 cf 0002 0000 0000 0001 0000
0000090, 3981, 59 c6 6 ab6 0002 0004 0004 0004 0000
A0 59 c6 6 ab6 0002 0001 0008 3981 00000 0001 0000
00000 b0 59 c6 6 ab6 0002 0004 0004 0005 0000 3981
00000 c0 3981 c6 6 ab6 59, 0002, 0001, 0005, 0001, 0000
D0 59 c6 6 ab6 0002 0004 3981 00000 0004 0006 0000
00000 e0 59 c6 6 ab6 0002 0001 0002 0001 0000 3981
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull