GPIO driver

Nicolas Briand
Hi, 
Is there a device driver and software exemples available to use the GPIO of
the friendly ARM mini 2440 ? 
Thanks, Have a Nice Day, All of You

davef
I guess you have seen the buttons_test.c in the example code?

I found this on AVRfreaks.net for the AVR32, search for this title <Example
code to initialize new spi-gpio driver>, maybe it will be helpful.

pasquale
hi, in the buttons_test.c exemple code there are no references to gpio.

davef
I thought dev/buttons would give a clue, but I see you can't even look at
it with vi.

davef
http://www.mjmwired.net/kernel/Documentation
and look for gpio.txt

Went searching for /sys/class/gpio in the factory install and couldn't find
it.

Another one to look at is:
http://foxlx.acmesystems.it/?id=22

There is an example: gpiosyscalls.c
which looks useful.

They have a lot of information, which would help one to at least get some
direction.
 
I'll talk to the S/W guys at work about some GPIO examples.

Pasquale
You need to recompile the kernel to have a working /sys/class/gpio.
Anyway i can't understand how to use it.

this is my /sys/class/gpio

mini2440:/sys/class/gpio# ls
export     gpiochip128  gpiochip192  gpiochip64  unexport
gpiochip0  gpiochip160  gpiochip32   gpiochip96
mini2440:/sys/class/gpio# cd gpiochip0
mini2440:/sys/class/gpio/gpiochip0# ls
base  label  ngpio  subsystem  uevent
mini2440:/sys/class/gpio/gpiochip0# cat base
0
mini2440:/sys/class/gpio/gpiochip0# cat label
GPIOA
mini2440:/sys/class/gpio/gpiochip0# cat ngpio
24
mini2440:/sys/class/gpio/gpiochip0#

davef
http://www.avrfreaks.net/wiki/index.php/Documentation:Linux/GPIO

Any help?

Pasquale
10Q

it works well

davef
10Q?

Would you like to tell me what worked well?

I tried to compile gpiosyscalls.c but the compiler I am using in
Code::Blocks can't find "linux/gpio_syscalls.h"  

So, I am off searching for that library.

Regards,
Dave

pasquale
hi, i followed the documentation on avrfreaks.

davef
Pasquale,

Could you tell me how to modify config_mini2440_n35 as found on the factory
DVD to enable GPIO?

I find it a bit odd that they go to the trouble of giving you all those
connections to GPIO, on some nice headers, and then don't enable that
capability.

Thank you.

Regards,
davef

irfan
i recompiled the linux kernel (source downloaded from the friendlyarm.net
website) after changing its configuration, to include drivers for gpio. 

the chinese manual (again, from friendlyarm.net download page) actually
tells us how to do that, please translate chapters 5.3, 5.4, (for gcc
toolchain installation) and chapter 6 (for the configuration menus tutorial
and actual kernel compilation) with http://translate.google.com (which i
did).

now "/sys/class/gpio" exists in my system...

-irfan-

davef
irfan,

Thanks for the pointers.  Fortunately, a fellow I work with also bought a
FriendlyArm and is able to translate the sections you mentioned.

Regards,
Dave

Vladimir Fonov
Hello,

for /sys/class/gpio just add CONFIG_GPIO_SYSFS=y into .config file

davef
< for /sys/class/gpio just add CONFIG_GPIO_SYSFS=y into .config file

The problem I had with this was I couldn't find it using menuconfig on the
FriendlyArm distro (2.6.29.4).  If you could tell me where to find it, at
least that would be useful to know.

I have since moved to using the kernel on the buserror site

Thanks,
Dave

eduardo
I did the same as Irfan and i'm able to access all gpio pins. I built my
own driver using the s3c2410_gpio_setpin, s3c2410_gpio_getpin and
s3c2410_gpio_cfgpin functions.

regards

fatbrain
Hi davef
Where you able to find "linux/gpio_syscalls.h" and the associated libs src.
If you have please post it on the net via a file sharing site. 

regards
--fatbrain

davef
fatbrain,

I would look at:

http://lxr.linux.no/+trees

for any code you want.

