Difference between revisions of "Fitlet GPIO SDK for Linux"
From fit-PC wiki
(→fitlet GPIO) (change visibility) |
|||
Line 17: | Line 17: | ||
|+ GPIO pin naming convention on fitlet | |+ GPIO pin naming convention on fitlet | ||
|- | |- | ||
+ | | Pin number | ||
+ | | Color code | ||
| GPIO name | | GPIO name | ||
| HW source | | HW source | ||
− | |||
| Notes | | Notes | ||
|- | |- | ||
+ | | P-1 | ||
+ | | Brown | ||
| GPIO89 | | GPIO89 | ||
| FCH | | FCH | ||
− | |||
| | | | ||
|- | |- | ||
+ | | P-2 | ||
+ | | Red | ||
| GPIO132 | | GPIO132 | ||
| FCH | | FCH | ||
− | |||
| | | | ||
|- | |- | ||
+ | | P-3 | ||
+ | | Orange | ||
| GPIO65 | | GPIO65 | ||
| FCH | | FCH | ||
− | |||
| | | | ||
|- | |- | ||
+ | | P-4 | ||
+ | | Yellow | ||
| GPIO66 | | GPIO66 | ||
| FCH | | FCH | ||
− | |||
| | | | ||
|- | |- | ||
+ | | P-5 | ||
+ | | Green | ||
| GPIO29 | | GPIO29 | ||
| FCH | | FCH | ||
− | |||
| Vout 1.5V | | Vout 1.5V | ||
|- | |- | ||
+ | | P-8 | ||
+ | | Grey | ||
| GPIO73 | | GPIO73 | ||
| FCH | | FCH | ||
− | |||
| | | | ||
|- | |- | ||
+ | | P-9 | ||
+ | | White | ||
| GPIO27 | | GPIO27 | ||
| FCH | | FCH | ||
− | |||
| Vout 1.5V | | Vout 1.5V | ||
|- | |- | ||
+ | | P-10 | ||
+ | | Black | ||
| GPIO28 | | GPIO28 | ||
| FCH | | FCH | ||
− | |||
| Vout 1.5V | | Vout 1.5V | ||
|- | |- | ||
+ | | P-11 | ||
+ | | Brown | ||
| GPIO12 | | GPIO12 | ||
| FCH | | FCH | ||
− | |||
| | | | ||
|- | |- | ||
|} | |} | ||
+ | |||
* The GPIO sysfs interface allows users to manipulate any GPIO from userspace dynamically. | * The GPIO sysfs interface allows users to manipulate any GPIO from userspace dynamically. | ||
Line 76: | Line 87: | ||
$ echo out > /sys/class/gpio/gpio89/direction | $ echo out > /sys/class/gpio/gpio89/direction | ||
$ echo 1 > /sys/class/gpio/gpio89/value | $ echo 1 > /sys/class/gpio/gpio89/value | ||
− | ## at this point voltage measuring on P-1 should give 3.3V | + | ## at this point voltage measuring on P-1 (Brown) should give 3.3V |
$ echo 0 > /sys/class/gpio/gpio89/value | $ echo 0 > /sys/class/gpio/gpio89/value | ||
− | ## at this point voltage measuring on P-1 should give 0.0V | + | ## at this point voltage measuring on P-1 (Brown) should give 0.0V |
$ echo 89 > /sys/class/gpio/unexport | $ echo 89 > /sys/class/gpio/unexport | ||
Revision as of 16:43, 26 October 2015
Installation
- Download the kernel image and kernel headers to the fitlet.
- Open the terminal and install the new linux-*.deb packages:
$ sudo dpkg -i /path/to/linux-*.deb
- Reboot the system:
$ sudo reboot -f
fitlet GPIO
- GPIO interface on fitlet consists of 9 I/Os provided by AMD FCH (Fusion Controller Hub)
- The responsible kernel module is gpio_fch
- The kernel modules uses the following pin naming convention:
Pin number | Color code | GPIO name | HW source | Notes |
P-1 | Brown | GPIO89 | FCH | |
P-2 | Red | GPIO132 | FCH | |
P-3 | Orange | GPIO65 | FCH | |
P-4 | Yellow | GPIO66 | FCH | |
P-5 | Green | GPIO29 | FCH | Vout 1.5V |
P-8 | Grey | GPIO73 | FCH | |
P-9 | White | GPIO27 | FCH | Vout 1.5V |
P-10 | Black | GPIO28 | FCH | Vout 1.5V |
P-11 | Brown | GPIO12 | FCH |
- The GPIO sysfs interface allows users to manipulate any GPIO from userspace dynamically.
- A basic example of GPIO usage (as root user):
$ modprobe fch_gpio $ echo 89 > /sys/class/gpio/export $ echo out > /sys/class/gpio/gpio89/direction $ echo 1 > /sys/class/gpio/gpio89/value ## at this point voltage measuring on P-1 (Brown) should give 3.3V $ echo 0 > /sys/class/gpio/gpio89/value ## at this point voltage measuring on P-1 (Brown) should give 0.0V $ echo 89 > /sys/class/gpio/unexport
- The source code of gpio_fch driver fitlet.gpio.3.16.diff
- The GPIO framework and GPIO sysfs interface are documented in Linux Kernel Documentation :: GPIO