Difference between revisions of "Fitlet GPIO usage manual in Linux environment"

From fit-PC wiki
Jump to: navigation, search
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
* This application notes applies to fitlet models running Linux environment.
+
* This application notes applies to fitlet1 models running Linux environment.
 
* It provides instructions to install the dkms kernel module to enable GPIO functionality.
 
* It provides instructions to install the dkms kernel module to enable GPIO functionality.
  
=='''Instructions:'''==
+
== Installation ==
 +
* Download and install the package:
 +
$ wget https://fit-iot.com/files/download/fitlet/sw/gpio-fch-dkms_1.01.deb
 +
$ sudo dpkg -i gpio-fch-dkms_1.01.deb
  
# Download the GPIO dkms deb file from - [https://fit-iot.com/files/download/fitlet/sw/gpio-fch-dkms_1.01.deb HERE]
+
* Verify the installation:
# Run the shell and type the below commands:
+
$ modinfo gpio-fch
  $ sudo -i
+
filename:       /lib/modules/4.15.0-20-generic/extra/gpio-fch.ko
  $ dpkg -i gpio-fch-dkms_1.01.deb
+
license:       GPL
  $ modprobe gpio_fch
+
  description:    GPIO interface for AMD Mullins FCH (Fusion Controller Hub)
  $ echo 89 > /sys/class/gpio/export
+
  author:        Denis Turischev <denis.turischev@compulab.co.il>
  $ echo out > /sys/class/gpio/gpio89/direction
+
  srcversion:    606B1C81CF1D962BE0B5C92
  $ echo 1 > /sys/class/gpio/gpio89/value
+
  alias:          pci:v00001022d0000780Esv*sd*bc*sc*i*
  ## at this point voltage measuring on P-1 (Brown) should give 3.3V
+
  depends:       
  $ echo 0 > /sys/class/gpio/gpio89/value
+
  retpoline:      Y
## at this point voltage measuring on P-1 (Brown) should give 0.0V
+
  name:          gpio_fch
$ echo 89 > /sys/class/gpio/unexport
+
  vermagic:      4.15.0-20-generic SMP mod_unload
  
* GPIO connector Pinout
+
==  GPIO connector Pinout ==
 
{| class="wikitable"
 
{| class="wikitable"
 
! Pin Number
 
! Pin Number
Line 125: Line 128:
 
|}
 
|}
  
 
+
== Usage example ==
 
+
$ sudo -i
===Example for the GPIO input:===
+
 
+
 
  $ modprobe gpio_fch
 
  $ modprobe gpio_fch
 
  $ echo 89 > /sys/class/gpio/export
 
  $ 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 in > /sys/class/gpio/gpio89/direction
 
  $ echo in > /sys/class/gpio/gpio89/direction
  $ cat /sys/class/gpio/gpio89/value0
+
  $ cat /sys/class/gpio/gpio89/value
  # cat command will print 0 or 1 depending if voltage measuring on P-1 (Brown) was 0V or 3.3V
+
  ## at this point cat command will print 0 or 1 depending if voltage measuring on P-1 (Brown) was 0V or 3.3V
 +
 
  $ echo 89 > /sys/class/gpio/unexport
 
  $ echo 89 > /sys/class/gpio/unexport

Latest revision as of 07:28, 25 August 2019

  • This application notes applies to fitlet1 models running Linux environment.
  • It provides instructions to install the dkms kernel module to enable GPIO functionality.

Installation

  • Download and install the package:
$ wget https://fit-iot.com/files/download/fitlet/sw/gpio-fch-dkms_1.01.deb
$ sudo dpkg -i gpio-fch-dkms_1.01.deb
  • Verify the installation:
$ modinfo gpio-fch
filename:       /lib/modules/4.15.0-20-generic/extra/gpio-fch.ko
license:        GPL
description:    GPIO interface for AMD Mullins FCH (Fusion Controller Hub)
author:         Denis Turischev <denis.turischev@compulab.co.il>
srcversion:     606B1C81CF1D962BE0B5C92
alias:          pci:v00001022d0000780Esv*sd*bc*sc*i*
depends:        
retpoline:      Y
name:           gpio_fch
vermagic:       4.15.0-20-generic SMP mod_unload

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 example

$ sudo -i
$ 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 in > /sys/class/gpio/gpio89/direction
$ cat /sys/class/gpio/gpio89/value
## at this point cat command will print 0 or 1 depending if voltage measuring on P-1 (Brown) was 0V or 3.3V

$ echo 89 > /sys/class/gpio/unexport