Jump to content

WiringOP & Python on OrangePi 5 plus


Timur Timaev

Recommended Posts

Hello everyone!
 

I was struggling to make wiring work on OrangePi 5 Plus armbian. Tried everything and came up with a solution that worked for me.

 

I was constantly getting these errors:

wiringPiSetup: mmap (PWM) failed: Operation not permitted
wiringPiSetup: mmap (GPIO) failed: Operation not permitted


I'm on 23.8.2.

 

1. Install armbian and update apt 

sudo apt update

 

2. As stated in OrangePi5Plus wiki page I got .deb installer for wiringPi on OrangePi

Quote

Note that wiringOP has been pre-installed in the linux image released by Orange Pi. Unless the code of wiringOP is updated, there is no need to re-download, compile and install, just use it directly.

The storage path of the compiled wiringOP deb package in orangepi-build is:

orangepi-build/external/cache/debs/arm64/wiringpi_x.xx.deb

 

Now here's the link to this file:
https://github.com/orangepi-xunlong/orangepi-build/blob/next/external/cache/debs/arm64/wiringpi_2.51.deb

3. The most important step was described here: https://github.com/Joshua-Riek/ubuntu-rockchip/issues/273

echo "BOARD=orangepi5plus" | sudo tee /etc/orangepi-release

Somehow this solves the issue. No idea how these things work tbh...

 

4. Check if pins are detected via

gpio readall

or add sudo

sudo gpio readall

 

You should get a table with all the pins and numbers like this:

Screenshot2023-12-13at01_43_10.thumb.png.5f4bfd89c422ba42d595596f34d0aafe.png

 

5. Install wiringop-python just as stated in the manual: http://www.orangepi.org/orangepiwiki/index.php/Orange_Pi_5_Plus#How_to_install_wiringOP-Python

# get the dependencies
sudo apt-get update
sudo apt-get -y install git swig python3-dev python3-setuptools

# clone wiringOP-python repo, the branch should be "next" and NOT "main" or "master"
git clone --recursive https://github.com/orangepi-xunlong/wiringOP-Python -b next

cd wiringOP-Python
git submodule update --init --remote
python3 generate-bindings.py > bindings.i
sudo python3 setup.py install

 

The wiringOP-Python should be working now.

Link to comment
Share on other sites

Armbian & Khadas are rewarding contributors

I confirm on Armbian bookworm v24.5.5 stable, wiringOP expects a line in

/etc/orangepi-release

indicating the board name

BOARD=orangepi5plus


Maybe the build maintainer will include the change by default in the image for Orange Pi 5 Plus boards? 😊

Link to comment
Share on other sites

Would make more sense if the wiringop maintainers change to /etc/armbian-release since orangepi images are based on Armbian. They forked the framework years ago, did "sed s/armbian/orangepi/g" across the whole code and added hacks to make their boards somehow work.

Link to comment
Share on other sites

Please tell me.
I find it difficult to answer the question myself:
Has Armbian always had BOARD=orangepi5-plus for the Orange Pi 5 Plus board and similarly in orangepi images?
For the current Armbian

cat /etc/armbian-release 

-> BOARD=orangepi5-plus, in turn wiringOP expects orangepi5plus.
Don't judge strictly, 🙂 it would be interesting to come to some adequate solution, maybe create a request for inclusion in wiringop with the addition of the line

else if (strncmp(revision, "orangepi5-plus.", 14) == 0) { *model = PI_MODEL_5_PLUS; }


as an option.
Thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines