V3S LRADC按键有没有应用层的历程?
离线
buildroot该如何配置?menuconfig中的哪项?
就只有一个按键,
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <linux/input.h>
#include <stdlib.h>
struct input_event buff;
int fd;
int read_nu;
int main(int argc, char *argv[])
{
int i = 0;
fd = open("/dev/input/event0", O_RDONLY); //may be the powerkey is /dev/input/event1
if (fd < 0) {
perror("can not open device usbkeyboard!");
exit(1);
}
printf("--fd:%d--\n",fd);
while(1)
{
while(read(fd,&buff,sizeof(struct input_event))==0)
{
;
}
//if(buff.code > 40)
printf("time %u:%u type:%d code:%d value:%d\n",buff.time.tv_sec,buff.time.tv_usec,buff.type,buff.code,buff.value);
//#if 0
//i++;
//if(i > 12)
//{
//break;
//}
//#endif
}
close(fd);
return 1;
}
这段代码可以不?这是例程里的一个key_test.c
离线
谢谢晕哥,请问buildroot该如何配置?menuconfig中的哪项? keyboard input driver?
离线
OK,谢谢
离线
晕哥,LRADC按键 在/dev/input 下 用cat event0 | hexdump 命令
为什么有时上电后能捕捉到事件:
0000000 002f 0000 d95c 0002 0001 0073 0001 0000
0000010 002f 0000 d967 0002 0000 0000 0000 0000
0000020 002f 0000 563e 0003 0001 0073 0000 0000
0000030 002f 0000 5646 0003 0000 0000 0000 0000
0000040 002f 0000 b411 0003 0001 0073 0001 0000
0000050 002f 0000 b41a 0003 0000 0000 0000 0000
0000060 002f 0000 5055 0004 0001 0073 0000 0000
0000070 002f 0000 505f 0004 0000 0000 0000 0000
但有时重新上电捕捉不到啊?
# cat /dev/input/event0 | hexdump
什么都没有
离线
# cat /proc/interrupts
CPU0
29: 119950 GIC arch_timer
30: 0 GIC arch_timer
32: 68 GIC uart0
38: 0 GIC twi0
47: 0 GIC PB
49: 0 GIC PG
50: 0 GIC sunxi_timer0
61: 0 GIC audio_hmic_irq
62: 464 GIC sunxikbd
72: 0 GIC sunxi-rtc alarm
82: 11424 GIC sunxi_dmac
92: 100 GIC sunxi-mmc
97: 71266 GIC spi0
103: 0 GIC sunxi_usb_udc
114: 4640 GIC gmac0
Err: 0
我看了贴子,是不是中断号不对?
最近编辑记录 yuanlwjt (2019-11-02 12:21:17)
离线
62: 464 GIC sunxikbd 这是打印出来的,帖子里说中断号是34
离线
是在芒果派基础上开发的
离线
我这边是这样的:
离线
# cat /proc/interrupts CPU0 19: 4012472 GIC-0 27 Level arch_timer 21: 0 GIC-0 50 Level /soc/timer@01c20c00 22: 0 GIC-0 82 Level 1c02000.dma-controller 23: 0 GIC-0 103 Level musb-hdrc.1.auto 24: 0 GIC-0 104 Level ehci_hcd:usb1 25: 0 GIC-0 105 Level ohci_hcd:usb2 30: 0 GIC-0 62 Level sun4i-a10-lradc-keys 33: 425 GIC-0 33 Level ttyS1 34: 8 GIC-0 34 Level ttyS2 35: 5740272 GIC-0 38 Level mv64xxx_i2c 36: 181 GIC-0 114 Level eth0 37: 1161519 GIC-0 97 Level sun6i-spi IPI0: 0 CPU wakeup interrupts IPI1: 0 Timer broadcast interrupts IPI2: 0 Rescheduling interrupts IPI3: 0 Function call interrupts IPI4: 0 CPU stop interrupts IPI5: 0 IRQ work interrupts IPI6: 0 completion interrupts Err: 0
30: 0 GIC-0 62 Level sun4i-a10-lradc-keys
主线是这样的。
该怎么改?
离线
# cat /proc/interrupts CPU0 19: 4012472 GIC-0 27 Level arch_timer 21: 0 GIC-0 50 Level /soc/timer@01c20c00 22: 0 GIC-0 82 Level 1c02000.dma-controller 23: 0 GIC-0 103 Level musb-hdrc.1.auto 24: 0 GIC-0 104 Level ehci_hcd:usb1 25: 0 GIC-0 105 Level ohci_hcd:usb2 30: 0 GIC-0 62 Level sun4i-a10-lradc-keys 33: 425 GIC-0 33 Level ttyS1 34: 8 GIC-0 34 Level ttyS2 35: 5740272 GIC-0 38 Level mv64xxx_i2c 36: 181 GIC-0 114 Level eth0 37: 1161519 GIC-0 97 Level sun6i-spi IPI0: 0 CPU wakeup interrupts IPI1: 0 Timer broadcast interrupts IPI2: 0 Rescheduling interrupts IPI3: 0 Function call interrupts IPI4: 0 CPU stop interrupts IPI5: 0 IRQ work interrupts IPI6: 0 completion interrupts Err: 0
30: 0 GIC-0 62 Level sun4i-a10-lradc-keys
主线是这样的。
我这边用的是V3S芯片
离线
目前看中断没有进去,没有触发event0事件
外部短路lradc引脚到地,没有中断产生。test不再进行下去
最近编辑记录 yuanlwjt (2019-11-04 15:00:18)
离线
cat event0 | hexdump 命令
没有事件发生
离线
问题终于解决,不是软件问题,硬件问题,LRADC使用外部32.768k的时钟,这个无源晶振的电路上应该并联10M 1%的电阻。
离线
用内部时钟分频需要改驱动吧
离线