Ported RPi.GPIO module just now

Moderators: odroid, mdrjr

Ported RPi.GPIO module just now

Unread postby swkim01 » Wed Feb 11, 2015 7:04 pm

I wrote a version of RPi.GPIO module just now.
You can download the package from https://github.com/swkim01/RPi.GPIO-OdroidC1 .
However, the event detect function does not operate at this time.
I guess the kernel's gpio driver has to be modified to enable gpio interrupts.
swkim01
 
Posts: 6
Joined: Tue Jun 25, 2013 7:05 pm
languages_spoken: english
ODROIDs: odroid-x2

Re: Ported RPi.GPIO module just now

Unread postby mikronauts » Thu Feb 12, 2015 12:15 am

Thank you!
http://Mikronauts.com ... Home of RoboPi, Pi Rtc Dio, Pi Jumper, EZasPi
mikronauts
 
Posts: 225
Joined: Wed Aug 27, 2014 4:28 am
Location: Langley, BC, Canada
languages_spoken: english
ODROIDs: odroid-w, odroid c1

Re: Ported RPi.GPIO module just now

Unread postby mlinuxguy » Thu Feb 12, 2015 2:08 am

Cool work! I was just looking at doing that last night, I will pull yours down and see your approach
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 RPi.GPIO module just now

Unread postby mlinuxguy » Thu Feb 12, 2015 7:52 am

Now that this library is ported it would be relatively easy to port these routines that support Adafruit hardware
These are from their RPI/BBB routines on Github:
Code: Select all
# ls -lad Ada*
drwxr-xr-x  6 root root 4096 Feb 11 16:32 Adafruit_Nokia_LCD
drwxr-xr-x  5 root root 4096 Feb 11 16:32 Adafruit_Python_BMP
drwxr-xr-x  6 root root 4096 Feb 11 16:13 Adafruit_Python_DHT
drwxr-xr-x  5 root root 4096 Feb 11 16:43 Adafruit_Python_ILI9341
drwxr-xr-x  5 root root 4096 Feb 11 16:44 Adafruit_Python_MAX31855
drwxr-xr-x  5 root root 4096 Feb 11 16:44 Adafruit_Python_MCP9808
drwxr-xr-x  5 root root 4096 Feb 11 16:31 Adafruit_Python_SSD1306
drwxr-xr-x 21 root root 4096 Feb 11 15:08 Adafruit-Raspberry-Pi-Python-Code


I have some of these boards from Adafruit (it is more a problem of finding them!)
These can use either the RPi.GPIO module for RPI support or their BBB library. Since we would
have a matching RPi.GPIO library for the C1, it should be a pretty easy port

The boards supported under here are mix that use RPi.GPIO and others that don't:
Code: Select all
# ls Adafruit-Raspberry-Pi-Python-Code/
Adafruit_ADS1x15       Adafruit_DHT_Driver         Adafruit_LSM303    Adafruit_PWM_Servo_Driver
Adafruit_ADXL345       Adafruit_DHT_Driver_Python  Adafruit_MCP230xx  Adafruit_TCS34725
Adafruit_BMP085        Adafruit_I2C                Adafruit_MCP3002   Adafruit_VCNL4000
Adafruit_CharLCD       Adafruit_LEDBackpack        Adafruit_MCP3008   README.md
Adafruit_CharLCDPlate  Adafruit_LEDpixels          Adafruit_MCP4725
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 RPi.GPIO module just now

Unread postby Maeur1 » Thu Feb 12, 2015 4:04 pm

Nice work dude, I just tested it, for anyone that gets stuck, reboot after the install and the module should load properly (one of the problems i was having)

