GPIO always returns "Device or resource busy"

2,797 views
Skip to first unread message

Jeremy Darling

unread,
Sep 18, 2014, 10:32:22 PM9/18/14
to ra...@googlegroups.com
Like (many) others I'm trying to play with the GPIO on the Rock.  Seems though that no matter what I do though I get the same response "Device or resource busy"

I'm running the Ubuntu 14.04 distro from the website.

Reading all over the web I can find that it seems I may need to enable the GPIO config in the kernel.  No clue how to do that, anyone have a line by line tutorial on how to do this?  Or, is there something else I should be trying?  I've tried su'ing the led.sh file and running it under su as root.

output from led.sh

led.sh: line 4: echo: write error: Device or resource busy

source of led.sh (from wiki)

#!/bin/sh

# enable the gpio 172 -> green led
echo 172 > /sys/class/gpio/export

# set the direction to output
echo "out" > /sys/class/gpio/gpiochip172/direction
while true;
do
echo 0 > /sys/class/gpio/gpiochip172/value #led on
sleep 1
echo 1 > /sys/class/gpio/gpiochip172/value #led off
sleep 1
done


Thanks,
 - Jeremy

Tom Cubie

unread,
Sep 18, 2014, 10:36:19 PM9/18/14
to Jeremy Darling, ra...@googlegroups.com
This is because the gpio for the led is occupied by the kernel. You
can not control it via the gpio interface. You can control the led via
the led class. http://wiki.radxa.com/Rock/led

If you want to control the gpio, you can use the spare ones on the
extension header.

>
> Thanks,
> - Jeremy
>
> --
> You received this message because you are subscribed to the Google Groups
> "radxa" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to radxa+un...@googlegroups.com.
> To post to this group, send email to ra...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/radxa/6e39dedb-583c-4427-8b33-2297c9db3c6d%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
radxa rock - quad core arm computer that rocks

radxa.com

Naoki FUKAUMI

unread,
Sep 18, 2014, 10:42:52 PM9/18/14
to Tom Cubie, Jeremy Darling, ra...@googlegroups.com
On Fri, Sep 19, 2014 at 11:35 AM, Tom Cubie <t...@radxa.com> wrote:
> If you want to control the gpio, you can use the spare ones on the
> extension header.

I'm not sure, but I guess some redundant kernel config option may
occupy GPIO control from userland... if it's true, defconfig needs to
be cleaned.

Jeremy Darling

unread,
Sep 18, 2014, 11:05:05 PM9/18/14
to Tom Cubie, ra...@googlegroups.com
One more question, is there a picture like below:
Inline image 1

Only with the pin #'s on it?  I'm guessing that the mapping is something like:

RK30_PIN0_PA0 = (0*NUM_GROUP + PIN_BASE + 0) = HOST_DP2
RK30_PIN0_PA1 = (0*NUM_GROUP + PIN_BASE + 1) = HOST_DM2
RK30_PIN0_PA2 = ... = LINE_L
RK30_PIN0_PA3 = ... = LINE_R
etc...

 - Jeremy

Tom Cubie

unread,
Sep 18, 2014, 11:11:41 PM9/18/14
to Jeremy Darling, ra...@googlegroups.com
On Fri, Sep 19, 2014 at 11:04 AM, Jeremy Darling
<jeremy....@gmail.com> wrote:
>
> One more question, is there a picture like below:
>
>
> Only with the pin #'s on it? I'm guessing that the mapping is something like:
>
> RK30_PIN0_PA0 = (0*NUM_GROUP + PIN_BASE + 0) = HOST_DP2
> RK30_PIN0_PA1 = (0*NUM_GROUP + PIN_BASE + 1) = HOST_DM2
> RK30_PIN0_PA2 = ... = LINE_L
> RK30_PIN0_PA3 = ... = LINE_R
> etc...

some(most) pins on the extension header cane be used as GPIOs, but
some can not, such as LINE_L and LINE_R are the analog signal.
HOST_DP2 and HOST_DM2 can not be used as GPIO too. It's connected to
the USB hub.
> To view this discussion on the web visit https://groups.google.com/d/msgid/radxa/CAAhs7EiX%2BhPS05L5ZnMQPWdENxbg-mTA2-77HFh7t2n%2BhdbfLg%40mail.gmail.com.

Jeremy Darling

unread,
Sep 18, 2014, 11:15:02 PM9/18/14
to Tom Cubie, ra...@googlegroups.com
Guess that makes my question even more, is there a pinout document/diagram showing what pin's are available and what their effective number is?

Basically we have a Meetup next week in our local Node.js group talking about hardware hacking and Node.js with different dev boards.  I was going to show off the Rock blinking a few leds, running some servos, checking light levels from sensors, etc...  But would have to know exactly what can and can not be done :)

BTW: It makes a great little web server LOL

 - Jeremy

Jeremy Darling

unread,
Sep 18, 2014, 11:28:46 PM9/18/14
to Tom Cubie, ra...@googlegroups.com
After some digging on talk.radxa I stumbled across this post http://talk.radxa.com/topic/476/gpio-to-pinout-legend/4

To anyone else, that is the pinout mapping for the rock :)

Should add that to the wiki on the GPIO page too.

Tom Cubie

unread,
Sep 19, 2014, 12:25:22 AM9/19/14
to Jeremy Darling, ra...@googlegroups.com
On Fri, Sep 19, 2014 at 11:28 AM, Jeremy Darling
<jeremy....@gmail.com> wrote:
> After some digging on talk.radxa I stumbled across this post
> http://talk.radxa.com/topic/476/gpio-to-pinout-legend/4
>
> To anyone else, that is the pinout mapping for the rock :)
>
> Should add that to the wiki on the GPIO page too.

Added to the http://wiki.radxa.com/Rock/extension_header page.
> https://groups.google.com/d/msgid/radxa/CAAhs7Eh-meHjY3cEsQOFNf67BmTM1QGfG_2nDuy7GFN4GfL%2BoA%40mail.gmail.com.

Jeremy Darling

unread,
Sep 19, 2014, 8:20:58 PM9/19/14
to Tom Cubie, ra...@googlegroups.com
Tom, any chance you can post the code to interact with the GPIO using registers instead of file handles?  You said something about it the other night and I'd like to try and use that approach with the library I'm working on.

 - Jeremy
Reply all
Reply to author
Forward
0 new messages