Glomation
 
Advanced Search
Welcome, Guest. Please login or register.

Login with username, password and session length
February 05, 2012, 07:10:35 AM
News: Glomation introduced new wireless ready low cost GESBC-9260S
Pages: [1] 2 3 4
Topic Tools  
Read December 29, 2008, 05:27:09 PM #0
admin

GPIO driver

The attached file contains a simple GPIO driver that allows access of GPIO pins from user space.  The pre-built module is for Linux 2.6.25 and the following pins are configured,

    PA6
    PB0
    PB1
    PB2
    PB3

The test program simply reads the GPIO pins and print out the result.


* AT91-GPIO.tgz (9.14 KB - downloaded 782 times.)
 
Read January 12, 2009, 06:30:54 PM #1
Jerry Wong

Re: GPIO driver

Which pins on the 9260 are configurable for GPIO?
 
Read January 13, 2009, 04:06:21 AM #2
xfactor69

Re: GPIO driver

I installed the gpio driver and did a modprobe on it.  The module seemed to load as lsmod shows:
Module                  Size  Used by
GPIO_driver             3332  0

The /dev/gpio device doesn't seem to be there and the gpio-test program show nothing when it runs.

Advice?

Thanks,
ml
 
Read January 13, 2009, 09:17:46 AM #3
admin

Re: GPIO driver

The user's manuals lists GPIO in detail in table 7 for GESBC-9260 and table 6 for GESBC-9260S.  Any pin that is not listed in the function column can be used as GPIO by user.

The GPIO driver provided here is for demostration purpose only as the main line kernel will have GPIO driver available in new releases.  The GPIO driver does not create the device node automatically.  The /dev/gpio node should be created manually using the following command,

    mknod /dev/gpio c 250 0

The test program only reads and prints out the input of the GPIO pins "hard" configured by the GPIO driver.

 
Read January 21, 2009, 11:40:26 PM #4
Rahim Pardhan

Re: GPIO driver

What is the maximum allowable voltage on GPIO? Also how do I switch between peripheral A and peripheral B?

Thanks,

Rahim
 
Read January 22, 2009, 09:11:07 AM #5
admin

Re: GPIO driver

The GPIO pins are connected directly to the AT91SAM9260 CPU.  They are 3.3V I/O ports.

Please refer to AT91SAM9260 data sheet on how to configure multiplexed I/O pins.
« Last Edit: July 03, 2009, 11:02:30 AM by admin »
 
Read July 03, 2009, 11:12:34 AM #6
admin

Re: GPIO driver

The 2.6.30 kernel now has the GPIO support.  The following steps can be used to set GPIO as out put and control the value directly at command line,

echo {port number} > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio{port number}/direction
echo "1" > /sys/class/gpio/gpio{port number}/value
sleep 3
echo "0" > /sys/class/gpio/gpio{port number}/value


The port number of GPIO PA0 is 32, port number of PB0 is 64, and port number of PC0 is 96.

Attached is a pre-compiled 2.6.30 kernel image for GESBC-9260/B/S.  The kernel patch is available at http://maxim.org.za/at91_26.html

* uImage-2.6.30 (1728 KB - downloaded 212 times.)
 
Read July 30, 2009, 03:32:58 AM #7
billyc

Re: GPIO driver

My understanding is that the 2.6.30 kernel's GPIO driver also support button connected to GPIO. I would like to connect a button to one of GPIO pin. When the button is pressed, an event will be sent to user space application. Could you give us an example showing how to do that?
 
Read July 30, 2009, 09:42:38 AM #8
admin

Re: GPIO driver

The button driver in the kernel is for 2 of the buttons on the AT91SAM9XXX-ek boards.  If you use other GPIO pins as button input you need to implement your own button driver.   See http://kerneltrap.org/mailarchive/git-commits-head/2009/6/30/6112383 and http://bec-systems.com/site/281/how-to-implement-an-interrupt-driven-gpio-input-in-linux
 
Read August 12, 2009, 05:42:59 PM #9
aldo82

Re: GPIO driver


Hi, I've probed the AT91-GPIO driver, it works good. I've been trying to cross-compile the file GPIO-driver.c in order to generate the file GPIO-driver.ko, but I've had some problems.

I obtained a lot of mistakes when I put the next sentence:

[redes@localhost Prog_board]$ arm-unknown-linux-gnu-gcc -O2 -D__KERNEL__ -DMODULE -I/home/redes/pruebas/kernel1/linux-2.6.25/include - c GPIO-driver.c -o GPIO-driver.ko

What am I doing wrong??


The attached file contains a simple GPIO driver that allows access of GPIO pins from user space.  The pre-built module is for Linux 2.6.25 and the following pins are configured,

    PA6
    PB0
    PB1
    PB2
    PB3

The test program simply reads the GPIO pins and print out the result.
 
Read August 13, 2009, 08:03:05 AM #10
admin

Re: GPIO driver

Cross compiling kernel module can be complicated as it needs to check running kernel version, symbol tables etc.  Easiest is compile it native.

Since the 2.6.30 now have GPIO support included in the kernel it is better to use the new version of the kernel.
« Last Edit: August 13, 2009, 09:14:28 AM by admin »
 
Read September 02, 2009, 10:37:01 AM #11
gaurav.joshi

Re: GPIO driver

Admin Quote:

"echo {port number} > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio{port number}/direction
echo "1" > /sys/class/gpio/gpio{port number}/value
sleep 3
echo "0" > /sys/class/gpio/gpio{port number}/value

The port number of GPIO PA0 is 32, port number of PB0 is 64, and port number of PC0 is 96."



I am trying to use PC23 to PC31 on the Table 6 on 9260S as GPIO pins. According to above port numbering scheme , this should correspond to port numbers  119 to 127. But it does'nt seem to take any values more than 99.

Suggestions/help?


 
Read September 02, 2009, 01:07:33 PM #12
admin

Re: GPIO driver

The PC16 - PC31 lines are used data bus D16 - D31 on AT91SAM9260-ek and GESBC-9260.  The GESBC-9260S uses 16 bit wide data bus so the PC16 - PC31 is available as GPIO.  Because the mainline kernel is build for AT91SAM9260-ek board the PC16 - PC31 probably is not in the GPIO driver.  You need to check the kernel source code and may need modification to enable those lines.
 
Read September 02, 2009, 03:24:55 PM #13
gaurav.joshi

Re: GPIO driver

Thanks but it doesn't seen to take any values > 99 (PC5) according to the table. Not Just that , it seem to be missing some value in between also like 79 , 80 etc ...
Is there a rule for that OR how can I enable them in kernel?

 
Read September 02, 2009, 03:33:23 PM #14
admin

Re: GPIO driver

Best thing to do is to read the kernel GPIO driver source code to find out why.

The GPIO driver of kernel version 2.6.30 and up reads in the PIO_PSR register to determine if the GPIO pin requested is in alternate function mode and will enable the GPIO pin if it is not.  The GESBC-9260/B/S uses some of the pins that is set as alternate function on the AT91SAM9260-EK board as GPIO.  To use these pins as GPIO the kernel can be modified to set the desired GPIO pins to I/O functions.  Or use devmem2 utility to set the PIO_PER register in user space to enable them as GPIO pins for the GPIO driver.
« Last Edit: September 15, 2009, 05:39:33 PM by admin »
 
Pages: [1] 2 3 4
Jump to:  

Theme Update by Runic Warrior Originally created by m3talc0re