WiringPi for Odroid C1

Post Reply
RWAP
Posts: 14
Joined: Mon Apr 30, 2018 4:28 am
languages_spoken: english
ODROIDs: Odroid C1
Has thanked: 0
Been thanked: 0
Contact:

WiringPi for Odroid C1

Unread post by 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
Has thanked: 0
Been thanked: 0
Contact:

Re: WiringPi for Odroid C1

Unread post by 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
Has thanked: 0
Been thanked: 0
Contact:

Re: WiringPi for Odroid C1

Unread post by 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?

User avatar
odroid
Site Admin
Posts: 31760
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 83 times
Been thanked: 241 times
Contact:

Re: WiringPi for Odroid C1

Unread post by 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

RWAP
Posts: 14
Joined: Mon Apr 30, 2018 4:28 am
languages_spoken: english
ODROIDs: Odroid C1
Has thanked: 0
Been thanked: 0
Contact:

Re: WiringPi for Odroid C1

Unread post by 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... :(

User avatar
odroid
Site Admin
Posts: 31760
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 83 times
Been thanked: 241 times
Contact:

Re: WiringPi for Odroid C1

Unread post by 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

RWAP
Posts: 14
Joined: Mon Apr 30, 2018 4:28 am
languages_spoken: english
ODROIDs: Odroid C1
Has thanked: 0
Been thanked: 0
Contact:

Re: WiringPi for Odroid C1

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

Has any progress been made with this?

User avatar
odroid
Site Admin
Posts: 31760
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 83 times
Been thanked: 241 times
Contact:

Re: WiringPi for Odroid C1

Unread post by 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/appli ... 40pin_gpio

If it works, we will modify the WiringPi source code quickly to support those two additional IO ports.

RWAP
Posts: 14
Joined: Mon Apr 30, 2018 4:28 am
languages_spoken: english
ODROIDs: Odroid C1
Has thanked: 0
Been thanked: 0
Contact:

Re: WiringPi for Odroid C1

Unread post by 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?

User avatar
tobetter
Posts: 3764
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 28 times
Been thanked: 128 times
Contact:

Re: WiringPi for Odroid C1

Unread post by 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.

RWAP
Posts: 14
Joined: Mon Apr 30, 2018 4:28 am
languages_spoken: english
ODROIDs: Odroid C1
Has thanked: 0
Been thanked: 0
Contact:

Re: WiringPi for Odroid C1

Unread post by 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

User avatar
tobetter
Posts: 3764
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: X, X2, U2, U3, XU3, C1
Location: Paju, South Korea
Has thanked: 28 times
Been thanked: 128 times
Contact:

Re: WiringPi for Odroid C1

Unread post by 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. :)

User avatar
odroid
Site Admin
Posts: 31760
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 83 times
Been thanked: 241 times
Contact:

Re: WiringPi for Odroid C1

Unread post by 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.

RWAP
Posts: 14
Joined: Mon Apr 30, 2018 4:28 am
languages_spoken: english
ODROIDs: Odroid C1
Has thanked: 0
Been thanked: 0
Contact:

Re: WiringPi for Odroid C1

Unread post by 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

User avatar
odroid
Site Admin
Posts: 31760
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 83 times
Been thanked: 241 times
Contact:

Re: WiringPi for Odroid C1

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

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

RWAP
Posts: 14
Joined: Mon Apr 30, 2018 4:28 am
languages_spoken: english
ODROIDs: Odroid C1
Has thanked: 0
Been thanked: 0
Contact:

Re: WiringPi for Odroid C1

Unread post by 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

rexxman
Posts: 1
Joined: Sat Jul 27, 2019 12:02 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 0
Contact:

Re: WiringPi for Odroid C1

Unread post by rexxman » Sat Jul 27, 2019 12:21 pm

Firstly thanks for providing this port of wriningPi for Odroid.,

I am porting a wiringPi program from the Raspberry Pi to my Odroid C1 and have come
across a bug with the Odroid implementation. Can't see how to raise an issue on GitHub
so am reporting it here; hope that is Ok.

My code calls piBoardId() to display details about the board and then calls wiringPiSetup()
and the remainder of the code. This works fine on Raspberry Pi.

