Ported WiringPi2-Python to Odroid on github

Moderators: mdrjr, odroid

Ported WiringPi2-Python to Odroid on github

Unread postby mlinuxguy » Wed Feb 11, 2015 7:21 am

I just finished porting the Python wrapper for WiringPI2 to the Odroid
It didn't take that much to get working.. However I only tested softpwm.py and hello.py
in the examples directory.

The ported wrapper can be found here:

https://github.com/mlinuxguy/WiringPi2-odroid-c1
wiring-pi2-odc1.pdf
PDF map of Wiring-Pi2-Python pin names
(32.79 KiB) Downloaded 1195 times
Last edited by mlinuxguy on Wed Feb 11, 2015 9:22 am, edited 6 times in total.
mlinuxguy
 
Posts: 793
Joined: Thu Feb 28, 2013 10:28 am
languages_spoken: english
ODROIDs: X, X2, XU, XU3, XU4, C1, C1+, C2, N1, USB-IO

Re: I ported WiringPi2-Python to Odroid

Unread postby mlinuxguy » Wed Feb 11, 2015 8:05 am

Notes: Use the RPI directions on choosing the GPIO pin 1-x
For example for the softpwm.py test I used:
The C1's pin 12 on the header for python's GPIO pin #1 and the C1's pin #9 for gnd

A nice reference is here: http://wiringpi.com/pins/
We probably need to make a nice map similar to that one for the Odroid-C1
Also we need to create wrappers for the additional pins that the C1 has, or wait for
WiringPi2-Python to be updated for the RPI2/B+ then port again.
(I've never used wiring-pi2 on a B+ so don't know if it supports all 40pins)


Todo:
(1) add support for additional pins (27-40)
(2) verify all examples work
Last edited by mlinuxguy on Wed Feb 11, 2015 12:58 pm, edited 1 time in total.
mlinuxguy
 
Posts: 793
Joined: Thu Feb 28, 2013 10:28 am
languages_spoken: english
ODROIDs: X, X2, XU, XU3, XU4, C1, C1+, C2, N1, USB-IO

Re: Ported WiringPi2-Python to Odroid on github

Unread postby mlinuxguy » Wed Feb 11, 2015 10:30 am

Looking into further edits on the WiringPi2-Python support for Odroid
questions/comments:
(1) RPI -> device = '/dev/ttyAMA0' is currently mapped to C1 -> /dev/ttyS2
(2) .. more to come
mlinuxguy
 
Posts: 793
Joined: Thu Feb 28, 2013 10:28 am
languages_spoken: english
ODROIDs: X, X2, XU, XU3, XU4, C1, C1+, C2, N1, USB-IO

Re: Ported WiringPi2-Python to Odroid on github

Unread postby railton » Fri Feb 13, 2015 8:48 am

The Pi4J runs on wiringpi, will now work in the PI4J ODROID-C1?
railton
 
Posts: 5
Joined: Mon Jan 20, 2014 10:50 pm
languages_spoken: english portuguese

Re: Ported WiringPi2-Python to Odroid on github

Unread postby mlinuxguy » Fri Feb 13, 2015 9:06 am

I don't see where Pi4J needs the python wrapper that I ported.
Instead it just requires wiringPi which was already ported by Hardkernel:
ref: http://pi4j.com/install.html#WiringPi_Native_Library

For wiring PI itself refer to the HK WIKI: http://odroid.com/dokuwiki/doku.php?id=en:c1_tinkering
mlinuxguy
 
Posts: 793
Joined: Thu Feb 28, 2013 10:28 am
languages_spoken: english
ODROIDs: X, X2, XU, XU3, XU4, C1, C1+, C2, N1, USB-IO

Re: Ported WiringPi2-Python to Odroid on github

Unread postby railton » Fri Feb 13, 2015 11:42 am

i'm sorry, my mistake.
railton
 
Posts: 5
Joined: Mon Jan 20, 2014 10:50 pm
languages_spoken: english portuguese

Re: Ported WiringPi2-Python to Odroid on github

Unread postby aag » Fri Feb 13, 2015 1:08 pm

Here is the ODROID C1 pin map: odroid-c1-pinmap.pdf (v1.2), includes hardware PWM and 1-wire default pins.
Edit: changed mega.co.nz link to github repo
Last edited by aag on Thu Feb 19, 2015 5:04 pm, edited 2 times in total.
aag
 
