Difference between revisions of "Fitlet GPIO SDK for Linux"

From fit-PC wiki
Jump to: navigation, search
(GPIO)   (change visibility)
(Overview)   (change visibility)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Installation ==
+
__TOC__
* Download the [http://www.fit-pc2.com/download/fitlet/Linux/mint/17/linux-image-3.16.7-generic.fitlet_2015.09.27_amd64.deb kernel image] and [http://www.fit-pc2.com/download/fitlet/Linux/mint/17/linux-headers-3.16.7-generic.fitlet_2015.09.27_amd64.deb kernel headers] to the fitlet.
+
== Overview ==
 
+
* Not supported in mainline Linux kernel
* Open the terminal and install the new linux-*.deb packages:
+
* [[Fitlet:_Linux:_Kernel | Linux Kernel for Fitlet]] must be installed to make this feature work
$ sudo dpkg -i /path/to/linux-*.deb
+
 
+
* Reboot the system:
+
$ sudo reboot -f
+
 
+
== GPIO ==
+
 
* GPIO interface on fitlet consists of 9 GPIOs provided by AMD FCH (Fusion Controller Hub)
 
* GPIO interface on fitlet consists of 9 GPIOs provided by AMD FCH (Fusion Controller Hub)
 
* The responsible kernel module is gpio_fch
 
* The responsible kernel module is gpio_fch
Line 15: Line 9:
  
 
{| cellpadding="3" border="1" style="border: 1px solid rgb(85, 85, 85); border-collapse: collapse;"
 
{| cellpadding="3" border="1" style="border: 1px solid rgb(85, 85, 85); border-collapse: collapse;"
|+ GPIO pin naming convention on fitlet with ribbon cable
+
|+ GPIO connector pinout
 
|-
 
|-
| Pin number
+
| Pin Number
| Color code
+
| Color Code
 
| GPIO name
 
| GPIO name
 +
| Power domain
 
| HW source
 
| HW source
 
| Notes
 
| 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
 
|
 
|-
 
|}
 
 
 
{| cellpadding="3" border="1" style="border: 1px solid rgb(85, 85, 85); border-collapse: collapse;"
 
|+ GPIO connector pinout
 
! colspan="2" | GPIO
 
Connector
 
! rowspan="2" | Source
 
! rowspan="2" | Function/
 
GPIO#
 
! rowspan="2" | GPIO# in
 
Linux
 
! rowspan="2" | Power
 
domain
 
! rowspan="2" | Direction/
 
Drive
 
! rowspan="2" | Pull
 
(PU/PD)
 
|-
 
| Pin
 
Number
 
| Color
 
Code
 
 
|-
 
|-
 
| 1
 
| 1
 
| Brown
 
| Brown
| SoC
 
| GPIO_1
 
 
| GPIO89
 
| GPIO89
 
| 3.3V
 
| 3.3V
| In
+
| SoC
| PU
+
|  
 
|-
 
|-
 
| 2
 
| 2
 
| Red
 
| Red
| SoC
 
| GPIO_2
 
 
| GPIO132
 
| GPIO132
 
| 3.3V
 
| 3.3V
| In
+
| SoC
| PU
+
|
 
|-
 
|-
 
| 3
 
| 3
 
| Orange
 
| Orange
| SoC
 
| GPIO_3
 
 
| GPIO65
 
| GPIO65
 
| 3.3V
 
| 3.3V
| Out/High
+
| SoC
| PU
+
|
 
|-
 
|-
 
| 4
 
| 4
 
| Yellow
 
| Yellow
| SoC
 
| GPIO_4
 
 
| GPIO66
 
| GPIO66
 
| 3.3V
 
| 3.3V
| Out/High
+
| SoC
| PU
+
|
 
|-
 
|-
 
| 5
 
| 5
 
| Green
 
| Green
| SoC
 
| GPIO_5
 
 
| GPIO29
 
| GPIO29
 
| 1.5V
 
| 1.5V
| In
+
| SoC
| PD
+
|
 
|-
 
|-
 
| 6
 
| 6
 
| Blue
 
| Blue
| SoC
 
 
| I2C Clock
 
| I2C Clock
|
 
 
| 3.3V
 
| 3.3V
|  
+
| SoC
 
|  
 
|  
 
|-
 
|-
 
| 7
 
| 7
 
| Purple
 
| Purple
| SoC
 
 
| I2C Data
 
| I2C Data
|
 
 
| 3.3V
 
| 3.3V
|  
+
| SoC
 
|  
 
|  
 
|-
 
|-
 
| 8
 
| 8
 
| Grey
 
| Grey
| SoC
 
| GPIO_6
 
 
| GPIO73
 
| GPIO73
 
| 3.3V
 
| 3.3V
| Out/Low
+
| SoC
| PD
+
|
 
|-
 
|-
 
| 9
 
| 9
 
| White
 
| White
| SoC
 
| GPIO_7
 
 
| GPIO27
 
| GPIO27
 
| 1.5V
 
| 1.5V
| In
+
| SoC
| PD
+
|
 
|-
 
|-
 
| 10
 
| 10
 
| Black
 
| Black
| SoC
 
| GPIO_8
 
 
| GPIO28
 
| GPIO28
 
| 1.5V
 
| 1.5V
| In
+
| SoC
| PD
+
|
 
|-
 
|-
 
| 11
 
| 11
 
| Brown
 
| Brown
| SoC
 
| GPIO_9
 
 
| GPIO12
 
| GPIO12
 
| 3.3V
 
| 3.3V
| In
+
| SoC
| PU
+
|
 
|-
 
|-
 
| 12
 
| 12
 
| Red
 
| Red
| SuperIO
 
 
| UART Rx
 
| UART Rx
|
 
 
| 3.3V
 
| 3.3V
|  
+
| SuperIO
 
|  
 
|  
 
|-
 
|-
 
| 13
 
| 13
 
| Orange
 
| Orange
| SuperIO
 
 
| UART Tx
 
| UART Tx
|
 
 
| 3.3V
 
| 3.3V
|  
+
| SuperIO
 
|  
 
|  
 
|-
 
|-
 
| 14
 
| 14
 
| Yellow
 
| Yellow
|
 
 
|  
 
|  
 
|  
 
|  
 
| GND
 
| GND
|
 
 
|  
 
|  
 
|}
 
|}
 +
 +
== Usage ==
 
* 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.
* A basic example of GPIO usage (as root user):
+
* A basic example of GPIO P-1 (Brown) usage (as root user):
  
  $ modprobe fch_gpio
+
  $ modprobe gpio_fch
 
  $ 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
Line 239: Line 130:
 
  $ echo 89 > /sys/class/gpio/unexport
 
  $ echo 89 > /sys/class/gpio/unexport
  
* The source code of gpio_fch driver [http://www.fit-pc2.com/download/fitlet/Linux/mint/17/fitlet.gpio.3.16.diff fitlet.gpio.3.16.diff]
+
== Documentation ==
* The GPIO framework and GPIO sysfs interface are documented in [https://www.kernel.org/doc/Documentation/gpio/gpio.txt Linux Kernel Documentation :: GPIO]
+
* The GPIO framework and GPIO sysfs interface are documented in https://www.kernel.org/doc/Documentation/gpio/gpio.txt
  
 
[[category:fitlet]]
 
[[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