Some feedback, The Extra B+ pins arent working :(, it would be great to have the extra GPIO, but hey, this is a great start!

It makes all the GPIO scripts I had on my pi easily portable to the C1 now that this exists!
Maeur1
 
Posts: 4
Joined: Sun Dec 14, 2014 4:52 pm
languages_spoken: English

Re: Ported RPi.GPIO module just now

Unread postby mdrjr » Sat Feb 14, 2015 6:55 am

Made it sticky
mdrjr
Site Admin
 
Posts: 11694
Joined: Fri Feb 22, 2013 11:34 pm
Location: Brazil
languages_spoken: english, portuguese
ODROIDs: -

Re: Ported RPi.GPIO module just now

Unread postby metzenw » Mon Mar 02, 2015 5:28 am

metzenw
 
Posts: 1
Joined: Mon Mar 02, 2015 5:24 am
languages_spoken: english
ODROIDs: C1 and Light

Re: Ported RPi.GPIO module just now

Unread postby chlorisdroid » Wed Mar 04, 2015 8:36 pm

Worked for this cheap stepper motor from pollin.de -> http://www.pollin.de/shop/dt/NjU0OTg2OT ... SM_5V.html
Steppermotor set S-SPSM-5V , which contains motor driver with IC ULN2003A and motor 28BYJ-48 for 4,95 Euro (about 5,51 Dollar)
Quae volumus, credimus libenter.
User avatar
chlorisdroid
 
Posts: 141
Joined: Wed Feb 11, 2015 4:14 am
Location: Düsseldorf, Germany
languages_spoken: english,german,netherlands
ODROIDs: c1,c1+, c2, hifi-shield

Re: Ported RPi.GPIO module just now

Unread postby ViolentRockstar » Mon Jun 01, 2015 12:52 am

This might sound a bit amateuristic, but what is the module's name? RPi.GPIO I guess?
ViolentRockstar
 
Posts: 40
Joined: Sun Jan 04, 2015 12:15 am
languages_spoken: english, dutch
ODROIDs: ODROID-C1

Re: Ported RPi.GPIO module just now

Unread postby amazing » Tue Jun 02, 2015 5:51 pm

thank you! good work!

... works fine on a Odroid-C1 -> 16x2 LCD. (german language)
~~~ free your mind and the rest will follow ~~~
User avatar
amazing
 
Posts: 2
Joined: Tue Jun 02, 2015 3:10 pm
Location: Germany
languages_spoken: english, german
ODROIDs: 2x O-C1

Re: Ported RPi.GPIO module just now

Unread postby ViolentRockstar » Wed Jun 03, 2015 1:44 am

Alright, can't get it to work properly. I've installed the module etc. but any gpio commands under the module 'RPi.GPIO' does not exist. Help please!
ViolentRockstar
 
Posts: 40
Joined: Sun Jan 04, 2015 12:15 am
languages_spoken: english, dutch
ODROIDs: ODROID-C1

Re: Ported RPi.GPIO module just now

Unread postby amazing » Wed Jun 03, 2015 9:31 am

Hello Vio,

if you mean the Adafruit-Raspberry-Pi-Modules, then you can get them from Adafruit itself. After installing the RPi.GPIO-OdroidC1 from swkim01, you can just use them on an Odroid-C1 :)

greetz
~~~ free your mind and the rest will follow ~~~
User avatar
amazing
 
Posts: 2
Joined: Tue Jun 02, 2015 3:10 pm
Location: Germany
languages_spoken: english, german
ODROIDs: 2x O-C1

Re: Ported RPi.GPIO module just now

Unread postby ViolentRockstar » Wed Jun 03, 2015 9:12 pm

amazing wrote:Hello Vio,

if you mean the Adafruit-Raspberry-Pi-Modules, then you can get them from Adafruit itself. After installing the RPi.GPIO-OdroidC1 from swkim01, you can just use them on an Odroid-C1 :)

greetz


Thanks! I'll try it in a few :D
ViolentRockstar
 
Posts: 40
Joined: Sun Jan 04, 2015 12:15 am
languages_spoken: english, dutch
ODROIDs: ODROID-C1

Re: Ported RPi.GPIO module just now

Unread postby cogitator » Wed Nov 04, 2015 4:00 am

Hi guys I tried to get the RPi-GPIO working on an XU4.
Maybe someone can help ...

After python setup.py install I get:
running install
running build
running build_py
running build_ext
running install_lib
running install_egg_info
Removing /usr/local/lib/python2.7/dist-packages/RPi.GPIO-0.5.9.egg-info
Writing /usr/local/lib/python2.7/dist-packages/RPi.GPIO-0.5.9.egg-info


Then I did a reboot, but when I tried to run the example script it returns:
Traceback (most recent call last):
File "test.py", line 36, in <module>
import RPi.GPIO as GPIO
RuntimeError: This module can only be run on a Raspberry Pi!


Cheers David
cogitator
 
Posts: 6
Joined: Wed Oct 28, 2015 9:53 pm
Location: Mönchengladbach, Germany
languages_spoken: english german
ODROIDs: 4x XU4

Re: Ported RPi.GPIO module just now

Unread postby swkim01 » Mon Dec 21, 2015 4:53 pm

We added event detect/hardware pwm/adc functions to the module. Check out https://github.com/swkim01/RPi.GPIO-OdroidC1.
swkim01
 
Posts: 6
Joined: Tue Jun 25, 2013 7:05 pm
languages_spoken: english
ODROIDs: odroid-x2

Re: Ported RPi.GPIO module just now

Unread postby pax0r » Mon Jun 27, 2016 10:39 pm