Posts: 4
Joined: Fri Feb 06, 2015 1:49 pm
languages_spoken: english
ODROIDs: C1

Re: Ported WiringPi2-Python to Odroid on github

Unread postby mlinuxguy » Mon Feb 16, 2015 11:34 am

I updated my Github repo for WiringPi2-Python with his pinput PDF
If you clone the repo you will get the PDF...
mlinuxguy
 
Posts: 793
Joined: Thu Feb 28, 2013 10:28 am
languages_spoken: english
ODROIDs: X, X2, XU, XU3, XU4, C1, C1+, C2, N1, USB-IO

Re: Ported WiringPi2-Python to Odroid on github

Unread postby redy_w » Tue Apr 07, 2015 2:28 pm

any dedicated driver GPIO Odroid at Python? so we didn't compare with another SBC product?
User avatar
redy_w
 
Posts: 26
Joined: Mon Feb 09, 2015 11:49 am
languages_spoken: english
ODROIDs: ODROID-C1

Re: Ported WiringPi2-Python to Odroid on github

Unread postby Taliessin » Wed Apr 08, 2015 8:08 am

Hi I have been trying to get the wiringPi Libraries working with my Odroid C1.

However I am having some issues with getting them set up. I've tried a few different tutorials I've found online, but I keep coming to a point where I get this error:

Code: Select all
Unable to determine hardware version. I see: Hardware : ODROIDC
,
 - expecting BCM2708 or BCM2709. Please report this to projects@drogon.net​


I have gotten this both on when trying to run the gpio -v command (as a means to test if one of the attempts was working) and also in my most recent attempt when trying to perform the build at the very end of this set of instructions taken from this thread: viewtopic.php?f=115&t=7648

1. Install python and setuptools

apt-get install python-setuptools python-dev python3-setuptools python3-dev

2. Get the wiringPi2 Python library

git clone https://github.com/synthead/WiringPi2-Python.git

3. Build firstly the wiringPi library

cd WiringPi2-Python/
rm -rf WiringPi/

4. Get and build the wiringPi library compatible ODROID-C1

git clone https://github.com/hardkernel/wiringPi
cd wiringPi
./build
mv wiringPi WiringPi <— change as the WiringPi2-Python default

5. Build WiringPi2 Python
cd ..
./build.sh


Any clues as to how I can fix this, or a well detailed set of instructions for how to set up the library?

I appreciate any help I can get!
Taliessin
 
Posts: 1
Joined: Wed Apr 08, 2015 7:54 am
languages_spoken: english
ODROIDs: C1

Re: Ported WiringPi2-Python to Odroid on github

Unread postby alxxG » Sat Apr 11, 2015 6:52 pm

No idea if this is the correct way but its working for me.

What I did was

git clone https://github.com/hardkernel/wiringPi
cd wiringPi
sudo make;make install
cd ..
git clone https://github.com/mlinuxguy/WiringPi2-odroid-c1
cd WiringPi2-odroid-c1
sudo make;make install
cd ..

sudo python
>>import wiringpi2
>>wiringpi2.PiSetup()
0

cntrl z

gpio -v
gpio version 2.21

Copyright (c) 2012-2014 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warrranty

Hardkernel ODROID Details:
Type: ODROID-C, Revision: 1, Memory: 1024MB, Maker: Hardkernel
alxxG
 
Posts: 8
Joined: Sat Jan 11, 2014 6:26 pm
Location: Sydney, Australia
languages_spoken: english
ODROIDs: 2xC1

Re: Ported WiringPi2-Python to Odroid on github

Unread postby NuttyPr0fess0r » Mon Apr 20, 2015 10:49 am

Thanks, mlinuxguy! Your library works great on my C-1 :^)
User avatar
NuttyPr0fess0r
 
Posts: 5
Joined: Fri Apr 03, 2015 8:01 am
languages_spoken: english
ODROIDs: U-3
C-1

Re: Ported WiringPi2-Python to Odroid on github

Unread postby rujik » Wed Apr 22, 2015 8:52 am

when i check gpio readall

terminal show that
unable to determine hardware version. i see hardware odroidC

anyone can help me?
rujik
 
Posts: 2
Joined: Sun Jan 25, 2015 4:28 pm
languages_spoken: english
ODROIDs: C 1

