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

Login with username, password and session length
February 05, 2012, 07:03:24 AM
News: Glomation introduced new wireless ready low cost GESBC-9260S
Pages: 1 [2] 3 4
Topic Tools  
Read September 03, 2009, 08:49:22 AM #15
gaurav.joshi

Re: GPIO driver

Ok Thanks
 
Read January 08, 2010, 10:21:27 AM #16
tom

Re: GPIO driver

Hi, Could someone explain how to install this driver and get it working? I have used the mknod command and this works, but when compiling the makefile it gives me a syntax error! I am a complete linux beginner so any help would be really appreciated.
 
Read January 08, 2010, 10:51:12 AM #17
admin

Re: GPIO driver

Upgrade to a newer version of kernel to use the built-in GPIO driver is a better choice.
 
Read January 13, 2010, 08:34:52 AM #18
tom

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


Hi, I am very new to linux and am just trying to interface with the I/O pins. I have installed kernel 2.6.30 as suggested and tried to do the steps above but get the following error when i try the 2nd line. I have done the 1st line, which was...

/ # echo "out" > /sys/class/gpio/gpio{32}/

I got no error with this, which i assume means that it worked as expected.

error from 2nd line can be seen below...

/ # echo "out" > /sys/class/gpio/gpio{32}/direction
-sh: can't create /sys/class/gpio/gpio{32}/direction: nonexistent directory

I guess i'm probably making a really simple mistake, hopefully someone can help me?

also is there anyway to implement these command lines into a c file so that my gesbc-9260 is talking to I/O pins when it starts up?
 
Read January 14, 2010, 08:14:49 AM #19
admin

Re: GPIO driver

The commands should be,

echo 32 > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio32/direction
echo "1" > /sys/class/gpio/gpio32/value
sleep 3
echo "0" > /sys/class/gpio/gpio32/value

You can use system function call in your C program or use the sample program from here http://www.avrfreaks.net/wiki/index.php/Documentation:Linux/GPIO#gpio-sysfs
« Last Edit: January 15, 2010, 02:30:54 PM by admin »
 
Read January 24, 2010, 06:23:20 PM #20
Maturity

Re: GPIO driver

...

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


Is there a emdebian rootfs image that works with this kernel?  Everything that I have tried for the 9260 from the Glomation support page seems to panic when it is starting.

M
 
Read January 25, 2010, 09:07:16 AM #21
admin

Re: GPIO driver

The factory installed file system should work with any kernel.  Please check your U-boot MTD partition parameters.  The NAND FLASH name for the Atmel processor based hardware has been changed from kernel version 2.6.27 and up.
 
Read January 25, 2010, 01:47:13 PM #22
Maturity

Re: GPIO driver

I will have a go at updating just the kernel to the 2.26.30 version with u-boot and see how that turns out.  Thank you.

m
 
Read January 29, 2010, 10:36:56 PM #23
Maturity

Re: GPIO driver

I have managed to install the precompiled 2.6.30 kernel and even tried the 2.6.27.4 kernel but neither seem to present a /sys/class/gpio directory to write to. What step have I missed ?

# echo 32 > /sys/class/gpio/export
-sh: can't create /sys/class/gpio/export: nonexistent directory
# ls /sys/class
bdi           mem           net           scsi_disk     usb_host
display       misc          ppp           scsi_host     vc
firmware      mmc_host      rtc           tty           vtconsole
input         mtd           scsi_device   usb_endpoint


I even tried the 2.6.30 kernel from at91.com with unchanged result.


m
 
Read February 01, 2010, 08:36:10 PM #24
admin

Re: GPIO driver

The 2.6.30 kernel posted in this thread has been verified to have a working GPIO driver.
 
Read February 02, 2010, 07:34:02 AM #25
Maturity

Re: GPIO driver

Dear admin,

Before answering this question please keep in mind that we here are not experts in embedded devices, nor is that likely to change in the near term.  Our goal is just to get these things programmed and start deploying them.  To this end answers saying the NAND flash name had changed meant helped not that much.  But being told that it was changed from at91_nand to atmel_nand enabled us to figure out what to change and make some progress.

The 2.6.30 kernel posted in this thread has been verified to have a working GPIO driver.

That just reiterates what was stated previously in this thread.  We have two boards, one with the 2.26.30 kernel and the other with the factory image (2.6.27.4 I think).  They both respond as I have indicated in my earlier post.  Keeping mind our understanding level can you tell us :

1) in a simplified step-by-step fashion how to wiggle the IO's. Both devices have a /sys directory but not /sys/class/gpio/ and do not seem to respond positively to /sys/class/gpio/export or /sys/class/gpio/gpio*

2) where to find the C compiler includes and libraries that support writing to the IO's.  We have managed to find programs that apparently write to the gpio pins but they make use of functions like map() that are undefined when using the native or cross compiler solutions available on the glomationinc/support.html page.  FYI I have seen at least one other unanswered request for this particular info in this forum as well.

m
 
Read February 02, 2010, 10:00:40 AM #26
admin

Re: GPIO driver

There isn't any step by step instructions on how to create the /sys/class/gpio.   When the 2.6.30 kernel is used with the factory installed file system the directory is created automatically.  The instructions in previous posts gave exact commands needed to operate the GPIO pins.

 
Read February 02, 2010, 12:56:49 PM #27
Maturity

Re: GPIO driver

There is nobody in the office that can try it right at this moment but I will give it a go when I get back later this afternoon.  However I believe that we tried this combination already (the uImage-2.6.30 from your earlier append and the 9260rootfs.img from http://glomationinc.com/support.html ).  Or are you referencing a different rootfs imagemg as the "factory" version.

Below are the instructions that we have tried but the very first step failed in all cases (as shown previously).  So if the uImage02.6.30 is enabled for GPIO and the 9260rootfs.img is the right one there remains a missing link.

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.
...

m
 
Read February 05, 2010, 12:52:45 PM #28
Maturity

Re: GPIO driver

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
 
Read February 12, 2010, 04:16:51 PM #29
Maturity

Re: GPIO driver

A couple of observations if anyone is keen.

GPIO 41 appears to control the red LED on the board.

When you switch the direction to "out" the GPIO will be driven low from the floating high level of the input mode.  Even writing a 1 to the value beforehand does not seem to prevent this transition.

m
 
Pages: 1 [2] 3 4
Jump to:  

Theme Update by Runic Warrior Originally created by m3talc0re