VIM3 GPIO Problems with use

Oops: Unable to determine board revision from /proc/cpuinfo
→ No “Revision” line
→ You’d best google the error to find out why.

Linux version 4.9.241 What causes this?

@huliqi2019 Which board? Which firmware you used?

VIM3/VIM3_Ubuntu-server-focal_Linux-4.9_arm64_EMMC_V1.0.5-210430

Please upgrade to latest version and check again.

Welcome to Fenix 1.0.5 Ubuntu 20.04.2 LTS Linux 4.9.241
Does this version not support?

Welcome to Fenix 1.0.7 Ubuntu 20.04.3 LTS Linux 4.9.241

Still can’t :joy:

Please provide the full operations.

Update steps:
$ sudo apt update
$ sudo apt full-upgrade
$ sudo do-fenix-full-upgrade
$ sync
$ sudo reboot
Updated according to the official manual.
Test steps:
1.sudo pip3 install wiringpi
2.code as follows

import wiringpi as GPIO

INPUT = 0
OUTPUT = 1
OUTPUT_PIN = 37
INPUT_PIN = 39
OUTPUT_HIGH = 1
OUTPUT_LOW = 0
pinstatus_list = ['LOW','HIGH']

GPIO.wiringPiSetup()

3.An error is reported after running

You don’t need to install wiringpi, there already has a preinstalled version. The wiringpi from Ubuntu offical doesn’t work on VIM3, you need to use the preinstalled version.

Please reinstall the wiringpi:

$ sudo apt reinstall wiringpi

After this show the output below:

$ $ dpkg -l | grep wiringpi

目前是可以了,但是获取pin脚的值时我将38与39脚短接(38脚默认是3.3V),获取到的值一直是0,代码如下:

import wiringpi as GPIO
import time 

INPUT = 0
OUTPUT = 1
OUTPUT_PIN = 37
INPUT_PIN = 39
OUTPUT_HIGH = 1
OUTPUT_LOW = 0
pinstatus_list = ['LOW','HIGH']

GPIO.wiringPiSetup()
GPIO.pinMode(OUTPUT_PIN, OUTPUT)
GPIO.pinMode(INPUT_PIN, INPUT)

GPIO.digitalWrite(OUTPUT_PIN, OUTPUT_HIGH)

while True:
    result = GPIO.digitalRead(INPUT_PIN)
    print("------:",result)
    time.sleep(3)

PIN39是一个特殊管脚,是OD输出,需要自己外接上拉。可以试试别的GPIO。

我将PIN20与PIN15短接,然后将PIN15设置成输入模式,再读取PIN15的值,一直返回0?这样也是不行的吗?

import wiringpi as GPIO
import time 

INPUT = 0
OUTPUT = 1
INPUT_PIN = 15
GPIO.wiringPiSetup()
GPIO.pinMode(INPUT_PIN, INPUT)
while True:
    result = GPIO.digitalRead(INPUT_PIN)
    print("------:",result)
    time.sleep(3)

你要先看看你用的脚默认配置的是是不是GPIO功能,有可能默认配置的是复用为别的功能。使用gpio readall查看下。

如果是复用为别的功能,你可以参考文档进行功能配置。