Re: Ported WiringPi2-Python to Odroid on github

Unread postby rvsuper8 » Mon Apr 27, 2015 9:58 pm

alxxG wrote:No idea if this is the correct way but its working for me.

What I did was

git clone https://github.com/hardkernel/wiringPi
cd wiringPi
sudo make;make install
cd ..
git clone https://github.com/mlinuxguy/WiringPi2-odroid-c1
cd WiringPi2-odroid-c1
sudo make;make install
cd ..

sudo python
>>import wiringpi2
>>wiringpi2.PiSetup()
0

cntrl z

gpio -v
gpio version 2.21

Copyright (c) 2012-2014 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warrranty

Hardkernel ODROID Details:
Type: ODROID-C, Revision: 1, Memory: 1024MB, Maker: Hardkernel


I got to here and received the following error.

root@odroid:/# sudo python
Python 2.7.6 (default, Mar 22 2014, 23:30:12)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import wiringpi2
>>> wiringpi2.PiSetup()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'PiSetup'
>>>
rvsuper8
 
Posts: 12
Joined: Tue Feb 10, 2015 4:37 am
languages_spoken: english
ODROIDs: C-1

Re: Ported WiringPi2-Python to Odroid on github

Unread postby nomad_cam » Sun May 03, 2015 5:21 pm

rvsuper8 wrote:
I got to here and received the following error.

root@odroid:/# sudo python
Python 2.7.6 (default, Mar 22 2014, 23:30:12)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import wiringpi2
>>> wiringpi2.PiSetup()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'PiSetup'
>>>


try wiringpi2.wiringPiSetup() instead of wiringpi2.PiSetup()
nomad_cam
 
Posts: 2
Joined: Fri May 01, 2015 4:56 pm
languages_spoken: english
ODROIDs: U2, X2, C1

Re: Ported WiringPi2-Python to Odroid on github

Unread postby Footniko » Mon Jul 13, 2015 8:00 pm

Is it possible to use simple GPIO as PWM output with this library?
Footniko
 
Posts: 13
Joined: Fri May 29, 2015 8:27 pm
languages_spoken: english
ODROIDs: Odroid C-1

Re: Ported WiringPi2-Python to Odroid on github

Unread postby Footniko » Thu Jul 16, 2015 12:50 am

I just tried and it works! It's also possible to use GPIO as software PWM. Thank you mlinuxguy and alxxG!
Footniko
 
Posts: 13
Joined: Fri May 29, 2015 8:27 pm
languages_spoken: english
ODROIDs: Odroid C-1

Re: Ported WiringPi2-Python to Odroid on github

Unread postby willemb » Fri Sep 18, 2015 8:41 am

I had the same problem until I realized that I had followed the readme instructions at github which in turn had me actually downloading the wiringpi2-python for the raspberry pi. You need to git this link instead: git clone https://github.com/mlinuxguy/WiringPi2-odroid-c1.git



Taliessin wrote:Hi I have been trying to get the wiringPi Libraries working with my Odroid C1.

However I am having some issues with getting them set up. I've tried a few different tutorials I've found online, but I keep coming to a point where I get this error:

Code: Select all
Unable to determine hardware version. I see: Hardware : ODROIDC
,
 - expecting BCM2708 or BCM2709. Please report this to projects@drogon.net​


I have gotten this both on when trying to run the gpio -v command (as a means to test if one of the attempts was working) and also in my most recent attempt when trying to perform the build at the very end of this set of instructions taken from this thread: viewtopic.php?f=115&t=7648

1. Install python and setuptools

apt-get install python-setuptools python-dev python3-setuptools python3-dev

2. Get the wiringPi2 Python library

git clone https://github.com/synthead/WiringPi2-Python.git

3. Build firstly the wiringPi library

cd WiringPi2-Python/
rm -rf WiringPi/

4. Get and build the wiringPi library compatible ODROID-C1

git clone https://github.com/hardkernel/wiringPi
cd wiringPi
./build
mv wiringPi WiringPi <— change as the WiringPi2-Python default

5. Build WiringPi2 Python
cd ..
./build.sh


Any clues as to how I can fix this, or a well detailed set of instructions for how to set up the library?

I appreciate any help I can get!
willemb
 
Posts: 12
Joined: Tue Sep 15, 2015 1:43 pm
languages_spoken: english
ODROIDs: c1+

