User space uses gpio output to try, error;
Use PB08 to output 1-----corresponding to 40: 32*(BA) + 08 = 40
# echo 40 > export
sh: write error: Device or resource busy
# echo 41 > export
sh: write error: Device or resource busy
# echo 42 > export
# cd gpio42/
# ls
active_low direction edge power subsystem uevent value
# echo out > direction
# echo 0 > value
PB08 and PB09 are wrong, PB10 is correct;
The PB08 and PB09IO ports should be occupied, and the resources have been allocated;
Verify the following; you can view the board-level configuration file, or you can view it directly in the kernel;
Board file:
/* ****************************GPIO KEY START******************************** */
#define GPIO_HOME_KEY GPIO_PC(6)
#define ACTIVE_LOW_HOME 0
#define GPIO_VOLUMEUP_KEY GPIO_PB(8)
#define ACTIVE_LOW_VOLUMEUP 0
#define GPIO_VOLUMEDOWN_KEY GPIO_PB(9)
#define ACTIVE_LOW_VOLUMEDOWN 0
//#define GPIO_ENDCALL_KEY GPIO_PC(8)
//#define ACTIVE_LOW_ENDCALL 0
#define GPIO_MENU_KEY GPIO_PC(8)
#define ACTIVE_LOW_MENU 0
/* ****************************GPIO KEY END********************************** */
do configure the keys
View in the kernel and enter the following two commands
#mount -t debugfs debugfs /tmp
#cat /tmp/gpio
GPIOs 0-31, GPIO A:
GPIOs 32-63, GPIO B:
gpio-32 (NC_PIN ) in hi
gpio-33 (NC_PIN ) in hi
gpio-34 (NC_PIN ) in hi
gpio-35 (NC_PIN ) in hi
gpio-36 (NC_PIN ) in hi
gpio-38 (0BB뢆 ) out lo
gpio-40 (volum up key ) in lo
gpio-41 (volum down key ) in hi
gpio-45 (yellow ) out lo
gpio-46 (green ) out lo
gpio-47 (red ) out lo
gpio-48 (lcd rd ) out hi
gpio-50 (lcd cs ) out lo
gpio-59 (NC_PIN ) in hi
gpio-60 (NC_PIN ) in hi
gpio-61 (NC_PIN) in hi
gpio-62 (NC_PIN) in lo
GPIOs 64-95, GPIO C:
gpio-70 (home key) in lo
gpio-72 (menu key) in lo
gpio-88 (NC_PIN) in hi
gpio-89 (pwm0) in lo
GPIOs 96-101, GPIO D:
gpio-96 (lcd rst) out hi
gpio-97 (BL PWR) out hi
gpio-100 (0BB) out hi
gpio-101 (0BB 뢆) out hi
It is found that PB08 and PB09 have been set as buttons, and PB10 is not occupied;
Consistent with the board-level configuration file;
Turn off PB08 PB09 and configure PB10 as menu button
/* ****************************GPIO KEY START******************************** */
#define GPIO_HOME_KEY GPIO_PC(6)
#define ACTIVE_LOW_HOME 0
//#define GPIO_VOLUMEUP_KEY GPIO_PB(8)
//#define ACTIVE_LOW_VOLUMEUP 0
//
//#define GPIO_VOLUMEDOWN_KEY GPIO_PB(9)
//#define ACTIVE_LOW_VOLUMEDOWN 0
//#define GPIO_ENDCALL_KEY GPIO_PC(8)
//#define ACTIVE_LOW_ENDCALL 0
#define GPIO_MENU_KEY GPIO_PB(10)
#define ACTIVE_LOW_MENU 0
/* ****************************GPIO KEY END********************************** */