I did not get any further with GPIO in general and GPIO_SYSFS in particular
. . . working on rootfs and a web server.

Good luck

fernando
Hola a todos.
Quisiera saber como tenemos acceso a todos los pines del puerto GPIO, tengo
la version de kernel 2.6.13 , no estan el sys/class/gpio que han
comentado,dicen que deberia recompilar el kernel, especificamente a que
parte se refieren, he buscado el .congig y la unica opcion relacionada con
gpio esta ya montada, Entonces no tengo un archivo descriptor para manejar
el gpio. Gracias por su tiempo.

Chinmay Duvedi
Hello everyone

I am relatively new to handling the linux kernel

I have the linux kernel 2.6.29. I recompiled it to include the gpio drivers
But now the size of the zImage is going beyond 2MB.
What seems to be the problem?
Have i included some extra options while compiling?

Thanks in advance for any help

Cheers

Andreo
hey, i started here a little open source lib for gpio, but still working

http://sourceforge.net/projects/gpiolib/

vthokie11
I realize that this thread is somewhat old but here is a helpful link for
enabling gpio support...this creates the /sys/class/gpio directory

http://ebrombaugh.studionebula.com/embedded/mini2440/index.html

saurabh_ambulkar
hey ,
i am successful in using the 34-pin GPIO in Qt 4.6.3 program for 3 stepper
motor  driver pulse-engine using 9 Gpio pins, 3 for each motor ..
1.Enable
2.direction &
3.step

this was done by enabling kernel gpio support and compiling the kernel.

My problem is when i try to toggle gpio using Qts timer the maximum pulse
freq i get is only 450HZ ....i need freq in few kilohertz ..what approach
should i take for this is it Gpio access problem from user space ,Qt
program overhead or linux kernel schedular tick issue and how can achieve
those kilohertz freq(max 10khz for each motor)....

 Anybody willing to help...? 

Thanks in Advance

davef
Do some research on writing a kernel driver for GPIO rather than working
through sysfs.

I don't know how much faster that would be.

Then some people manage to use various "real time" patches to get higher
speed.  

Then get rid of the operating system and write "bare metal" C code, then do
it in assembly.

It is a difficult trade-off . . . if you want a fancy GUI, like Qt and have
good control over hardware I would suggest to use the GUI to talk to small
8 bit uPs (over serial) that can do this more effectively.

Dave McLaughlin
I agree with Davef (by the way, are you the same davef on TinyCLR forum?)
that you should offload the IO to an external processor and do all the GUI
with QT.

No matter how much you try, Linux or Android are just not a real time OS so
you can not guarantee latency.

We do this very thing with a control system for a large hyrdraulic machine.
All the GUI is done under a Windows application but the actual sampling and
control is done by an microcontroller board communicating over USB.

Dave...

davef
No to TinyCLR.  Was quite active on AVRfreaks during my uP formative years.

Thanks for the reminder about USB rather than serial.  There is a 8bit USB
series from ATMEL and also a USB library called LUFA that you can run on
their older 8bit ATMega series.

Dave McLaughlin
Just someone using the same name then! :o)

If the AVR does not have built in USB I just use the FT232R from FTDI as I
have found that it just works 100% every time. In fact, I have used that
chip to convert legacy RS232 designs to USB over the years.

Dave...

davef
There are AVR chips with USB capability.  This is even better:

http://www.pjrc.com/teensy/

A guy at work has been using these for the last 6 months or more.  Time to
have a chat with him.

Dave McLaughlin
I often just build my own PCB's as by the time you buy these and wire it
all up, you have quite a mess. Good for home hobby but not much use for
commercial applications other than development and learning as a start on a
new processor.

You can get 1 off PCB's these days for little cost that it makes more sense
just to build your own (assuming you have the know how anyway) and then you
can include power supply, outside world screw connectors or plugs etc.

Dave...

Reply

Name
eMail (not visible)
Subject (no text only in upper case; no HELP, URGENT...)
Text
HTML tags are not supported and links are generated automatically if they start with http or ftp.
Please submit long source code or log files as attachment (only registered users).
Please enter the number without blanks: 2 8 9 8