Hi, is the event/interupt functionality limited to 4/8 GPIOs as stated in Odroid wiki (http://odroid.com/dokuwiki/doku.php?id= ... rdware_irq) or there is some software emulation which allows for more events?
pax0r
 
Posts: 2
Joined: Sat Jun 04, 2016 12:14 am
languages_spoken: english, polish
ODROIDs: ODROID C0

Re: Ported RPi.GPIO module just now

Unread postby AcE Krystal » Fri Aug 05, 2016 6:13 pm

I'm getting the same error as cogitator:

I'm trying to get this running on an Odroid C2.

Downloaded the code from github;
$ python setup.py install
I did do a restart already.
$ python test.py (or any other script with import RPi.GPIO)

Gives me this error:

Traceback (most recent call last):
File "test.py", line 36, in <module>
import RPi.GPIO as GPIO
RuntimeError: This module can only be run on a Raspberry Pi!
User avatar
AcE Krystal
 
Posts: 8
Joined: Tue Dec 16, 2014 10:32 pm
languages_spoken: english
ODROIDs: C1, C1+, C2

Re: Ported RPi.GPIO module just now

Unread postby AcE Krystal » Sat Aug 06, 2016 11:10 am

I found my problem already.

The C2 does not has hardware SPI. So i'm using a C1+ now.


Still I'm running into a problem that I can't seem to get solved:

I'm trying to use this library: https://github.com/etrombly/RFM69
Bit i'm getting stuck on this line:
Code: Select all
 GPIO.add_event_detect(self.intPin, GPIO.RISING, callback=self.interruptHandler)


I'm getting the following error:
Code: Select all
Traceback (most recent call last):
  File "./example.py", line 8, in <module>
    test = RFM69.RFM69(RF69_433MHZ, 1, 1, True)
  File "/home/odroid/work/lib/RFM69/RFM69.py", line 115, in __init__
    GPIO.add_event_detect(self.intPin, GPIO.RISING, callback=self.interruptHandler)
RuntimeError: Failed to add edge detection


If I comment the GPIO.add..... line out the script seems to run fine without this line.

intPin = pin 18 in this code.
For this I enabled the GPIO-IRQ with the following command as described in: http://odroid.com/dokuwiki/doku.php?id= ... connectors
Code: Select all
echo 102 > /sys/class/gpio/export



I hope someone can help me with this.
I'm also seeing something strange in https://github.com/swkim01/RPi.GPIO-Odr ... e/common.c

I see:
Code: Select all
// For ODROID-C Board
//
// pinToGpio:
//   Take a Wiring pin (0 through X) and re-map it to the ODROID_GPIO pin
//
const int pinToGpioOdroidC[41] = {   // BCM ModE
     -1,  -1,  -1,  -1,  83, 101, 100, 118, // 0..7
    117, 106, 107, 105,  99, 108,  -1,  -1, // 8..15
     98,  88,  87,  97,  -1,  -1, 115, 104, // 16..23
    102, 103,  -1, 116,  -1,  -1,  -1,  -1, // 24..31
// Padding:
     -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1, // ... 40
};

//
// physToGpio:
//   Take a physical pin (1 through 40) and re-map it to the ODROID_GPIO pin
//
const int physToGpioOdroidC[41] =   // BOARD MODE
{
  -1,       // 0
  -1,  -1,   // 1, 2
  -1,  -1,
  -1,  -1,
  83,  -1,
  -1,  -1,
  88,  87,
 116,  -1,
 115, 104,
  -1, 102,
 107,  -1,
 106, 103,
 105, 117,
  -1, 118,   // 25, 26

  -1,  -1,
 101,  -1,
 100,  99,
 108,  -1,
  97,  98,
  -1,  -1,
  -1,  -1, // 39, 40
} ;
// end of Odroid-C


I don't understand why there is pinToGpioOdroidC and physToGpioOdroidC
And I also don't understand the pin mapping, they both seem to be not the same as http://odroid.com/dokuwiki/doku.php?id= ... connectors.
I tryed my own mapping:
Code: Select all
const int pinToGpioOdroidC[41] = {      // BCM ModE
     -1,  -1,  -1,  74,  -1,  75,  -1,  83, // 0..7
    113,  -1, 114,  88,  87, 116,  -1, 115, // 8..15
    104,  -1, 102, 107,  -1, 106, 103, 105, // 16..23
    117,  -1,  118, 76,  77, 101,  -1, 100, // 24..31
// Padding:
     99, 108,  -1,  97,  98,  -1,  -1,  -1, // 32..39
      -1 // 40

and runned again:
sudo python setup.py install

But I'm still getting the "Failed to add edge detection" error.

Can someone explain me also why there are different mappings for the OdroidC and why there both not 100% matching with what Hardkernel is advertising?
User avatar
AcE Krystal
 
Posts: 8
Joined: Tue Dec 16, 2014 10:32 pm
languages_spoken: english
ODROIDs: C1, C1+, C2

Re: Ported RPi.GPIO module just now

Unread postby eudoxos » Tue Dec 06, 2016 6:23 am

Did someone successfully used this module with C2? Is there some tentative port?
eudoxos
 
Posts: 21
Joined: Tue Sep 27, 2016 5:50 pm
languages_spoken: english german french italian czech
ODROIDs: C2


Return to Hardware and peripherals

Who is online

Users browsing this forum: No registered users and 7 guests