WiringPi for Odroid C1

Moderators: mdrjr, odroid

WiringPi for Odroid C1

Unread postby RWAP » Fri May 04, 2018 7:04 pm

I have an Odroid C1 and have a HAT with software I have developed and use successfully on the Raspberry Pi, Banana Pi and Orange Pi PC.

I use the WiringPi library to access the GPIO header which makes it easier for cross-platform support.

However, I am struggling to get it working on the Odroid C1.

I tried:

a) apt-get install wiringpi
gpio -v
reports an error - unknown device.
gpio readall
also reports an error

b) I therefore installed the WiringPi library from:

https://github.com/hardkernel/wiringPi

I cloned this to the Odroid C1 and it installs v2.33 (same as apt-get)

gpio-v
works and identifies the device as Odroid C1 / C2
gpio readall
then works

However, when I try running my software I see the error:
**************** wiringPiGpioCheck ****************

Call Function = pinMode, wiringPiMode = WPI_MODE_PINS

Error gpio control (OrigPin = 9, pin = -1)

c) I tried (as per the readme on https://github.com/hardkernel/wiringPi ) to clone and install wiringPi from
git://git.drogon.net/wiringPi

This appeared to install v2.49
gpio -v
reports the machine as a raspberry pi, and gpio readall works, but my code doesn't - no leds - nothing... (and no errors)

I am using the following wiring pins:
inputs { 8, 1, 7, 0 , 2 , 3 , 12, 13, 14, 11 };
outputs { 4, 5, 10};
leds { 6 ,10, 9}

The 3 LEDs remain ON constantly using the https://github.com/hardkernel/wiringPi version.

So - any ideas what is causing this?
RWAP
 
Posts: 14
Joined: Mon Apr 30, 2018 4:28 am
languages_spoken: english
ODROIDs: Odroid C1

Re: WiringPi for Odroid C1

Unread postby RWAP » Fri May 04, 2018 7:24 pm

I have managed to fix this, by using the development branch:

git clone git://github.com/hardkernel/wiringPi -b dev
RWAP
 
Posts: 14
Joined: Mon Apr 30, 2018 4:28 am
languages_spoken: english
ODROIDs: Odroid C1

Re: WiringPi for Odroid C1

Unread postby RWAP » Fri May 04, 2018 7:44 pm

There are however, a couple of issues:

1 - I don't seem to get any data on wiring pin 8 (unlike the other implementations)
2 - digitalWrite (9, LOW); does not tun off my LED connected to that pin

Looking at the output of gpio readall, wiring pins 8 and 9 are not connected to the GPIO header :(

Any ideas as to why this is?
RWAP
 
Posts: 14
Joined: Mon Apr 30, 2018 4:28 am
languages_spoken: english
ODROIDs: Odroid C1

Re: WiringPi for Odroid C1

Unread postby odroid » Fri May 04, 2018 7:49 pm

Wiring pin #8 and #9 don't exist on C2. Refer the pin map in this WiKi page.
https://wiki.odroid.com/odroid-c1/hardw ... connectors

Also check "lsmod" output to remove any unused preloaded device drivers.

BTW, we will check it with C1, C2 and XU4 together early next week.
If the master branch doesn't work, we will update this wiki page.
https://wiki.odroid.com/odroid-xu4/appl ... o/wiringpi
User avatar
odroid
Site Admin
 
Posts: 28292
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: WiringPi for Odroid C1

Unread postby RWAP » Fri May 04, 2018 8:06 pm

odroid wrote:Wiring pin #8 and #9 don't exist on C2. Refer the pin map in this WiKi page.
https://wiki.odroid.com/odroid-c1/hardw ... connectors


Is there a reason for that ? The Raspberry Pi seems to use the two pins for the same thing, so it just means my HAT will not work with the Odroid which is a shame... :(
RWAP
 
Posts: 14
Joined: Mon Apr 30, 2018 4:28 am
languages_spoken: english
ODROIDs: Odroid C1

Re: WiringPi for Odroid C1

Unread postby odroid » Fri May 04, 2018 9:34 pm

We will try to find a way use the I2C pins as a normal GPIO with WiringPi early next week.
Image
Image
User avatar
odroid
Site Admin
 
Posts: 28292
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: WiringPi for Odroid C1

Unread postby RWAP » Sat Jun 09, 2018 10:15 pm

Has any progress been made with this?
RWAP
 
Posts: 14
Joined: Mon Apr 30, 2018 4:28 am
languages_spoken: english
ODROIDs: Odroid C1

Re: WiringPi for Odroid C1

Unread postby odroid » Mon Jun 11, 2018 10:25 am

Sorry. I forgot this thread.

Can you toggle C1+ Pin#3 and Pin#5 on the command line?
Pin#3 is mapped to GPIO 74, Pin#5 is mapped to GPIO 75.
Try to export the GPIOs and change the direction to output and toggle the output level.
https://wiki.odroid.com/odroid-c1/application_note/gpio/enhancement_40pins#enhancement_of_40pin_gpio

If it works, we will modify the WiringPi source code quickly to support those two additional IO ports.
User avatar
odroid
Site Admin
 
Posts: 28292
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: WiringPi for Odroid C1

Unread postby RWAP » Tue Jun 12, 2018 5:20 pm

Unfortunately, attempts to export pin 3 or pin 5, with

Code: Select all
echo 5 > /sys/class/gpio/export


reports a write error - device or resource busy. :?

Code: Select all
echo out > /sys/class/gpio/gpio5/direction

reports no such file or directory

and
Code: Select all
echo 5 > /sys/class/gpio/unexport


reports invalid argument.

I guess I need to stop the I2C control over pins 3 and 5 for this to work - although the Raspberry Pi, Banana Pi and Orange Pi PC all work without doing this.

Unfortunately, I can see someone else had the same issue - viewtopic.php?f=80&t=17522

I wonder how the other Pi variants manage this?
RWAP
 
Posts: 14
Joined: Mon Apr 30, 2018 4:28 am
languages_spoken: english
ODROIDs: Odroid C1

Re: WiringPi for Odroid C1

Unread postby tobetter » Tue Jun 12, 2018 5:41 pm

@RWAP, I think you should use 74 and 75 instead of 3 and 5. 74 and 75 are pin number can be acknowledgeable by Linux kernel driver while 3 and 5 are the pin number on the pin header.
tobetter
 
Posts: 2229
Joined: Mon Feb 25, 2013 10:55 am
Location: Paju, South Korea
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1

Re: WiringPi for Odroid C1

Unread postby RWAP » Tue Jun 12, 2018 5:53 pm

tobetter wrote:@RWAP, I think you should use 74 and 75 instead of 3 and 5. 74 and 75 are pin number can be acknowledgeable by Linux kernel driver while 3 and 5 are the pin number on the pin header.


Ah you are correct - that works and toggles my LED on/off (connected to #75)

So, it looks as though all that is required is for the Wiring module to be updated to point to these pins :D
RWAP
 
Posts: 14
Joined: Mon Apr 30, 2018 4:28 am
languages_spoken: english
ODROIDs: Odroid C1

Re: WiringPi for Odroid C1

Unread postby tobetter » Tue Jun 12, 2018 5:54 pm

RWAP wrote:
tobetter wrote:@RWAP, I think you should use 74 and 75 instead of 3 and 5. 74 and 75 are pin number can be acknowledgeable by Linux kernel driver while 3 and 5 are the pin number on the pin header.


Ah you are correct - that works and toggles my LED on/off (connected to #75)

So, it looks as though all that is required is for the Wiring module to be updated to point to these pins :D

Good to hear it works, there is another expert on this and stay tuned. :)
tobetter
 
Posts: 2229
Joined: Mon Feb 25, 2013 10:55 am
Location: Paju, South Korea
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1

Re: WiringPi for Odroid C1

Unread postby odroid » Tue Jun 12, 2018 6:35 pm

Thank you for the confirmation.
We will update the WiringPi source code within a few days since tomorrow is a national holiday in Korea.
User avatar
odroid
Site Admin
 
Posts: 28292
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: WiringPi for Odroid C1

Unread postby RWAP » Tue Jun 12, 2018 7:30 pm

odroid wrote:Thank you for the confirmation.
We will update the WiringPi source code within a few days since tomorrow is a national holiday in Korea.


Thank you - that will be most helpful. :D
RWAP
 
Posts: 14
Joined: Mon Apr 30, 2018 4:28 am
languages_spoken: english
ODROIDs: Odroid C1

Re: WiringPi for Odroid C1

Unread postby odroid » Thu Jun 14, 2018 3:33 pm

WiringPi library has been updated and you can access pin #3 and #5.
User avatar
odroid
Site Admin
 
Posts: 28292
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: WiringPi for Odroid C1

Unread postby RWAP » Sun Jun 17, 2018 5:22 pm

odroid wrote:WiringPi library has been updated and you can access pin #3 and #5.


OK - that works (v2.44 - dev branch on the github) - thank you (although there are various warnings when building the new version).

I guess the thing which remains is to move the development version into the main github (which is still v2.33) and also update the version installed by apt-get install wiringpi (again this is still v2.33) :D
RWAP
 
Posts: 14
Joined: Mon Apr 30, 2018 4:28 am
languages_spoken: english
ODROIDs: Odroid C1


Return to Issues

Who is online

Users browsing this forum: No registered users and 2 guests