Difference between revisions of "Fitlet GPIO SDK for Linux"

From fit-PC wiki
Jump to: navigation, search
(Created page with "== fitlet GPIO SDK for Linux == * [http://fit-pc.com/download/fitlet/sw/fitlet-gpio-sdk-for-linux.zip fitlet GPIO SDK for Linux] == Installation == 1. Download the custom ker...")   (change visibility)
 
(Overview)   (change visibility)
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== fitlet GPIO SDK for Linux ==
+
__TOC__
* [http://fit-pc.com/download/fitlet/sw/fitlet-gpio-sdk-for-linux.zip fitlet GPIO SDK for Linux]
+
== Overview ==
 +
* Not supported in mainline Linux kernel
 +
* [[Fitlet:_Linux:_Kernel | Linux Kernel for Fitlet]] must be installed to make this feature work
 +
* GPIO interface on fitlet consists of 9 GPIOs provided by AMD FCH (Fusion Controller Hub)
 +
* The responsible kernel module is gpio_fch
 +
* The kernel module uses the following pin naming convention:
  
== Installation ==
 
1. Download the custom kernel image and headers <LINK_TO_DEB_FILES_HERE> to the fitlet.
 
  
2. Open the terminal and install the new linux-*.deb packages:
+
{| cellpadding="3" border="1" style="border: 1px solid rgb(85, 85, 85); border-collapse: collapse;"
$ sudo dpkg -i /path/to/linux-*.deb
+
|+ GPIO connector pinout
 +
|-
 +
| Pin Number
 +
| Color Code
 +
| GPIO name
 +
| Power domain
 +
| HW source
 +
| Notes
 +
|-
 +
| 1
 +
| Brown
 +
| GPIO89
 +
| 3.3V
 +
| SoC
 +
|
 +
|-
 +
| 2
 +
| Red
 +
| GPIO132
 +
| 3.3V
 +
| SoC
 +
|
 +
|-
 +
| 3
 +
| Orange
 +
| GPIO65
 +
| 3.3V
 +
| SoC
 +
|
 +
|-
 +
| 4
 +
| Yellow
 +
| GPIO66
 +
| 3.3V
 +
| SoC
 +
|
 +
|-
 +
| 5
 +
| Green
 +
| GPIO29
 +
| 1.5V
 +
| SoC
 +
|
 +
|-
 +
| 6
 +
| Blue
 +
| I2C Clock
 +
| 3.3V
 +
| SoC
 +
|
 +
|-
 +
| 7
 +
| Purple
 +
| I2C Data
 +
| 3.3V
 +
| SoC
 +
|
 +
|-
 +
| 8
 +
| Grey
 +
| GPIO73
 +
| 3.3V
 +
| SoC
 +
|
 +
|-
 +
| 9
 +
| White
 +
| GPIO27
 +
| 1.5V
 +
| SoC
 +
|
 +
|-
 +
| 10
 +
| Black
 +
| GPIO28
 +
| 1.5V
 +
| SoC
 +
|
 +
|-
 +
| 11
 +
| Brown
 +
| GPIO12
 +
| 3.3V
 +
| SoC
 +
|
 +
|-
 +
| 12
 +
| Red
 +
| UART Rx
 +
| 3.3V
 +
| SuperIO
 +
|
 +
|-
 +
| 13
 +
| Orange
 +
| UART Tx
 +
| 3.3V
 +
| SuperIO
 +
|
 +
|-
 +
| 14
 +
| Yellow
 +
|
 +
|
 +
| GND
 +
|
 +
|}
  
3. Reboot the system:
+
== Usage ==
$ sudo reboot -f
+
* The GPIO sysfs interface allows users to manipulate any GPIO from userspace dynamically.
 +
* A basic example of GPIO P-1 (Brown) usage (as root user):
  
=== fitlet GPIO ===
+
  $ modprobe gpio_fch
(based on http://droid/mirror/mediawiki/index.php/CM-iGT:_Linux:_Mint#GPIO)
+
 
+
1. GPIO interface on fitlet consists of 9 I/Os provided by AMD FCH (Fusion Controller Hub)
+
2. The responsible kernel module is gpio_fch
+
3. The kernel modules uses the following pin naming convention:
+
 
+
P-1,  GPIO89
+
P-2,  GPIO132
+
P-3,  GPIO65
+
P-4,  GPIO66
+
P-5,  GPIO29 Vout 1.5V
+
P-8,  GPIO73
+
P-9,  GPIO27 Vout 1.5V
+
P-10, GPIO28 Vout 1.5V
+
P-11, GPIO12
+
 
+
4. The GPIO sysfs interface allows users to manipulate any GPIO from userspace dynamically.
+
5. A basic example of GPIO usage (as root user):
+
 
+
  $ modprobe fch_gpio
+
 
  $ echo 89 > /sys/class/gpio/export
 
  $ echo 89 > /sys/class/gpio/export
 
  $ 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
  
6. The source code of gpio_fch driver <LINK_TO_DIFF_FILE_HERE>
+
== Documentation ==
7. The GPIO framework and GPIO sysfs interface are documented in Linux Kernel Documentation
+
* The GPIO framework and GPIO sysfs interface are documented in https://www.kernel.org/doc/Documentation/gpio/gpio.txt
 +
 
 +
[[category:fitlet]]

Latest revision as of 09:03, 24 January 2016

Overview

  • Not supported in mainline Linux kernel
  • Linux Kernel for Fitlet must be installed to make this feature work
  • GPIO interface on fitlet consists of 9 GPIOs provided by AMD FCH (Fusion Controller Hub)
  • The responsible kernel module is gpio_fch
  • The kernel module uses the following pin naming convention:


GPIO connector pinout
Pin Number Color Code GPIO name Power domain HW source Notes
1 Brown GPIO89 3.3V SoC
2 Red GPIO132 3.3V SoC
3 Orange GPIO65 3.3V SoC
4 Yellow GPIO66 3.3V SoC
5 Green GPIO29 1.5V SoC
6 Blue I2C Clock 3.3V SoC
7 Purple I2C Data 3.3V SoC
8 Grey GPIO73 3.3V SoC
9 White GPIO27 1.5V SoC
10 Black GPIO28 1.5V SoC
11 Brown GPIO12 3.3V SoC
12 Red UART Rx 3.3V SuperIO
13 Orange UART Tx 3.3V SuperIO
14 Yellow GND

Usage

  • The GPIO sysfs interface allows users to manipulate any GPIO from userspace dynamically.
  • A basic example of GPIO P-1 (Brown) usage (as root user):
$ modprobe gpio_fch
$ 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

Documentation