cond080 Posted November 17, 2018 Posted November 17, 2018 Hello I have Opi lite 2 + 28byj-48 driver and step motor, and I want to play around, but can't find RPi.GPIO for OPi lite 2, how can I make it work ? I find pretty good example with raspberry pi http://www.raspberryproject.pl/en/automation/28byj-48-stepper-motor-raspberry-pi/ , I rearranged GPIOs to fit my board but I have error: File "testy.py", line 4, in <module> import RPi.GPIO as GPIO ModuleNotFoundError: No module named 'RPi' Welcome to ARMBIAN 5.67.181116 nightly Ubuntu 18.04.1 LTS 4.19.2-sunxi64 0 Quote
martinayotte Posted November 17, 2018 Posted November 17, 2018 54 minutes ago, cond080 said: but can't find RPi.GPIO for OPi lite 2 You can look at this library, but you will need to tweak base register address to meet the one for H6 : https://github.com/Jeremie-C/OrangePi.GPIO You can read what I've answered previously here : 0 Quote
cond080 Posted November 18, 2018 Author Posted November 18, 2018 15 hours ago, martinayotte said: You can look at this library, but you will need to tweak base register address to meet the one for H6 : https://github.com/Jeremie-C/OrangePi.GPIO thank you I'll try what a %#*$_$* beautiful board OPi lite 2 ! (no) 0 Quote
martinayotte Posted November 18, 2018 Posted November 18, 2018 3 hours ago, cond080 said: what a %#*$_$* beautiful board OPi lite 2 ! (no) All H6 boards take time to get proper support, simply because it has started only few months ago ... 0 Quote
Hazeline Posted January 27, 2019 Posted January 27, 2019 On 11/18/2018 at 3:24 AM, martinayotte said: You can look at this library, but you will need to tweak base register address to meet the one for H6 : https://github.com/Jeremie-C/OrangePi.GPIO Just trying to follow up on this GPIO lib thing. I've tried the above suggested OPi.GPIO library and made some mods to match H6 configuration. But I cannot even compile and build successfully due to a missing 'Python.h' header file. Wondering if anyone has made such GPIO module work on Lite 2 or any H6 based board. I'd appreciate any help on this front. Thanks! 0 Quote
martinayotte Posted January 27, 2019 Posted January 27, 2019 10 hours ago, Hazeline said: But I cannot even compile and build successfully due to a missing 'Python.h' header file This file is installed by "apt-get install python-dev" ... 0 Quote
Hazeline Posted January 28, 2019 Posted January 28, 2019 Thanks, Martin. I've fixed that problem. I ported library and modified the base addresses to match H6. However, cannot get the designated GPIO pin to work. I tried reading back the port control register, but always got 0x0 value, even the default value, according to the DS, should be 0x7777_7777 or any non-zero value. I'm wondering if this has to do with the 32-bit addressing vs 64-bit. Can anyone point me how to proceed? Really appreciated! 0 Quote
martinayotte Posted January 29, 2019 Posted January 29, 2019 On 1/28/2019 at 3:23 AM, Hazeline said: However, cannot get the designated GPIO pin to work I must admit that I've never used this library, and therefore I don't know how to fix it. But instead I've used this one https://github.com/duxingkei33/orangepi_PC_gpio_pyH3 I've tweaked it to support 64bits pointers, like I did previously for H5, and then adjusted the SW_PORTC_IO_BASE define to point to H6 registers at 0x0300B000.. 0 Quote
pako Posted November 23, 2020 Posted November 23, 2020 I return to this old topic. Perhaps someone will be interested in my contribution. I have successfully modified the library https://github.com/Jeremie-C/OrangePi.GPIO, so it also works for H6. You can find the modified library here: https://github.com/Pako2/OrangePi.GPIO. 2 Quote
Cryptimo Posted September 27, 2022 Posted September 27, 2022 On 11/23/2020 at 8:33 AM, pako said: Perhaps someone will be interested in my contribution. I have successfully modified the library https://github.com/Jeremie-C/OrangePi.GPIO, so it also works for H6. You can find the modified library here: https://github.com/Pako2/OrangePi.GPIO. Hello Pako, I am absolutely interested in your contribution. I have been trying to mak Orangepi3 LTS GPIO work with Python. No luck so far. As WiFi does not work in Orangepi 3 LTS Jammy Armbian, I have been forced to use Ubuntu and I have not been succesful in compiling your OrangePi.GPIO. Does the library work in Ubuntu at all? 0 Quote
pako Posted September 27, 2022 Posted September 27, 2022 Hi Cryptimo! I haven't tried it, but I assume it should work. Unfortunately, I don't own OPi 3 LTS, so I can't even try it. I looked in the documentation and I see that fortunately the GPIO layout on the header is exactly the same as on the older OPi 3. When compiling, you can proceed as described on the page https://github.com/Pako2/OrangePi.GPIO. I only have one patch that I haven't published yet (but I have it ready including the H616/OPi Zero 2 support adding). For newer versions of Python (3.9 and greater) command sudo python setup.py install usually ends with the error message error: command 'aarch64-linux-gnu-gcc' failed with exit status 1. In that case, the compilation command must be modified as follows (for boards with H6): sudo CFLAGS="-fcommon" python3 setup.py install --force-h6 Please write here how it went. If there is a problem, I will try to solve it. Pako 0 Quote
Cryptimo Posted October 6, 2022 Posted October 6, 2022 Hello @pako, with "sudo CFLAGS="-fcommon" python3 setup.py install --force-h6" it did compile, thanks fo the help! However, I am now stuck in a new problem, and I do not know if you can help? I can not find the BCM GPIO pinout mappings for Orangepi 3 anywhere. Do you know where to find a mapping of Board-BCM-GPIO numbers? 0 Quote
pako Posted October 6, 2022 Posted October 6, 2022 I am not 100% sure that I will answer this question accurately and truthfully. In my opinion, the BCM numbering on Orange Pi boards makes no sense (I don't use it myself in principle). This only makes sense for Raspberry Pi boards (BCM is short for Broadcom - the manufacturer of the SoC on RPi boards). OrangePi.GPIO is "RPi.GPIO drop-in replacement library for Orange Pi Boards" and its original author (Jeremie-C) apparently wanted (for Allwinner SoC boards) to maintain some degree of compatibility with the original RPi.GPIO library. I actually only made a fork (but extended and fixing some bugs) of the mentioned Jeremie-C project and I did not change the numbering methods introduced by the author. I prefer to use BOARD numbering, which in my opinion makes the most sense (e.g. it greatly facilitates the portability of code between different Orange Pi boards). SOC numbering can also be beneficial in some cases. The SOC number of a GPIO pin can be easily calculated if you know the pin name (like PH18). You can find the procedure here. Or you can use the "GPIO" column from the table for the relevant OPi board from this page. 1 Quote
Cryptimo Posted October 7, 2022 Posted October 7, 2022 Thanks a lot for the links. I now have the OrangePi 3 LTS running and synchronizing with my server as I wish. Next step is to find the correct GPIO pins. This list enabled my software to work https://github.com/rm-hull/OPi.GPIO/blob/master/orangepi/pi3.py 0 Quote
Recommended Posts
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.