Difference between revisions of "Fitlet GPIO SDK for Linux"

From fit-PC wiki
Jump to: navigation, search
(Usage)   (change visibility)
(GPIO)   (change visibility)
Line 80: Line 80:
  
  
 +
{| 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
 +
| Brown
 +
| SoC
 +
| GPIO_1
 +
| GPIO89
 +
| 3.3V
 +
| In
 +
| PU
 +
|-
 +
| 2
 +
| Red
 +
| SoC
 +
| GPIO_2
 +
| GPIO132
 +
| 3.3V
 +
| In
 +
| PU
 +
|-
 +
| 3
 +
| Orange
 +
| SoC
 +
| GPIO_3
 +
| GPIO65
 +
| 3.3V
 +
| Out/High
 +
| PU
 +
|-
 +
| 4
 +
| Yellow
 +
| SoC
 +
| GPIO_4
 +
| GPIO66
 +
| 3.3V
 +
| Out/High
 +
| PU
 +
|-
 +
| 5
 +
| Green
 +
| SoC
 +
| GPIO_5
 +
| GPIO29
 +
| 1.5V
 +
| In
 +
| PD
 +
|-
 +
| 6
 +
| Blue
 +
| SoC
 +
| I2C Clock
 +
|
 +
| 3.3V
 +
|
 +
|
 +
|-
 +
| 7
 +
| Purple
 +
| SoC
 +
| I2C Data
 +
|
 +
| 3.3V
 +
|
 +
|
 +
|-
 +
| 8
 +
| Grey
 +
| SoC
 +
| GPIO_6
 +
| GPIO73
 +
| 3.3V
 +
| Out/Low
 +
| PD
 +
|-
 +
| 9
 +
| White
 +
| SoC
 +
| GPIO_7
 +
| GPIO27
 +
| 1.5V
 +
| In
 +
| PD
 +
|-
 +
| 10
 +
| Black
 +
| SoC
 +
| GPIO_8
 +
| GPIO28
 +
| 1.5V
 +
| In
 +
| PD
 +
|-
 +
| 11
 +
| Brown
 +
| SoC
 +
| GPIO_9
 +
| GPIO12
 +
| 3.3V
 +
| In
 +
| PU
 +
|-
 +
| 12
 +
| Red
 +
| SuperIO
 +
| UART Rx
 +
|
 +
| 3.3V
 +
|
 +
|
 +
|-
 +
| 13
 +
| Orange
 +
| SuperIO
 +
| UART Tx
 +
|
 +
| 3.3V
 +
|
 +
|
 +
|-
 +
| 14
 +
| Yellow
 +
|
 +
|
 +
|
 +
| GND
 +
|
 +
|
 +
|}
 
* 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 usage (as root user):

Revision as of 09:17, 27 October 2015

Installation

  • Open the terminal and install the new linux-*.deb packages:
$ 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)
  • The responsible kernel module is gpio_fch
  • The kernel module uses the following pin naming convention:


GPIO pin naming convention on fitlet with ribbon cable
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


GPIO connector pinout
GPIO

Connector

Source Function/

GPIO#

GPIO# in

Linux

Power

domain

Direction/

Drive

Pull

(PU/PD)

Pin

Number

Color

Code

1 Brown SoC GPIO_1 GPIO89 3.3V In PU
2 Red SoC GPIO_2 GPIO132 3.3V In PU
3 Orange SoC GPIO_3 GPIO65 3.3V Out/High PU
4 Yellow SoC GPIO_4 GPIO66 3.3V Out/High PU
5 Green SoC GPIO_5 GPIO29 1.5V In PD
6 Blue SoC I2C Clock 3.3V
7 Purple SoC I2C Data 3.3V
8 Grey SoC GPIO_6 GPIO73 3.3V Out/Low PD
9 White SoC GPIO_7 GPIO27 1.5V In PD
10 Black SoC GPIO_8 GPIO28 1.5V In PD
11 Brown SoC GPIO_9 GPIO12 3.3V In PU
12 Red SuperIO UART Rx 3.3V
13 Orange SuperIO UART Tx 3.3V
14 Yellow GND
  • 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