二师兄2_0 2025-03-27 10:10 采纳率: 23.1%
浏览 5

gpio readall报错

请问一下,为什么安装了wiringOP后执行gpio readll报错?板子是orangepi one,ubuntu 内核版本是5.4,重新刷了系统还是一样的错误?


root@orangepione:/wiringOP/wiringOP-next# ./build clean
wiringPi:   [Clean]
DevLib:     [Clean]
gpio:       [Clean]
Examples:   [Clean]
Gertboard:  [Clean]
PiFace:     [Clean]
Quick2Wire: [Clean]
PiGlow:     [Clean]
scrollPhat: [Clean]
Deb: 
root@orangepione:/wiringOP/wiringOP-next# ./build 
wiringPi Build script
=====================


WiringPi Library
[UnInstall]
[Compile] wiringPi.c
[Compile] wiringSerial.c
[Compile] wiringShift.c
[Compile] piHiPri.c
[Compile] piThread.c
[Compile] wiringPiSPI.c
[Compile] wiringPiI2C.c
[Compile] softPwm.c
[Compile] softTone.c
wiringPi.c: In function ‘orangepi_pwm_set_act’:
wiringPi.c:3797:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if (act_cys >= pwm_period || act_cys < 0)
                ^~
[Compile] mcp23008.c
[Compile] mcp23016.c
wiringPi.c: In function ‘orangepi_get_gpio_mode’:
wiringPi.c:6384:59: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
                                                 if (index >= 0 && index <= 11)
                                                           ^~
wiringPi.c:6404:17: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
       if (index >= 0 && index <= 1)
                 ^~
wiringPi.c:6430:59: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
                                                 if (index >= 0 && index <= 7)
                                                           ^~
wiringPi.c:6438:59: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
                                                 if (index >= 0 && index <= 1)
                                                           ^~
wiringPi.c:6445:59: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
                                                 if (index >= 0 && index <= 1)
                                                           ^~
wiringPi.c:6453:59: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
                                                 if (index >= 0 && index <= 19)
                                                           ^~
[Compile] mcp23017.c
wiringPi.c: In function ‘orangepi_set_gpio_mode’:
wiringPi.c:7550:17: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
       if (index >= 0 && index <= 11)
                 ^~
wiringPi.c:7570:17: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
       if (index >= 0 && index <= 1)
                 ^~
wiringPi.c:7582:18: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
       if( (index >= 0 && index <=1) && PWM_OUTPUT == mode )
                  ^~
wiringPi.c:7600:17: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
       if (index >= 0 && index <= 7)
                 ^~
wiringPi.c:7609:17: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
       if (index >= 0 && index <= 1)
                 ^~
wiringPi.c:7616:17: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
       if (index >= 0 && index <= 1)
                 ^~
wiringPi.c:7625:17: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
       if (index >= 0 && index <= 19)
                 ^~
wiringPi.c: In function ‘rk3588_set_pwm_reg’:
wiringPi.c:6785:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
      printf("You can select wiringPi pin 0/2/5/8/9/10/14/16 for PWM pin.\n");
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
wiringPi.c:6786:5: note: here
     case PI_MODEL_5B:
     ^~~~
[Compile] mcp23s08.c
[Compile] mcp23s17.c
[Compile] sr595.c
[Compile] pcf8574.c
[Compile] pcf8591.c
[Compile] mcp3002.c
[Compile] mcp3004.c
[Compile] mcp4802.c
[Compile] mcp3422.c
[Compile] max31855.c
[Compile] max5322.c
[Compile] ads1115.c
[Compile] sn3218.c
[Compile] bmp180.c
[Compile] htu21d.c
[Compile] ds18b20.c
[Compile] rht03.c
[Compile] drcSerial.c
[Compile] drcNet.c
[Compile] pseudoPins.c
[Compile] wpiExtensions.c
[Compile] w25q64.c
[Compile] oled.c
[Link (Dynamic)]
[Install Headers]
[Install Dynamic Lib]

WiringPi Devices Library
[UnInstall]
[Compile] ds1302.c
[Compile] maxdetect.c
[Compile] piNes.c
[Compile] gertboard.c
[Compile] piFace.c
[Compile] lcd128x64.c
[Compile] lcd.c
[Compile] scrollPhat.c
[Compile] piGlow.c
[Link (Dynamic)]
[Install Headers]
[Install Dynamic Lib]

GPIO Utility
[Compile] gpio.c
[Compile] readall.c
gpio.c: In function ‘doUsbP’:
gpio.c:944:25: warning: unused parameter ‘argc’ [-Wunused-parameter]
 static void doUsbP (int argc, char *argv [])
                         ^~~~
gpio.c:944:37: warning: unused parameter ‘argv’ [-Wunused-parameter]
 static void doUsbP (int argc, char *argv [])
                                     ^~~~
readall.c: In function ‘OrangePiReadAll’:
readall.c:2395:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
    printf (" +------+-----+----------+--------+---+  AI PRO  +---+--------+----------+-----+------+\n");
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
readall.c:2396:3: note: here
   case PI_MODEL_RV:
   ^~~~
[Link]
[Install]

All Done.

NOTE: To compile programs with wiringPi, you need to add:
    -lwiringPi
  to your compile line(s) To use the Gertboard, MaxDetect, etc.
  code (the devLib), you need to also add:
    -lwiringPiDev
  to your compile line(s).

root@orangepione:/wiringOP/wiringOP-next# gpio readll
wiringPiSetup: mmap (PWM) failed: Invalid argument

  • 写回答

3条回答 默认 最新

  • 阿里嘎多学长 2025-03-27 10:10
    关注

    阿里嘎多学长整理AIGC生成,因移动端显示问题导致当前答案未能完全显示,请使用PC端查看更加详细的解答过程

    gpio readall报错

    你安装了wiringOP后执行gpio readall报错,这可能是因为wiringOP安装后,系统的gpio模块没有被正确地配置或加载。

    在OrangePi One上,wiringOP安装后,需要手动加载gpio模块。可以尝试执行以下命令:

    sudo modprobe gpio
    

    如果上述命令执行成功, gpio readall命令应该能够正确地工作。如果仍然报错,可以尝试查看系统日志,查看是否有相关的错误信息:

    sudo dmesg | grep gpio
    

    此外,也可以尝试执行gpio命令,查看是否能够正确地工作:

    gpio -v
    

    如果你已经重新刷了系统,可能需要重新安装wiringOP和gpio模块。可以尝试执行以下命令:

    sudo apt-get install wiringpi
    sudo modprobe gpio
    

    如果你仍然遇到问题,可以提供更多的错误信息和系统配置信息,以便更好地帮助你解决问题。

    评论

报告相同问题?

问题事件

  • 创建了问题 3月27日