Difference between revisions of "GPIO"

From Gumstix User Wiki
Jump to: navigation, search
Line 4: Line 4:
  
  
* 3.3V
+
* Logic level (3.3V) signals
 
* 3-4mA max
 
* 3-4mA max
  
Line 20: Line 20:
 
<br>
 
<br>
 
<br>
 
<br>
 +
 +
 +
== Accessing GPIO's from userland ==
 +
 +
 +
If proc-gpio is a module, add it to /etc/modules or do a modprobe proc-gpio.
 +
 +
A number of files exist under /proc/gpio, one for each GPIO on the PXA processor.
 +
 +
If you cat one of these files, you get, eg:
 +
<pre>
 +
# cat /proc/gpio/GPIO12
 +
12 GPIO in set
 +
</pre>
 +
 +
That tells you — GPIO number, function (either GPIO, AF 1, AF 2, or AF 3), in|out, set|clear.
 +
 +
You can change any of those values, by writing to the file, eg:
 +
<pre>
 +
# echo "AF1 out" > /proc/gpio/GPIO12
 +
</pre>
 +
 +
This sets GPIO12 to AF1, out mode. (In the case of GPIO12, the PXA defines this function as putting out the 32kHz clock signal.) this is currently case-sensitive
 +
 +
If you have the GPIO set to an output, and GPIO mode, you can set or clear the signal:
 +
<pre>
 +
# echo "GPIO out set" > /proc/gpio/GPIO12
 +
# echo "GPIO out clear" > /proc/gpio/GPIO12
 +
</pre>
 +
The alternative functions are described in the PXA255 Developer's Manual (link should be found in the Featured links-box) section 4.1.2.
 +
 +
 +
 +
 +
 +
 +
 +
gpio-event
 +
 
<br>
 
<br>
 
<br>
 
<br>

Revision as of 08:47, 10 April 2008

GPIO( n )


  • Logic level (3.3V) signals
  • 3-4mA max


all GPIO's information and examples should go here


todo


According to the PXA270 datasheet: http://pubs.gumstix.com/documents/PXA%20Documentation/PXA270/PXA270%20Electrical,%20Mechanical,%20and%20Thermal%20Specification%20%5b280002-005%5d.pdf most of the pins are limited to 3mA, and a few can go upto 4 mA (see page 5-9)




Accessing GPIO's from userland

If proc-gpio is a module, add it to /etc/modules or do a modprobe proc-gpio.

A number of files exist under /proc/gpio, one for each GPIO on the PXA processor.

If you cat one of these files, you get, eg:

# cat /proc/gpio/GPIO12
12 GPIO in set

That tells you — GPIO number, function (either GPIO, AF 1, AF 2, or AF 3), in|out, set|clear.

You can change any of those values, by writing to the file, eg:

# echo "AF1 out" > /proc/gpio/GPIO12

This sets GPIO12 to AF1, out mode. (In the case of GPIO12, the PXA defines this function as putting out the 32kHz clock signal.) this is currently case-sensitive

If you have the GPIO set to an output, and GPIO mode, you can set or clear the signal:

# echo "GPIO out set" > /proc/gpio/GPIO12
# echo "GPIO out clear" > /proc/gpio/GPIO12

The alternative functions are described in the PXA255 Developer's Manual (link should be found in the Featured links-box) section 4.1.2.




gpio-event





Related pages on the old wiki:

http://docwiki.gumstix.org/index.php/GPIO_event

http://docwiki.gumstix.org/index.php/Tips_and_tricks#Access_GPIOs_from_user-space

http://docwiki.gumstix.org/index.php/Sample_code/C/gpregs

http://docwiki.gumstix.org/index.php/Kernel_programming

.