Changes
* This application note applies to fitlet2 supports I2C GPIO extender if configured with the [http://fit-pc.com/wiki/index.php/Fitlet2_FACET_Cards#FC-SCG FC-SCG FACET]FACET-Card running Linux.* It provides an example of how to use the supported I2C GPIO extender feature of FC-SCG under Linux.
==I2c gpio I2C GPIO extender binding and usage==
1. Make sure that the kernel you use supports the necessary driver. <br>Check the following entries in the kernel config:<pre>CONFIG_GPIO_PCA953X=[y]CONFIG_I2C=yCONFIG_I2C_CHARDEV=y</pre>2. Make sure that the appropriate I2C bus is enabled in BIOS settings: <br>Chipset -> South Cluster Configuration -> LPSS Configuration LPSS I2C #[1-8] Support is set to ACPI mode or PCI mode Set LPSS I2C #[1-8] Speed is set to Standard Mode of Fast Mode<br>'''NOTE:''' It’s strongly recommended that all buses are enabled in the range of 1-7
4. Bind the above found device to driver (superuser privileges are necessary)
<pre>
echo pca9535 $busaddr >/sys/bus/i2c/devices/i2c-${busnum}/new_device
</pre>
Then check the kernel debug messages for a line like the following:
<pre>
i2c i2c-7: new_device: Instantiated device pca9535 at 0x27
</pre> 5. To find the appropriate GPIO , issue the command:<pre>
ls /sys/bus/i2c/drivers/pca953x/
</pre>and Then look the output for a line like this:<pre>
7-0027
</pre>and And then issue the command:<pre>
ls /sys/class/gpio/gpiochip*/device -l
</pre>and Afterwards, look at the output for a line like thisthe following:<pre>
/sys/class/gpio/gpiochip251/device -> ../../../7-0027
</pre>
The bus number and address have has to be the same in the both cases (7 and 27 in the example).Hence, the gpiochip251 is the to be sought; the individual GPIO line number are from 251 to 251+15
6. The found GPIO found may be operated over sysfs interface this in the following way:
issue the commands:
<pre>
export n=251 # desired GPIO number
echo $n >/sys/class/gpio/export
cat /sys/class/gpio/gpio$n/value # read the input value
echo 1 > /sys/class/gpio/gpio$n/value # write a value for output
</pre>
[[category: fitlet2]]
[[category: software]]
[[category: Extension boards]]
[[category: application notes]]