GPIO LED blinker using SYSFS on the Rock64
#11
(07-12-2017, 06:25 PM)MarkHaysHarris777 Wrote:
(07-12-2017, 06:10 PM)tllim Wrote: Hi Marcus,

Lets create ROCK64 GPIO tutorial guide in PDF format and post at wiki site.

Yes;  I'm actually working on that !  ... I'll let you know when its ready.  It will also include the Python and C|C++ methods as well.

Thanks :-)
  Reply
#12
I updated my chart; while pin GPIO2_A3 does NOT work as output (it should) the pin DOES work as input !

... this was a surprise !
marcushh777    Cool

please join us for a chat @  irc.pine64.xyz:6667   or ssl  irc.pine64.xyz:6697

( I regret that I am not able to respond to personal messages;  let's meet on irc! )
  Reply
#13
Hi
First of all thank you for your work. Very helpful!
I'd like to share a modified version of the function to calculate the pin number, with a bit of validation to be sure that the string is ok (I hope it is ok). The function returns -1 if there was any problem with the string

Code:
def GPIO_name2gpio(value):
    value = value.upper()
    if (value[0:4] != 'GPIO') or (value[5] != '_'):
        return -1
    try:
        bank_num = int(value[4:5], 10)
        pad_nam = GPIO_pads[value[6:7]]
        pad_num = int(value[7:], 10)
        if (bank_num < 0) or (bank_num > 3) or (pad_num < 0) or (pad_num > 7):
            return -1;

        return (bank_num * 32) + (pad_nam * 8) + pad_num
    except (ValueError,KeyError):
        return -1
  Reply
#14
I noticed the pin numbers now have an additional offset of 1000 in the latest images (kernel 4.4.103).
  Reply
#15
Went ahead and wrote a Rock64 GPIO library for Bash: https://github.com/Leapo/Rock64-BashGPIO

Working on porting/re-implementing RPi.GPIO for Python now
  Reply
#16
(03-25-2018, 06:04 PM)Leapo Wrote: Went ahead and wrote a Rock64 GPIO library for Bash: https://github.com/Leapo/Rock64-Utilities

Working on porting/re-implementing RPi.GPIO for Python now

Nice work, can you maybe start a new thread for your RPi.GPIO effort, there are probably some people that would like to contribute...
Come have a chat in the Pine A64 IRC channel >>
  Reply
#17
(03-26-2018, 02:56 AM)xalius Wrote: Nice work, can you maybe start a new thread for your RPi.GPIO effort, there are probably some people that would like to contribute...

I'll fire up a separate thread as soon as I get the first version of the Python module uploaded to github. Shouldn't be too much longer.

I got basic functionality hammered-out and working last night. Check it out, R64.GPIO is already running RPi.GPIO compatible test code:

[Image: Xsa8Izu.png]
  Reply
#18
Hello,

I have issue when trying the code MarkHaysHarris gave :


Code:
ulysse132@rock64:~$ sudo -i
[sudo] password for ulysse132:

root@rock64:~# echo 101 > /sys/class/gpio/export
-bash: echo: write error: Invalid argument
root@rock64:~#


Could you give me a hand to make this work ? I have the same result with echo 60. I didn't try other values because I don't want to make mistakes.

I use armbian 5.42 (stretch).

Thanks for your help !
  Reply
#19
(07-03-2018, 11:30 AM)ulysse132 Wrote: Hello,

I have issue when trying the code MarkHaysHarris gave :


Code:
ulysse132@rock64:~$ sudo -i
[sudo] password for ulysse132:

root@rock64:~# echo 101 > /sys/class/gpio/export
-bash: echo: write error: Invalid argument
root@rock64:~#


Could you give me a hand to make this work ? I have the same result with echo 60. I didn't try other values because I don't want to make mistakes.

I use armbian 5.42 (stretch).

Thanks for your help !

Export numbers have changed due to kernel updates and the like. I'll double check what the offset is now and let you know.
  Reply
#20
I'd also like to know more about making this work on Armbian 5.42 stretch. My /sys/class/gpio only lists 5 items, gpiochip1000, 1032, 1064, 1096, 1510. Is this now accessing them as a group? I'm specifically wanting to use them as triggers so that a button press will trigger events in my python app.
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Thumbs Up General firmware section for the Rock64? BowerR64 3 198 5 hours ago
Last Post: theophile
  Rock64 No Audio - Solved wbecks 10 9,518 09-05-2020, 02:32 PM
Last Post: WarpLover
  what is the rock64 good for? munocat 4 1,098 09-02-2020, 08:40 PM
Last Post: BowerR64
  pin connector on rock64 jeanmichel 0 125 08-22-2020, 10:04 AM
Last Post: jeanmichel
  Rock64 random freezes BTB 6 1,473 08-19-2020, 05:59 AM
Last Post: wilsonYan
  rock64, compile problems "illegal instruction", "memory fault" -> ddr_333Mhz? hunderteins 7 1,408 08-18-2020, 02:24 PM
Last Post: tomarm
  Rock64 Real Time Clock nohandlebars 1 331 07-03-2020, 06:47 AM
Last Post: t4_4t
  Got an error message when trying to flash the Rock64 OS ilan 0 309 06-29-2020, 04:53 PM
Last Post: ilan
Big Grin Rock64 as a retro-gaming console: early impressions Luke 53 34,703 06-25-2020, 09:22 AM
Last Post: dagijay
  HDMI noise on Rock64 ab1jx 1 442 06-19-2020, 04:54 PM
Last Post: ab1jx

Forum Jump:


Users browsing this thread: 1 Guest(s)