您尚未登录。

楼主 #1 2019-10-30 16:43:47

yuanlwjt
会员
注册时间: 2019-10-23
已发帖子: 129
积分: 109

V3S LRADC按键

V3S LRADC按键有没有应用层的历程?

离线

#2 2019-10-30 16:46:00

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: V3S LRADC按键

应用层就是 event 接口, 你可以用 evtest 例程读取, buildroot 配置一下就有了。





离线

#3 2019-10-30 16:49:36

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: V3S LRADC按键

https://elinux.org/images/9/93/Evtest.c

代码在此, 也可以自己编译。





离线

楼主 #4 2019-10-30 17:01:33

yuanlwjt
会员
注册时间: 2019-10-23
已发帖子: 129
积分: 109

Re: 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

离线

#5 2019-10-30 17:17:00

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: V3S LRADC按键

应该没什么问题, 跑跑试一试





离线

楼主 #6 2019-10-30 17:22:58

yuanlwjt
会员
注册时间: 2019-10-23
已发帖子: 129
积分: 109

Re: V3S LRADC按键

谢谢晕哥,请问buildroot该如何配置?menuconfig中的哪项? keyboard input driver?

离线

#7 2019-10-30 17:24:48

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: V3S LRADC按键

直接打开 .config, 找 EVTEST, 然后编辑。

我很少去 menuconfig 里面找。





离线

楼主 #8 2019-10-30 17:35:30

yuanlwjt
会员
注册时间: 2019-10-23
已发帖子: 129
积分: 109

Re: V3S LRADC按键

OK,谢谢

离线

楼主 #9 2019-11-02 09:28:41

yuanlwjt
会员
注册时间: 2019-10-23
已发帖子: 129
积分: 109

Re: V3S LRADC按键

晕哥,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

什么都没有

离线

楼主 #10 2019-11-02 11:52:37

yuanlwjt
会员
注册时间: 2019-10-23
已发帖子: 129
积分: 109

Re: V3S LRADC按键

# 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)

离线

#11 2019-11-02 13:40:58

xgui
会员
注册时间: 2019-09-07
已发帖子: 224
积分: 224

Re: V3S LRADC按键

怎么不对的?

离线

楼主 #12 2019-11-03 18:10:39

yuanlwjt
会员
注册时间: 2019-10-23
已发帖子: 129
积分: 109

Re: V3S LRADC按键

62:        464       GIC  sunxikbd  这是打印出来的,帖子里说中断号是34

离线

#13 2019-11-04 09:22:49

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: V3S LRADC按键

你这个是 bsp linux 吗?





离线

楼主 #14 2019-11-04 14:05:28

yuanlwjt
会员
注册时间: 2019-10-23
已发帖子: 129
积分: 109

Re: V3S LRADC按键

是在芒果派基础上开发的

离线

#15 2019-11-04 14:29:22

我思故我在
会员
注册时间: 2019-09-03
已发帖子: 244
积分: 243.5

Re: V3S LRADC按键

# 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

主线是这样的。

离线

楼主 #16 2019-11-04 14:44:35

yuanlwjt
会员
注册时间: 2019-10-23
已发帖子: 129
积分: 109

Re: V3S LRADC按键

我这边是这样的:
interrupts

离线

楼主 #17 2019-11-04 14:47:14

yuanlwjt
会员
注册时间: 2019-10-23
已发帖子: 129
积分: 109

Re: V3S LRADC按键

我思故我在 说:
# 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

主线是这样的。

该怎么改?

离线

楼主 #18 2019-11-04 14:51:37

yuanlwjt
会员
注册时间: 2019-10-23
已发帖子: 129
积分: 109

Re: V3S LRADC按键

我思故我在 说:
# 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芯片

离线

楼主 #19 2019-11-04 14:59:16

yuanlwjt
会员
注册时间: 2019-10-23
已发帖子: 129
积分: 109

Re: V3S LRADC按键

目前看中断没有进去,没有触发event0事件
evtest
外部短路lradc引脚到地,没有中断产生。test不再进行下去

最近编辑记录 yuanlwjt (2019-11-04 15:00:18)

离线

#20 2019-11-04 15:07:33

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: V3S LRADC按键

bsp 的按键我记得是可以用的。





离线

楼主 #21 2019-11-04 15:10:03

yuanlwjt
会员
注册时间: 2019-10-23
已发帖子: 129
积分: 109

Re: V3S LRADC按键

cat event0 | hexdump 命令 
没有事件发生

离线

楼主 #22 2019-11-05 11:12:06

yuanlwjt
会员
注册时间: 2019-10-23
已发帖子: 129
积分: 109

Re: V3S LRADC按键

问题终于解决,不是软件问题,硬件问题,LRADC使用外部32.768k的时钟,这个无源晶振的电路上应该并联10M 1%的电阻。

离线

#23 2019-11-05 11:32:29

超级萌新
会员
注册时间: 2018-05-04
已发帖子: 408
积分: 407

Re: V3S LRADC按键

LRADC用了32k外部晶振?能不能用内部的?

离线

楼主 #24 2019-11-05 15:11:45

yuanlwjt
会员
注册时间: 2019-10-23
已发帖子: 129
积分: 109

Re: V3S LRADC按键

用内部时钟分频需要改驱动吧

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn