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

Login with username, password and session length
June 25, 2017, 01:50:11 AM
News: Glomation introduces new GECM-9G25 SODIMM system on module
Pages: [1]
Topic Tools  
Read July 28, 2011, 10:15:05 AM #0
SteveMartins

Setting GPIO output

Hi,

I'm looking for a quick and easy way to change a GPIO input to output, drive it high, then set it back to input. and ideas?

thanks,

Steve
 
Read July 28, 2011, 05:26:37 PM #1
admin

Re: Setting GPIO output

Upgrade  the kernel to 2.6.30 and up, use the built-in GPIO driver.  Examples here https://www.ridgerun.com/developer/wiki/index.php/How_to_use_GPIO_signals
 
Read September 07, 2011, 11:12:13 AM #2
AwareWolf

Re: Setting GPIO output

I have upgraded to kernel 2.6.30, and am attempting to follow the instructions from the page you linked to, and have it a wall at step 1. Apparently there should be a folder at /sys/class/gpio with files in it. In my kernel, there is no folder called gpio under /sys/class. Did I build the kernel wrong?
 
Read September 07, 2011, 03:14:07 PM #3
admin

Re: Setting GPIO output

Check if sysfs option is enabled in kernel configuration.
 
Read September 12, 2011, 12:47:45 PM #4
AwareWolf

Re: Setting GPIO output

Still struggling.

I now have a sys/class/gpio folder, with these contents:
export gpiochip32 gpiochip64 gpiochip96 unexport

I type echo 82 > /sys/class/gpio/export in the command prompt.

Nothing happens: I DON'T have a /sys/class/gpio/gpio82 folder.

I am using kernel version 2.6.30

Any help would be appreciated.
 
Read September 16, 2011, 08:17:17 AM #5
AwareWolf

Re: Setting GPIO output

Still struggling.

I found that SOME of the GPIO pins will export.  I tried every pin between 0 and 140, which is to say I did the equivalent of :

for (i=0, i<141, i++)
    echo i > /sys/class/gpio/export

The result was that I got SOME folders, like /sys/class/gpio/gpio39. In total, I got 33 of them:
39, 42, 43, 55, 56, 57, 58, 59, 60, 61, 72, 73, 74, 75, 76, 77, 83, 84, 85, 94, 95, 96, 98, 99, 100, 102, 103, 104, 105, 108, 109, 110, 111

So the first question is, why did some pins export but others not? Maybe the Kernel is using some and doesn't want to give them up?

The other question I have is, which GPIO pins correspond to which pins on the GESBC9260S J16 header? For instance, I have an LED on pin 13 of J13, which should be GPIO PB18, right? and PB18 should correspond with /sys/class/gpio/gpio82? (64 + 18 = 82).

Any insight would be appreciated.
 
Read September 16, 2011, 09:00:13 AM #6
admin

Re: Setting GPIO output

The Atmel processor has many peripherals mutiplexed on the GPIO pins.  The kernel configuration plays an important part as which pin is available for GPIO.  Upon receiving GPIO request the GPIO driver will check configuration register of the GPIO block to determine if a pin can be used as GPIO.   The GESBC-9260S user's manual has a table listed the pins of the GPIO header and their multiplexed functionalities.  Unfortunaltely the information does not translate directly into which kernel configuration item affects which pin.   The easiest thing to do is to choose the GPIO pins that is already available with current kernel configuration.  If more pins are needed then you need to dig into kernel source to find out which peripheral dirver uses which pin and disable that driver if it is not used in your application.
 
Read September 29, 2011, 02:43:18 PM #7
AwareWolf

Re: Setting GPIO output

OK, I understand.

I've got almost all that I need; but would love to have PB16 (TK0 & TCLK3), PB17 (TF0 & TCLK4), and PB18 (TD0 & TIOB4). Is there anyone listening here who knows the right kernel config item to get those back? I'm using 2.6.30.
 
Read October 04, 2011, 07:31:38 PM #8
admin

Re: Setting GPIO output

Attached is a 2.6.38.4 version kernel that should have GPIO function working on PB16, PB17, and PB18.

* uImage-2.6.38.4-10-5-2011 (1695.07 KB - downloaded 75 times.)
 
Pages: [1]
Jump to:  

Theme Update by Runic Warrior Originally created by m3talc0re