Advanced Search
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
February 05, 2012, 06:31:13 AM
Home
Help
Calendar
Login
Register
News
: Welcome to GLomation peer support forum
Glomation
»
Peer Support Forums
»
GESBC-9260
»
GPIO driver
« previous
next »
Pages:
1
2
[
3
]
4
Topic Tools
Topic Tools
Send this topic
Print
February 16, 2010, 09:49:03 AM
#30
admin
admin
Show admin's last posts.
Show general stats for admin.
Administrator
Super Hero
Posts: 339
Re: GPIO driver
The kernel GPIO driver is only available from 2.6.30 and up. That is already mentioned in previous posts.
The heart beat is a kernel feature that you can configure in your kernel build.
February 18, 2010, 01:16:14 AM
#31
anee_jose
anee_jose
Show anee_jose's last posts.
Show general stats for anee_jose.
Full Member
Posts: 1
Re: GPIO driver
hi,
i have compiled linux 2.6.30 with gpio driver support. i am using max7322 gpio expander chip. for normal gpio pins avaiable in at91sam9260-ek i could use the pin addresses like AT91_PIN_PA1, AT91_PIN_PB2... etc, how can i call set_gpio_output() function for the gpios in the expander chip? is there any macros defined for these gpios in the driver ?
thanks
Aneesh Jose
March 11, 2010, 06:24:24 AM
#32
Lorena
Lorena
Show Lorena's last posts.
Show general stats for Lorena.
Super Hero
Posts: 8
Re: GPIO driver
Quote from: Maturity on February 05, 2010, 12:52:45 PM
Sorry for the delay in responding, I had some education and customer issues of my own to deal with. The bottom line is that We finally got it working! Here are some clues that might help the next person. Plus a couple more questions.
What we have determined is that the /sys/class/gpio only seems to appear when using the file system from Glomation :
http://glomationinc.com/Support/9260/9260rootfs.img
or the prebuilt one from at91.com :
http://ftp://www.at91.com/pub/oe/deploy/glibc/images/at91sam9263ek/Angstrom-console-image-demo-glibc.rootfs.jffs2
Also you must have the uImage-2.6.30 from this thread, we have found *no* other that will present /sys/class/gpio the 2.6.27.4 kernel that is shipped on the board does not seem to present the gpio's. This is the one you want.
http://glomation.net/smf/index.php?action=dlattach;topic=27.0;attach=20
IMHO I had hoped that the pre-built image from linux4sam would have worked as I really like the heartbeat pulse of the onboard LED. It makes a nice indicator to see when opening the cabinet that the board is running. Does anyone know if it is possible to write a user (non kernel) program to get this effect with the uImage-2.6.30 image? Or will there be a Glomation kernel that supports it? In any case here is the kernel that has the heartbeat:
http://ftp://www.at91.com/pub/linux/2.6.30-at91/linux-2.6.30-at91-exp-at91sam9260ek.bin
So in summary you need
uImage:
http://glomation.net/smf/index.php?action=dlattach;topic=27.0;attach=20
rootfs:
http://glomationinc.com/Support/9260/9260rootfs.img
The other combinations of uImage and rootfs, including the emdebian stuff in the zip of 9260 files don't seem to present /sys/class/gpio.
~~~~~~
For those that are keen we have set up Eclipse environments to do the development in, it was fairly simple and should enable debug though nobody has needed to even try that yet. This is what works for us on Linux.
Go to
http://www.eclipse.org/downloads/
and download the version of "Eclipse IDE for C/C++ Developers (79 MB)" for your platform. Unpack it into /usr/local then add the following to your .bashrc :
export PATH=$PATH:/usr/local/eclipse
Start Eclipse and go to Help->Install_New_Software and click the Add... button.
In the dialog add Zylin CDT as the name and
http://opensource.zylin.com/zylincdt
as the location. If you unpacked the archive as root then you will need to be doing this as root in order to update the files. You should then be able to install "Zylin Embedded CDT". Go ahead and install it then shutdown Eclipse.
Download the cross compiler from glomation's support page (
http://glomationinc.com/support.html
):
http://glomationinc.com/download/Generic-arm_gcc-4.2.3-glibc-2.3.3.tar.bz2
And unpack it to get it to end up in /usr/local as well. Then add another line to your .bashrc
export PATH=$PATH:/usr/local/arm/gcc-4.2.3-glibc-2.3.3/arm-unknown-linux-gnu/bin
Start Eclipse and create a C project. When it is created right-click on it and bring up the properties. Then in C/C++ Build->Settings change the compiler and linker from gcc to arm-unknown-linux-gnu-gcc and the assembler from as to arm-unknown-linux-gnu-as for [All Configurations]. Then go to C/C++ General->Paths and Symbols, make sure the Includes tab is selected then select C Source File. Next click add and navigate to the include directory of the cross compiler. It is /usr/local/arm/gcc-4.2.3-glibc-2.3.3/arm-unknown-linux-gnu/arm-unknown-linux-gnu/include IIRC. If you need to manually add the libraries they would be at the same level as the include I think.
Additionally, I found that you can get a free Jazz (RTC) Express-C server and clients for 10 users. So the plan is to use RTC to track this work and source.
https://jazz.net/downloads/rational-team-concert/releases/2.0.0.2?p=allDownloads#expressc
~~~~~~
Now to create an api set to manage the gpio's. With any luck our second development board will get updated to the same level of kernel and rootfs without problems as well.
m
Hello,
Only a question. How did you update the root File System, I mean , I am flashing GESBC-9260 and updating kernel and file system to a 2.6.30 version. I am following the steps given in GESBC-9260 User`s Manual in "Loading Linux Kernel and root File System".The kernel was right updated but I am not sure how to update the root File System. What are the values of the parameters [available_nand_flash_memory_size] and &(filesize) for this comands:
nand erase 0x400000 [available_nand_flash_memory_size]
t 0x21000000 rootfs.img
nand write.jffs2 0x21000000 0x400000 &(filesize)
Thank you in advance!
March 11, 2010, 10:10:57 AM
#33
admin
admin
Show admin's last posts.
Show general stats for admin.
Administrator
Super Hero
Posts: 339
Re: GPIO driver
The file system does not have to be updated when updating the kernel unless you build a new file system that must be used to replace the existing one.
The erase size parameter can be calculated with the following formula,
NAND_FLASH_SIZE - 0x40000
The 0x400000 is used by the boot loader and kernel in the factory FLASH partition.
The 128MB FLASH is 0x8000000 in total size. The erase size for the file system will be 0x8000000 - 0x400000 = 0x7c00000
The write size can be calculated by the U-boot itself. The $(filesize) tells the U-boot to use the download data size.
March 12, 2010, 04:30:43 AM
#34
Lorena
Lorena
Show Lorena's last posts.
Show general stats for Lorena.
Super Hero
Posts: 8
Re: GPIO driver
Quote from: admin on March 11, 2010, 10:10:57 AM
The file system does not have to be updated when updating the kernel unless you build a new file system that must be used to replace the existing one.
The erase size parameter can be calculated with the following formula,
NAND_FLASH_SIZE - 0x40000
The 0x400000 is used by the boot loader and kernel in the factory FLASH partition.
The 128MB FLASH is 0x8000000 in total size. The erase size for the file system will be 0x8000000 - 0x400000 = 0x7c00000
The write size can be calculated by the U-boot itself. The $(filesize) tells the U-boot to use the download data size.
Thanks for your soon reply!
March 14, 2010, 11:30:50 AM
#35
laszlo
laszlo
Show laszlo's last posts.
Show general stats for laszlo.
Full Member
Posts: 2
Re: GPIO driver
I'm also having troubles with the GPIO classes.
First, if I use the pre-built 2.6.30 kernel, the "echo 32 >export" command does not create gpio32, so the subsequent commands fail with a non-existent directory error. But if I use 64 or 96 instead of 32, it works fine - gpio64 or gpio96 is created and I can manipulate it.
This is with the pre-compiled kernel image from message 6.
Second, I downloaded the 2.6.30 kernel sources from kernel.org, applied the patch from message 6, created a uImage and successfully booted it. In that case, only "echo 96 >export" works.
So 96 always works, 64 works with the precompiled image and 32 never works.
Any thoughts? Is there some initialization step missing? Would it be possible for you to post the .config file used to build the pre-compiled image?
Thank you,
Laszlo
March 14, 2010, 08:11:14 PM
#36
laszlo
laszlo
Show laszlo's last posts.
Show general stats for laszlo.
Full Member
Posts: 2
Re: GPIO driver
I found the config file for the precompiled 2.6.30 kernel in /proc/config.gz and rebuilt with it. I now get the same results with my build of the kernel as with the precompiled kernel image - 32 doesn't work, but 64 & 96 do.
Laszlo
March 15, 2010, 08:44:56 AM
#37
admin
admin
Show admin's last posts.
Show general stats for admin.
Administrator
Super Hero
Posts: 339
Re: GPIO driver
Almost all of the GPIOs are multiplexed pins. The GPIO driver will check the port setting before it enables the GPIO function. The kernel configuration can affect which GPIO pins are available because of the multiplexing. Please check the processor data sheet and SBC user's manual to make sure your kernel configuration does not have conflict with your GPIO usage. Certain GPIO pins that are not used by the kernel may not have the port function register (PIO_PER) set correctly. You need to check the data sheet and set the port for GPIO in order to use them.
March 15, 2010, 09:56:46 AM
#38
Lorena
Lorena
Show Lorena's last posts.
Show general stats for Lorena.
Super Hero
Posts: 8
Re: GPIO driver
Quote from: admin on July 30, 2009, 09:42:38 AM
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
Hello,
I need to implement an interrupt driven GPIO input in Linux for detecting changes of value in a GPIO pin. It isn´t a key. What is the right path for the driver?I don´t find the /dev/input directory.
Thank you very much.
March 17, 2010, 10:42:33 AM
#39
Lorena
Lorena
Show Lorena's last posts.
Show general stats for Lorena.
Super Hero
Posts: 8
Re: GPIO driver
Quote from: Maturity on February 05, 2010, 12:52:45 PM
Sorry for the delay in responding, I had some education and customer issues of my own to deal with. The bottom line is that We finally got it working! Here are some clues that might help the next person. Plus a couple more questions.
What we have determined is that the /sys/class/gpio only seems to appear when using the file system from Glomation :
http://glomationinc.com/Support/9260/9260rootfs.img
or the prebuilt one from at91.com :
http://ftp://www.at91.com/pub/oe/deploy/glibc/images/at91sam9263ek/Angstrom-console-image-demo-glibc.rootfs.jffs2
Also you must have the uImage-2.6.30 from this thread, we have found *no* other that will present /sys/class/gpio the 2.6.27.4 kernel that is shipped on the board does not seem to present the gpio's. This is the one you want.
http://glomation.net/smf/index.php?action=dlattach;topic=27.0;attach=20
IMHO I had hoped that the pre-built image from linux4sam would have worked as I really like the heartbeat pulse of the onboard LED. It makes a nice indicator to see when opening the cabinet that the board is running. Does anyone know if it is possible to write a user (non kernel) program to get this effect with the uImage-2.6.30 image? Or will there be a Glomation kernel that supports it? In any case here is the kernel that has the heartbeat:
http://ftp://www.at91.com/pub/linux/2.6.30-at91/linux-2.6.30-at91-exp-at91sam9260ek.bin
So in summary you need
uImage:
http://glomation.net/smf/index.php?action=dlattach;topic=27.0;attach=20
rootfs:
http://glomationinc.com/Support/9260/9260rootfs.img
The other combinations of uImage and rootfs, including the emdebian stuff in the zip of 9260 files don't seem to present /sys/class/gpio.
~~~~~~
For those that are keen we have set up Eclipse environments to do the development in, it was fairly simple and should enable debug though nobody has needed to even try that yet. This is what works for us on Linux.
Go to
http://www.eclipse.org/downloads/
and download the version of "Eclipse IDE for C/C++ Developers (79 MB)" for your platform. Unpack it into /usr/local then add the following to your .bashrc :
export PATH=$PATH:/usr/local/eclipse
Start Eclipse and go to Help->Install_New_Software and click the Add... button.
In the dialog add Zylin CDT as the name and
http://opensource.zylin.com/zylincdt
as the location. If you unpacked the archive as root then you will need to be doing this as root in order to update the files. You should then be able to install "Zylin Embedded CDT". Go ahead and install it then shutdown Eclipse.
Download the cross compiler from glomation's support page (
http://glomationinc.com/support.html
):
http://glomationinc.com/download/Generic-arm_gcc-4.2.3-glibc-2.3.3.tar.bz2
And unpack it to get it to end up in /usr/local as well. Then add another line to your .bashrc
export PATH=$PATH:/usr/local/arm/gcc-4.2.3-glibc-2.3.3/arm-unknown-linux-gnu/bin
Start Eclipse and create a C project. When it is created right-click on it and bring up the properties. Then in C/C++ Build->Settings change the compiler and linker from gcc to arm-unknown-linux-gnu-gcc and the assembler from as to arm-unknown-linux-gnu-as for [All Configurations]. Then go to C/C++ General->Paths and Symbols, make sure the Includes tab is selected then select C Source File. Next click add and navigate to the include directory of the cross compiler. It is /usr/local/arm/gcc-4.2.3-glibc-2.3.3/arm-unknown-linux-gnu/arm-unknown-linux-gnu/include IIRC. If you need to manually add the libraries they would be at the same level as the include I think.
Additionally, I found that you can get a free Jazz (RTC) Express-C server and clients for 10 users. So the plan is to use RTC to track this work and source.
https://jazz.net/downloads/rational-team-concert/releases/2.0.0.2?p=allDownloads#expressc
~~~~~~
Now to create an api set to manage the gpio's. With any luck our second development board will get updated to the same level of kernel and rootfs without problems as well.
m
Hello,
there is any tutoria for the cross compiler from glomation's support page???
Thank you very much
March 19, 2010, 06:13:13 AM
#40
Lorena
Lorena
Show Lorena's last posts.
Show general stats for Lorena.
Super Hero
Posts: 8
Re: GPIO driver
Quote from: admin on July 03, 2009, 11:12:34 AM
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
Hello!
I need to configure a GPIO as input and configure it for interrupting when there is an edge falling. I have installed the pre-compiled 2.6.30 kernel image and I have checked that exits /sys/class/gpio. But now, What I have to do with the patch?
On the other hand, I know I have to implement a driver Linux and then compiling with the cross compiler from glomation, but the asm/gpio.h doesn´t exist in the gcc-4.2.3-glibc-2.3.3/arm-unknown-linux-gnu/arm-unknown-linux-gnu/include.
Could anybody give me advice?
Thank you!
March 19, 2010, 07:53:38 AM
#41
admin
admin
Show admin's last posts.
Show general stats for admin.
Administrator
Super Hero
Posts: 339
Re: GPIO driver
You don't need GPIO driver if you are going to write your own driver using GPIO pin as interrupt source.
The header files probably should be in the Linux header package. Please install the latest Linux header file package for your development system.
March 19, 2010, 08:27:52 AM
#42
Lorena
Lorena
Show Lorena's last posts.
Show general stats for Lorena.
Super Hero
Posts: 8
Re: GPIO driver
Quote from: admin on March 19, 2010, 07:53:38 AM
You don't need GPIO driver if you are going to write your own driver using GPIO pin as interrupt source.
The header files probably should be in the Linux header package. Please install the latest Linux header file package for your development system.
I´m so sorry but I didn´t understand the answer.
I have installed the kernel 2.6.30. This version includes gpio driver. This kernel+ patch is enough for configuring a GPIO pin as interrupt?
If no, so I suppose that I have to implement a driver or something based on GPIO driver from 2.6.30 kernel. So I will have to make my own source.c and compiling it with cross compiler from glomation. But this compiler doesn´t include the gpio.h. so I can´t use commands like: gpio_request (AT91_PIN_PC6, "IRQ")?
Sorry, but I am beginner. Thank you very much!
March 19, 2010, 08:54:07 AM
#43
admin
admin
Show admin's last posts.
Show general stats for admin.
Administrator
Super Hero
Posts: 339
Re: GPIO driver
You should implement a driver to respond to the interrupt from the GPIO pin rather than using the kernel GPIO driver. The kernel GPIO driver does not have any implementation to process your interrupt event.
As mentioned in the previous post the header files that define the GPIO functions should be in the Linux kernel header package. You need to install the latest kernel header files on your development system in order to compile your driver that access the GPIO functions.
March 22, 2010, 11:42:49 AM
#44
Lorena
Lorena
Show Lorena's last posts.
Show general stats for Lorena.
Super Hero
Posts: 8
Re: GPIO driver
Quote from: admin on March 19, 2010, 08:54:07 AM
You should implement a driver to respond to the interrupt from the GPIO pin rather than using the kernel GPIO driver. The kernel GPIO driver does not have any implementation to process your interrupt event.
As mentioned in the previous post the header files that define the GPIO functions should be in the Linux kernel header package. You need to install the latest kernel header files on your development system in order to compile your driver that access the GPIO functions.
Hello!
Thank you for your reply. I followed your advice and I downloaded the kernel header files on my development system but I think there is a conflict between the include from cross compiler and the include from the kernel files when I build in Eclipse. Is the cross compiler from glomation´s suport page for a specific version kernel linux?
Thank you.
Pages:
1
2
[
3
]
4
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> Announcements
=> General Discussion
=> Programming Tips, Recommendded Readings, etc.
-----------------------------
Peer Support Forums
-----------------------------
=> GESBC-9302
=> GESBC-9260
=> GESBC-9G20
=> GESBC-2440
=> GESBC-9315
Loading...