Re: Ported WiringPi2-Python to Odroid on github

Unread postby sboyce » Fri Apr 29, 2016 10:51 pm

We have a question about -C2 GPIO lines and interrupts, needing to attach 2 rotary encoders and about 4 - 6 switches.
The quoted text below is from an email I received.
" The real question is how many can be associated with interrupts to
reduce the amount that have to be polled. I have not found much
information on that. I believe that the C1+ can only have 4. That
means only one encoder as you need an interrupt on the clock and data
lines for rising and falling. The real question is how many can be associated with interrupts to
reduce the amount that have to be polled. I have not found much
information on that. I believe that the C1+ can only have 4. That
means only one encoder as you need an interrupt on the clock and data
lines for rising and falling."
sboyce
 
Posts: 157
Joined: Thu Feb 28, 2013 7:17 am
languages_spoken: english
ODROIDs: ODROID-X

Re: Ported WiringPi2-Python to Odroid on github

Unread postby odroid » Sun May 01, 2016 9:11 am

C1/C2 has only 8 GPIO interrupt handlers.
If you need falling and rising event detection, it can only have 4 unfortunately.
User avatar
odroid
Site Admin
 
Posts: 28610
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Ported WiringPi2-Python to Odroid on github

Unread postby edoz90 » Fri Jun 03, 2016 11:18 pm

Hi! I've some problem with the `lcdCharDef` function

Code: Select all
import wiringpi2


LCD_ROW = 2   # 16 Char
LCD_COL = 16  # 2 Line
LCD_BUS = 4   # Interface 4 Bit mode

PORT_LCD_RS = 7  # GPIOY.BIT3(#83)
PORT_LCD_E = 0   # GPIOY.BIT8(#88)
PORT_LCD_D4 = 2  # GPIOX.BIT19(#116)
PORT_LCD_D5 = 3  # GPIOX.BIT18(#115)
PORT_LCD_D6 = 1  # GPIOY.BIT7(#87)
PORT_LCD_D7 = 4  # GPIOX.BIT4(#104)

wiringpi2.wiringPiSetup()
lcdHandle = wiringpi2.lcdInit(LCD_ROW, LCD_COL, LCD_BUS,
                              PORT_LCD_RS, PORT_LCD_E,
                              PORT_LCD_D4, PORT_LCD_D5,
                              PORT_LCD_D6, PORT_LCD_D7, 0, 0, 0, 0)

c = [
    int('0b11011', 2),
    int('0b10001', 2),
    int('0b01010', 2),
    int('0b11011', 2),
    int('0b11011', 2),
    int('0b11011', 2),
    int('0b11011', 2),
    int('0b11011', 2)
]

wiringpi2.lcdCharDef(lcdHandle, 0, c)


running the code I get:
Code: Select all
TypeError: in method 'lcdCharDef', argument 3 of type 'unsigned char [8]'
edoz90
 
Posts: 7
Joined: Tue May 03, 2016 2:45 am
languages_spoken: english
ODROIDs: odroid-c2

Re: Ported WiringPi2-Python to Odroid on github

Unread postby KC7NOA » Wed Jun 08, 2016 5:32 am

any progress?

I plan on using wireing-Pi too ....
KC7NOA
 
Posts: 833
Joined: Wed Feb 27, 2013 2:25 pm
languages_spoken: english
ODROIDs: Odroid-X2(blown HDMI output)
Odroid-C2 to replace X2

Re: Ported WiringPi2-Python to Odroid on github

Unread postby edoz90 » Wed Jun 08, 2016 6:24 am

KC7NOA wrote:any progress?

I plan on using wireing-Pi too ....


About my problem no...I just didn't use that char...
edoz90
 
Posts: 7
Joined: Tue May 03, 2016 2:45 am
languages_spoken: english
ODROIDs: odroid-c2

Re: Ported WiringPi2-Python to Odroid on github

Unread postby Brian.K » Wed Jun 08, 2016 4:03 pm

edoz90 wrote:Hi! I've some problem with the `lcdCharDef` function

Code: Select all
import wiringpi2


LCD_ROW = 2   # 16 Char
LCD_COL = 16  # 2 Line
LCD_BUS = 4   # Interface 4 Bit mode

