Questions about GPIO
#1
Hi,
will we able to use gpio ports via web pages stored in a web server running on the pine A64+?
#2
We need GPIO exposed in /sys/class via some sort of kernel module like on the Pi (sorry to bring up the pi but that's the model that PineA64 is going to have to strive to be like for community support)

The GPIO on the Odroid C1 (which uses an allwinnder quad core SOC) requires code written in C to access the GPIO (I haven't seen access via a /sys/class/GPIO or anything) but the Pcduino series, which also use the Allwinner SOC, does have a kernel module for /sys/class access.  Hopefully it won't take much to mimic this behavior.  I'd be willing to port the code needed to support the GPIO and other pin-specific functions.

(12-31-2015, 10:28 AM)o9guy Wrote: We need GPIO exposed in /sys/class via some sort of kernel module like on the Pi (sorry to bring up the pi but that's the model that PineA64 is going to have to strive to be like for community support)

The GPIO on the Odroid C1 (which uses an allwinnder quad core SOC) requires code written in C to access the GPIO (I haven't seen access via a /sys/class/GPIO or anything) but the Pcduino series, which also use the Allwinner SOC, does have a kernel module for /sys/class access.  Hopefully it won't take much to mimic this behavior.  I'd be willing to port the code needed to support the GPIO and other pin-specific functions.

But to more directly answer igna09, once we have access to the GPIO via filesystem (i.e. /sys/class GPIO) it will be possible to control them from a webserver using CGI-BIN in python, php, etc.  Here's an example of a web-based control for the Pi: http://www.instructables.com/id/Simple-a.../?ALLSTEPS

It wouldn't be too hard to adjust the code for the pin convention the GPIO for the allwinner uses.

After that it will be possible to make an IR receiver module that is compatible with LIRC.
#3
I don't mind programming in C, in fact I actually prefer it Smile, however I am curious as to if there is a library for the GPIO yet, something like wiringPi.h?
#4
(02-07-2016, 01:56 PM)limitlesscodes Wrote: I don't mind programming in C, in fact I actually prefer it Smile, however I am curious as to if there is a library for the GPIO yet, something like wiringPi.h?

If you prefers programming in C, cgeck out this link that generate by Sunxi community: http://linux-sunxi.org/GPIO
#5
(02-07-2016, 08:25 PM)tllim Wrote:
(02-07-2016, 01:56 PM)limitlesscodes Wrote: I don't mind programming in C, in fact I actually prefer it Smile, however I am curious as to if there is a library for the GPIO yet, something like wiringPi.h?

If you prefers programming in C, cgeck out this link that generate by Sunxi community: http://linux-sunxi.org/GPIO

Thanks much!, are there any updates as to when ubuntu will "officially" be supported?
#6
(02-10-2016, 12:25 AM)limitlesscodes Wrote:
(02-07-2016, 08:25 PM)tllim Wrote:
(02-07-2016, 01:56 PM)limitlesscodes Wrote: I don't mind programming in C, in fact I actually prefer it Smile, however I am curious as to if there is a library for the GPIO yet, something like wiringPi.h?

If you prefers programming in C, cgeck out this link that generate by Sunxi community: http://linux-sunxi.org/GPIO

Thanks much!, are there any updates as to when ubuntu will "officially" be supported?

Once the Kernel up, looking forward to happen on this month.
#7
Hey Pine64 backers! I am having difficulty figuring out how I would use C to take user input, button presses, and light LEDs with the GPIO, I understand C fairly well but have no experience with interfacing with"GPIO." Here is the best program I could think of although I believe there is a much better way to do this:
Code:
/*
*Simple pulsing of GPIO example
*/
#include <stdio.h>
#include <string.h>

FILE *zero, *one;

int main(int argc, char *argv[])
{

zero = fopen("/sys/class/gpio/gpio206/value", "w");
one = fopen("/sys/class/gpio/gpio206/value", "w");

while(1)
{
fputs("0\n", zero);
fflush(zero);
fputs("1\n", one);
fflush(one);
}
}
Also what determines the pin number? Thanks for your help!
#8
(02-14-2016, 05:49 PM)limitlesscodes Wrote: Hey Pine64 backers! I am having difficulty figuring out how I would use C to take user input, button presses, and light LEDs with the GPIO, I understand C fairly well but have no experience with interfacing with"GPIO." Here is the best program I could think of although I believe there is a much better way to do this:
Code:
/*
*Simple pulsing of GPIO example
*/
#include <stdio.h>
#include <string.h>

FILE *zero, *one;

int main(int argc, char *argv[])
{

zero = fopen("/sys/class/gpio/gpio206/value", "w");
one = fopen("/sys/class/gpio/gpio206/value", "w");

while(1)
{
fputs("0\n", zero);
fflush(zero);
fputs("1\n", one);
fflush(one);
}
}
Also what determines the pin number? Thanks for your help!

You've got the right general idea.  See http://falsinsoft.blogspot.com/2012/11/a...space.html and
http://linux-sunxi.org/GPIO
#9
(02-14-2016, 07:12 PM)patrickhwood Wrote:
(02-14-2016, 05:49 PM)limitlesscodes Wrote: Hey Pine64 backers! I am having difficulty figuring out how I would use C to take user input, button presses, and light LEDs with the GPIO, I understand C fairly well but have no experience with interfacing with"GPIO." Here is the best program I could think of although I believe there is a much better way to do this:
Code:
/*
*Simple pulsing of GPIO example
*/
#include <stdio.h>
#include <string.h>

FILE *zero, *one;

int main(int argc, char *argv[])
{

zero = fopen("/sys/class/gpio/gpio206/value", "w");
one = fopen("/sys/class/gpio/gpio206/value", "w");

while(1)
{
fputs("0\n", zero);
fflush(zero);
fputs("1\n", one);
fflush(one);
}
}
Also what determines the pin number? Thanks for your help!

You've got the right general idea.  See http://falsinsoft.blogspot.com/2012/11/a...space.html and
http://linux-sunxi.org/GPIO
I read through them, so from what I am able to understand my program would only work if the kernel supports GPIO access from sysfs, will the Pine64 support this(I really hope to hear yes)? Also, say I am trying to blink an LED, can you be so kind as to tell my a pin number on the GPIO that can do that?
#10
Alright, so I kind of figured out pin assignment using the GPIO image on the wiki. I still would like to know what PC, PD, PH, etc. means and when to use them vs. others. Also I would like to know if there is any better way of exporting the pins through C rather than doing something like:
Code:
//near beginning of file
system("echo 71 > /sys/class/gpio/export")
and
Code:
//near end of file
system("echo 71 > /sys/class/gpio/unexport")


Possibly Related Threads…
Thread Author Replies Views Last Post
  GPIO specifications in device tree ramstadt 1 3,534 01-16-2019, 03:17 PM
Last Post: ramstadt
  +PINEBOOK Q4OS Pinebook Questions StewB 0 2,451 08-24-2017, 03:53 PM
Last Post: StewB
  Low-Level-GPIO-Access Thoams131 2 4,656 01-11-2017, 02:54 PM
Last Post: Thoams131
Question PPS-GPIO Sebastian 11 18,349 07-12-2016, 07:25 PM
Last Post: tllim
  C#.NET / Mono GPIO library? abutler77 0 3,171 06-12-2016, 10:34 PM
Last Post: abutler77
  Lazarus and GPIO gbestwick 0 2,410 05-22-2016, 08:51 PM
Last Post: gbestwick
  GPIO javascript library. neeeds 1 3,997 02-19-2016, 11:31 PM
Last Post: limitlesscodes

Forum Jump:


Users browsing this thread: 1 Guest(s)