Navigation

    全志在线开发者论坛

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • 在线文档
    • 社区主页

    uboot下执行key_test adc_driver,发现例程里gpadc检测不到按键

    V Series
    3
    4
    1832
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      pengjunchao LV 4 last edited by pengjunchao

      我想在uboot下加一个按键检测,用的V853开发板,开机使用的gpadc读按键

      sunxi_gpadc_init();
      ret = sunxi_gpadc_read(0);
      

      但ret检测到的都是-1,发现函数sunxi_gpadc_read()内的ints = readl(GP_DATA_INTS); 读GP_DATA_INTS寄存器一直都是0根本改不了值,不知道为什么,现在不知道怎么在uboot检测按键了。
      随后发现ubot的key_test有关于gpadc的例程,跑了之后发现也检测不到按键,现在就无语了。
      想问问大家怎么办

      S 1 Reply Last reply Reply Quote Share 0
      • whycan
        whycan晕哥 LV 9 last edited by

        @pengjunchao
        我这边测试也是 -1

        打印寄存器也是对的

        => key_test adc_driver
        GP_CTRL = 0x2009004
        gpadc read volxxxxxx:  -1
        gpadc read volxxxxxx:  -1
        gpadc read volxxxxxx:  -1
        
        P 1 Reply Last reply Reply Quote Share 0
        • P
          pengjunchao LV 4 @whycan last edited by

          @whycan 屏幕截图 2023-01-03 103532.png
          加上ints数值的打印你能打印到1 吗,如果不能那返回就一定是-1。

          printk("%s:%d ints:%d\n", FUNCTION, LINE, ints);

          1 Reply Last reply Reply Quote Share 0
          • S
            spr2023 LV 4 @pengjunchao last edited by

            @pengjunchao uboot 里面gpadc不好使的话,你这里是读取ints一直是-1;需要确认一下 sunxi_gpadc_read 之前的 sunxi_gpadc_init 函数里面初始化选择的哪个channel,和你read的是不是同一个channel。另外如果init函数里面channel配置的正确,可以检查一下 init 第一步设置 0x09ec 寄存器是否有效,第一步和第二步分别对应设置0x09ec寄存器的16bit和0bit为1;如果没设置进去的话,后续确实其他寄存器没有办法改变

            1 Reply Last reply Reply Quote Share 0
            • 1 / 1
            • First post
              Last post

            Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号

            行为准则 | 用户协议 | 隐私权政策