PORT_LCD_RS = 7  # GPIOY.BIT3(#83)
PORT_LCD_E = 0   # GPIOY.BIT8(#88)
PORT_LCD_D4 = 2  # GPIOX.BIT19(#116)
PORT_LCD_D5 = 3  # GPIOX.BIT18(#115)
PORT_LCD_D6 = 1  # GPIOY.BIT7(#87)
PORT_LCD_D7 = 4  # GPIOX.BIT4(#104)

wiringpi2.wiringPiSetup()
lcdHandle = wiringpi2.lcdInit(LCD_ROW, LCD_COL, LCD_BUS,
                              PORT_LCD_RS, PORT_LCD_E,
                              PORT_LCD_D4, PORT_LCD_D5,
                              PORT_LCD_D6, PORT_LCD_D7, 0, 0, 0, 0)

c = [
    int('0b11011', 2),
    int('0b10001', 2),
    int('0b01010', 2),
    int('0b11011', 2),
    int('0b11011', 2),
    int('0b11011', 2),
    int('0b11011', 2),
    int('0b11011', 2)
]

wiringpi2.lcdCharDef(lcdHandle, 0, c)


running the code I get:
Code: Select all
TypeError: in method 'lcdCharDef', argument 3 of type 'unsigned char [8]'

Thank you for the report. It is a bug on old wiringPi-Python binder. Link
Fixed at a1d2484 commit.
User avatar
Brian.K
 
Posts: 246
Joined: Tue Sep 15, 2015 7:30 pm
Location: South Korea
languages_spoken: English, Korean
ODROIDs: XU4, C1+, C2

Re: Ported WiringPi2-Python to Odroid on github

Unread postby jack23233 » Sun Oct 02, 2016 3:47 am

I am trying to move a homebuilt app from a raspberryPi to my Odroid-C, and trying to deal with the RPIO tranlstion issues.
I am trying to follow installation posted by "aixxG" on Apr 11, 2015

having the following issues trying to load wiringpi2 for the -C1

odroid@odroidC:~$ git clone https://github.com/mlinuxguy/WiringPi2-odroid-c1.git
Cloning into 'WiringPi2-odroid-c1'...
remote: Counting objects: 217, done.
remote: Total 217 (delta 0), reused 0 (delta 0), pack-reused 217
Receiving objects: 100% (217/217), 677.73 KiB | 210.00 KiB/s, done.
Resolving deltas: 100% (94/94), done.
Checking connectivity... done. ..................................this appears to be OK

odroid@odroidC:~$ cd WiringPi2-odroid-c1
odroid@odroidC:~/WiringPi2-odroid-c1$ sudo make;make Install
swig2.0 -python wiringpi.i
make: swig2.0: Command not found
Makefile:5: recipe for target 'bindings' failed
make: *** [bindings] Error 127
make: *** No rule to make target 'Install'. Stop. ....................... this is the error


My odroid uname-a
Linux odroidC 3.10.103-166 #1 SMP PREEMPT Mon Sep 19 15:03:34 UTC 2016 armv7l armv7l armv7l GNU/Linux

also, perhaps interesting, after the above error, issuing the gpio -v command
gpio version: 2.33
Copyright (c) 2012-2014 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Hardkernel ODROID Details:
Type: ODROID-C1/C1+, Revision: 1, Memory: 1024MB, Maker: Hardkernel

your help will be appreciated.
jack23233
 
Posts: 25
Joined: Wed Mar 20, 2013 4:55 am
languages_spoken: english
ODROIDs: U2,u3,c1

Re: Ported WiringPi2-Python to Odroid on github

Unread postby mlinuxguy » Sun Oct 02, 2016 8:19 am

Try: sudo apt-get install swig
mlinuxguy
 
Posts: 793
Joined: Thu Feb 28, 2013 10:28 am
languages_spoken: english
ODROIDs: X, X2, XU, XU3, XU4, C1, C1+, C2, N1, USB-IO

Re: Ported WiringPi2-Python to Odroid on github

Unread postby jack23233 » Sun Oct 02, 2016 8:36 am

sudo apt-get install swig2.0
(it wanted to install swig3.0, which caused errors also)
jack23233
 
Posts: 25
Joined: Wed Mar 20, 2013 4:55 am
languages_spoken: english
ODROIDs: U2,u3,c1


Return to Hardware and peripherals

Who is online

Users browsing this forum: No registered users and 1 guest