This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3358: Keypad not working

Part Number: AM3358

Hi,

The issue is that the keypad doesn’t respond any key I pressed. I test with evtest “/dev/input/event2”, it repeats to display:

Type 1 (EV_KEY), code 14 (KEY_BACKSPACE), value 2

I configure the keypad as 4x4 matrix-keypad in the devicetree as:

          matrix_keypad: matrix_keypad@0 {

                compatible = "gpio-matrix-keypad";

        /*      linux,wakeup;*/

                debounce-delay-ms = <5>;

                col-scan-delay-us = <2>;

 

                row-gpios = <&gpio2 1 0

                             &gpio2 2 0

                             &gpio2 3 0

                             &gpio2 4 0>;

 

                col-gpios = <&gpio1 12 0

                             &gpio1 13 0

                             &gpio1 14 0

                             &gpio1 28 0>;

                linux,keymap = <0x00000001      /* KEY1 */

                                0x00010002      /* KEY2 */

                                0x00020003      /* KEY3 */

                                0x01000004      /* KEY4 */

                                0x01010005      /* KEY5 */

                                0x01020006      /* KEY6 */

                                0x0103000E      /* KEYEXIT */

                                0x02000007      /* KEY7 */

                                0x02010008      /* KEY8 */

                                0x02020009      /* KEY9 */

                                0x0203000F      /* Key ENTER */ 

                                0x0300000B      /* KEYSTAR */

                                0x0301000A      /* KEY0 */

                                0x0302000C      /* KEYPOUND */

                                0x03030000>;    /* KEYREPLAY */

        };

 

The pin assignments are:

gpio1_pins_default: gpio1_pins_default {

                pinctrl-single,pins = <

                        0x30 ( PIN_OUTPUT_PULLDOWN | MUX_MODE7 ) /* (T12) gpmc_ad12.gpio1[12] */

                        0x34 ( PIN_OUTPUT_PULLDOWN | MUX_MODE7 ) /* (R12) gpmc_ad13.gpio1[13] */

                        0x38 ( PIN_OUTPUT_PULLDOWN | MUX_MODE7 ) /* (V13) gpmc_ad14.gpio1[14] */

                          0x78 ( PIN_OUTPUT_PULLDOWN | MUX_MODE7 ) /* (U18) gpmc_be1n.gpio1[28] */

                 >;

};

gpio2_pins_default: gpio2_pins_default {

                pinctrl-single,pins = <

                        0x8c ( PIN_INPUT_PULLDOWN | MUX_MODE7 ) /* (V12) gpmc_clk.gpio2[1] */

                        0x90 ( PIN_INPUT_PULLDOWN | MUX_MODE7 ) /* (R7) gpmc_advn_ale.gpio2[2] */

                        0x94 ( PIN_INPUT_PULLDOWN | MUX_MODE7 ) /* (T7) gpmc_oen_ren.gpio2[3] */

                        0x98 ( PIN_INPUT_PULLDOWN | MUX_MODE7 ) /* (U6) gpmc_wen.gpio2[4] */

                >;

        };

I don't know where is the cause.

Best regards,

Bruce

  • The software team have been notified. They will respond here.
  • Hello Bruce,

    Are you sure that the /dev/input/event2 is your keypad device? Have you checked whether the row-gpio and col-gpio pins are not already in use by another driver?

    Best regards,
    Kemal

  • Hi Kemal,

    From /dev/input/by-path, I see

    Platform-matrix_keypad@0-event ->../event2

    So, /dev/input/event2 is the matrix keypad.

    I double checked that the row-gpios and col-gpios are not in use by another driver.

    I also changed the debounce-delay-ms to 5, 20, 80, they don’t make any difference.

    I tracked the system log and confirmed that matrix_keypad_probe(), matrix_keypad_scan(), matrix_keypad_init_gpio() are running ok.

     

    Below is the output of evtest “dev/input/event2”:

    Input driver version is 1.0.1

    Input device ID: bus 0x19 vendor 0x0 product 0x0 version 0x0

    Input device name: "matrix_keypad@0"

    Supported events:

      Event type 0 (EV_SYN)

      Event type 1 (EV_KEY)

        Event code 1 (KEY_ESC)

        Event code 2 (KEY_1)

        Event code 3 (KEY_2)

        Event code 4 (KEY_3)

        Event code 5 (KEY_4)

        Event code 6 (KEY_5)

        Event code 7 (KEY_6)

        Event code 8 (KEY_7)

        Event code 9 (KEY_8)

        Event code 10 (KEY_9)

        Event code 11 (KEY_0)

        Event code 12 (KEY_MINUS)

        Event code 14 (KEY_BACKSPACE)

        Event code 15 (KEY_TAB)

      Event type 4 (EV_MSC)

        Event code 4 (MSC_SCAN)

    Key repeat handling:

      Repeat type 20 (EV_REP)

        Repeat code 0 (REP_DELAY)

          Value    250

        Repeat code 1 (REP_PERIOD)

          Value     33

    Properties:

    Testing ... (interrupt to exit)

    Event: time 1515701394.089648, type 1 (EV_KEY), code 14 (KEY_BACKSPACE), value 2

    Event: time 1515701394.089648, -------------- EV_SYN ------------

    Event: time 1515701394.125748, type 1 (EV_KEY), code 14 (KEY_BACKSPACE), value 2

    Event: time 1515701394.125748, -------------- EV_SYN ------------

    Event: time 1515701394.161749, type 1 (EV_KEY), code 14 (KEY_BACKSPACE), value 2

     ......

    I don’t know where is the issue.

     

    Best regards,

    Bruce

  • Hi Kemal,

    I add some printks in matrix_keypad.c to track  matrix_keypad_scan() and find: this function is called during the board bootup. When the board is up running, I start evtest, then I press the keys, I don’t see that this matrix_keypad_scan() gets called. Should it be called when pressing the keys?

    I read am335x-evm.dts, it uses matrix keypad GPIO pins from the same GPIO bank (GPIO1); for my application, I use 4 row GPIOs from GPIO2, 4 column GPIOs from GPIO1, does it cause the issue?

    Best regards,
    Bruce

  • Hi Bruce,
    Are you still having issues? If so, I can take a look at it.

    Steve K.
  • Hi Steve,

    Thanks for your help.

    Right now, keypad is working after we made a fix with hardware wiring.

    Best regards,

    Bruce