On my Odroid I call piBoardId() successfully and display the board details.
Then I call wiringPiSetup() and get the error "Unknown Model"

The error is that piBoardId() calls piGpioLayout() which sets the global board details [libwiring]
and sets a static variable [gpioLayout] to 1 to indicate that piGpioLayout() has been called.

wiringPiSetup() first sets the global board details [libwiring] to zero and calls piGpioLayout().
piGpioLayout() checks the static variable [gpioLayout] and exits without re-populating [libwiring]
and wiringPiSetup() fails because the board model is unknown.

I can change the order of piBoardId() and wiringPiSetup() so that wiringPiSetup() is called
first, but that is inconsistent with the semantics of wiringPi on the Raspberry Pi.

Thanks, Mark

joshua.yang
Posts: 239
Joined: Fri Sep 22, 2017 5:54 pm
languages_spoken: Korean, English
ODROIDs: XU4, XU4Q + Cloudshell2, H2
Has thanked: 2 times
Been thanked: 21 times
Contact:

Re: WiringPi for Odroid C1

Unread post by joshua.yang » Mon Jul 29, 2019 3:33 pm

rexxman wrote:
Sat Jul 27, 2019 12:21 pm
Firstly thanks for providing this port of wriningPi for Odroid.,

I am porting a wiringPi program from the Raspberry Pi to my Odroid C1 and have come
across a bug with the Odroid implementation. Can't see how to raise an issue on GitHub
so am reporting it here; hope that is Ok.

My code calls piBoardId() to display details about the board and then calls wiringPiSetup()
and the remainder of the code. This works fine on Raspberry Pi.

On my Odroid I call piBoardId() successfully and display the board details.
Then I call wiringPiSetup() and get the error "Unknown Model"

The error is that piBoardId() calls piGpioLayout() which sets the global board details [libwiring]
and sets a static variable [gpioLayout] to 1 to indicate that piGpioLayout() has been called.

wiringPiSetup() first sets the global board details [libwiring] to zero and calls piGpioLayout().
piGpioLayout() checks the static variable [gpioLayout] and exits without re-populating [libwiring]
and wiringPiSetup() fails because the board model is unknown.

I can change the order of piBoardId() and wiringPiSetup() so that wiringPiSetup() is called
first, but that is inconsistent with the semantics of wiringPi on the Raspberry Pi.

Thanks, Mark
Hi.

Yes, on our port, wiringPiSetup() calls piGpioLayout() first to set libwiring structure with proper parameters by parsing /proc/cpuinfo.

So, if /proc/cpuinfo has correct information for the board itself, wiringPiSetup() should work flawlessly. It means it should recognize the board name and revision and it should not say "Unknown model".

I doubt that your /proc/cpuinfo has no information for providing its name to WiringPi. Could you check this?

Code: Select all

cat /proc/cpuinfo
In my C1, it results,

Code: Select all

root@odroid:~# cat /proc/cpuinfo
Processor	: ARMv7 Processor rev 1 (v7l)
processor	: 0
BogoMIPS	: 3.27

processor	: 1
BogoMIPS	: 3.27

processor	: 2
BogoMIPS	: 3.27

processor	: 3
BogoMIPS	: 3.27

Features	: swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xc05
CPU revision	: 1

Hardware	: ODROIDC
Revision	: 000a
Serial		: 1b00000000000000
Check the last 3 lines that involve hardware name and revision version.

And before that, you don't have to call piBoardId() at first when you use WiringPi for ODROIDs. That function is not necessary.
wiringPiSetup() does the work that piBoardId() originally did.

joerg
Posts: 890
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2
Location: Germany
Has thanked: 5 times
Been thanked: 13 times
Contact:

Re: WiringPi for Odroid C1

Unread post by joerg » Mon Jul 29, 2019 11:48 pm

@rexxman, maybe you are using a mainline kernel? In that case it would be clear, if there are missing hardware, revision and serial in cpuinfo. You can see in my thread: viewtopic.php?f=114&t=35474#p260341

Post Reply

Return to “Issues”

Who is online

Users browsing this forum: No registered users and 1 guest