Hi, I want to use GPIOs in my own C program. I read the post in the forum, but couldn't get the right information. Perhaps someone can summarize in short: Is it possible to use the GPIO-Pins *without* recompiling the kernel and installing a new OS? How can the GPIOs be accessed? Example would be good- How can the /dev/buttons be disabled?
again GPIO question
Which kernel are you using? 2.6.29.4 does not have sys/class/gpio enabled. I understand that you can access GPIO by <ioctl>. See led.c in the example code on the DVD. I was warned that kernel access is "dangerous for beginners", so I wanted user space access. 2.6.31 -rc2 as found as a download at KernelConcepts has sys/class/gpio and there is a good article for using user space access at http://www.avrfreaks.net/wiki/index.php/Documentation:Linux/GPIO Think there were comments on disabling the buttons in another post on this site or www.friendlyarm.org Good luck.
hm, I got no dvd with my mini2440. can anyone send this file to me? I use the image which was originally installed on my mini2440. might be 2.6.29.4. Is anywhere an actual linux image for download available, which has gpio support enabled? Or do I really have to go through the whole procedure for compiling my own kernel and image?
Hi, The DVD image can be found here at the page bottom: http://arm9.net/download.asp
If you are happy with GPE instead of Qtopia, follow this tutorial http://narnia.cs.ttu.edu/drupal/node/131 I am busy trying to get some of the basics working after doing this that I even haven't gone around to trying GPIO_SYSFS on it! There could be problems with USB. This package doesn't have Boa, which was one lil' plus with the factory install. Spent hours trying to re-config 2.6.29.4 Unless you find a tutorial you can waste a lot of time. There was some information on kernel work, search <kernel> here and on www.friendlyarm.org Think the best route it to bite the bullet and learn how to compile a kernel. The latest on the buserror site sounds like the most hopeful. Good luck
led.c Read the other post on GPIO and I think you need to do other things to get this work, ie is there a /dev/leds directory? #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/ioctl.h> int main(int argc, char **argv) { int on; int led_no; int fd; if (argc != 3 || sscanf(argv[1], "%d", &led_no) != 1 || sscanf(argv[2],"%d", &on) != 1 || on < 0 || on > 1 || led_no < 0 || led_no > 3) { fprintf(stderr, "Usage: leds led_no 0|1\n"); exit(1); } fd = open("/dev/leds0", 0); if (fd < 0) { fd = open("/dev/leds", 0); } if (fd < 0) { perror("open device leds"); exit(1); } ioctl(fd, on, led_no); close(fd); return 0; }