你好,我使用
SDK: PROCESSOR-SDK-LINUX-AM335X 06_03_00_106
根文件系统: tisdk-image-am335x-evm
对设备树进行了以下修改:
matrix_keypad: matrix_keypad@0 {compatible = "gpio-matrix-keypad";debounce-delay-ms = <5>;col-scan-delay-us = <2>;row-gpios = <&gpio1 16 GPIO_ACTIVE_HIGH/* Bank1, pin25 */&gpio1 19 GPIO_ACTIVE_HIGH/* Bank1, pin26 */&gpio1 23 GPIO_ACTIVE_HIGH&gpio1 24 GPIO_ACTIVE_HIGH/* Bank1, pin26 */&gpio1 25 GPIO_ACTIVE_HIGH&gpio1 26 GPIO_ACTIVE_HIGH/* Bank1, pin25 */&gpio1 27 GPIO_ACTIVE_HIGH/* Bank1, pin26 */&gpio1 13 GPIO_ACTIVE_HIGH>;/* Bank1, pin27 */col-gpios = <&gpio1 18 GPIO_ACTIVE_HIGH/* Bank1, pin21 */&gpio1 21 GPIO_ACTIVE_HIGH/* Bank1, pin21 */&gpio1 22 GPIO_ACTIVE_HIGH>;/* Bank1, pin22 */linux,keymap = <0x0001003b/* MENU */0x0002003c/* BACK */0x0100003d/* LEFT */0x0102003e/* RIGHT */0x0200003f/* ENTER */0x02000040/* BACK */0x03000041/* LEFT */0x03010042/* RIGHT */0x03020043/* ENTER */ 0x040000440x04010045/* RIGHT */0x04020046/* ENTER */0x05000047/* BACK */0x05010048/* LEFT */0x06000049/* RIGHT */0x0601004a/* ENTER */0x0602004b0x0700004c/* RIGHT */0x0701004d/* ENTER */0x0702004e>;/* DOWN */}; matrix_keypad_s0: matrix_keypad_s0 { pinctrl-single,pins = < AM33XX_IOPAD(0x840, PIN_INPUT_PULLUP | MUX_MODE7) /* gpmc_a0.gpio1 16 */ AM33XX_IOPAD(0x84c, PIN_INPUT_PULLUP | MUX_MODE7) /* gpmc_a3.gpio1 19 */ AM33XX_IOPAD(0x85c, PIN_INPUT_PULLUP | MUX_MODE7) /* gpmc_a7.gpio1 23 */ AM33XX_IOPAD(0x860, PIN_INPUT_PULLUP | MUX_MODE7) /* gpmc_a8.gpio1 24 */ AM33XX_IOPAD(0x864, PIN_INPUT_PULLUP | MUX_MODE7) /* gpmc_a9.gpio1 25 */ AM33XX_IOPAD(0x868, PIN_INPUT_PULLUP | MUX_MODE7) /* gpmc_a10.gpio1 26 */ AM33XX_IOPAD(0x86c, PIN_INPUT_PULLUP | MUX_MODE7) /* gpmc_a11.gpio1 27 */ AM33XX_IOPAD(0x834, PIN_INPUT_PULLUP | MUX_MODE7) /* gpmc_ad13.gpio1 13 */ AM33XX_IOPAD(0x848, PIN_OUTPUT_PULLUP | MUX_MODE7) /* gpmc_a2.gpio1 18 */ AM33XX_IOPAD(0x854, PIN_OUTPUT_PULLUP | MUX_MODE7) /* gpmc_a5.gpio1 21 */ AM33XX_IOPAD(0x858, PIN_OUTPUT_PULLUP | MUX_MODE7) /* gpmc_a6.gpio1 22 */ >; };
上电按键无反应
root@am335x-evm:/dev/input/by-path# evtest /dev/input/event1 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 59 (KEY_F1) Event code 60 (KEY_F2) Event code 61 (KEY_F3) Event code 62 (KEY_F4) Event code 63 (KEY_F5) Event code 64 (KEY_F6) Event code 65 (KEY_F7) Event code 66 (KEY_F8) Event code 67 (KEY_F9) Event code 68 (KEY_F10) Event code 69 (KEY_NUMLOCK) Event code 70 (KEY_SCROLLLOCK) Event code 71 (KEY_KP7) Event code 72 (KEY_KP8) Event code 73 (KEY_KP9) Event code 74 (KEY_KPMINUS) Event code 75 (KEY_KP4) Event code 76 (KEY_KP5) Event code 77 (KEY_KP6) Event code 78 (KEY_KPPLUS) Event type 4 (EV_MSC) Event code 4 (MSC_SCAN) Key repeat handling: Repeat type 20 (EV_REP) Repeat code 0 (REP_DELAY)Value250 Repeat code 1 (REP_PERIOD)Value33 Properties:Testing ... (interrupt to exit)
测试发现 gpmc_a2.、 gpmc_a5.、pmc_a6.三脚均输出高电平,按键并无下拉,请问是哪里修改错误了吗?
Nancy Wang:
请参考am335x GPEVM的keypad部分原理图以及am335x-evm.dts中的keypad配置看一下。
processor-sdk-linux\arch\arm\boot\dts\am335x-evm.dts
processor-sdk-linux\Documentation\devicetree\bindings\input\gpio-matrix-keypad.txt
,
ZB_LAJI:
目前的dts便是参考以上两个文件编写的。
am335xevm中的矩阵键盘好像与CPLD相连,我的电路如下:
,
Nancy Wang:
ZB_LAJI 说:
测试发现 gpmc_a2.、 gpmc_a5.、pmc_a6.三脚均输出高电平,按键并无下拉,请问是哪里修改错误了吗?
能将原理图截图看一下吗?
将gpmc_a2/ gpmc_a5/gpmc_a6根据实际情况修改成高有效或者低有效可以吗?
col-gpios = <&gpio1 18 GPIO_ACTIVE_HIGH/* Bank1, pin21 */&gpio1 21 GPIO_ACTIVE_HIGH/* Bank1, pin21 */&gpio1 22 GPIO_ACTIVE_HIGH>;/* Bank1, pin22 */或者测试一个简单的gpio key测试看看。
,
ZB_LAJI:
原理图就是上一个帖子的图片,
电路图原理为一开始输出均为低电平,当按键按下,输入检测到低,表面某一列按键中有一个按下,所以所有输出先均拉高,再逐一输出低电平,以此判断哪一个按键按下。
已尝试过修改成高有效或者低,无变化。