Personal tools

Log in

Changes

From IGEP - ISEE Wiki

Jump to: navigation, search

How to use GPIOs

891 bytes added, 16:07, 9 January 2012
no edit summary
To make sure than driver works well, make the next test with GPIO_136 and GPIO_137: <br>
NOTE: Make sure that MMC2_DAT4 and MMC2_DAT5 are not used, for more information visit this [[Mux_configurationMux configuration|page]]. With IGEP v2 RC5 (version without WIFI) this pins are not used by default.
=== Configure Mux ===
echo 0x104&gt;sdmmc2_dat5
</pre>
Use cat to check it:<br><pre>cat sdmmc2_dat4
cat sdmmc2_dat5
</pre><br>The result will be similar than this:<pre>root@localhost:/sys/kernel/debug/omap_mux# cat sdmmc2_dat4
name: sdmmc2_dat4.gpio_136 (0x48002164/0x134 = 0x0104), b ae4, t NA
mode: OMAP_PIN_INPUT | OMAP_MUX_MODE4
signals: sdmmc2_dat4 | sdmmc2_dir_dat0 | NA | sdmmc3_dat0 | gpio_136 | NA | NA | safe_mode
</pre>and<pre>root@localhost:/sys/kernel/debug/omap_mux# cat sdmmc2_dat5
name: sdmmc2_dat5.gpio_137 (0x48002166/0x136 = 0x0104), b ah3, t NA
mode: OMAP_PIN_INPUT | OMAP_MUX_MODE4
signals: sdmmc2_dat5 | sdmmc2_dir_dat1 | cam_global_reset | sdmmc3_dat1 | gpio_137 | hsusb3_tll_stp | mm3_rxdp | safe_mode
</pre>Note: OMAP_PIN_INPUT=Input and Output pin and OMAP_PIN_OUTPUT=Output pin.
=== Link GPIO === <br>  === Read/Write test ===
Link GPIO_136 and GPIO_137 with a wire, these pins are located in J990 connector with numbers 7 and 9. Type next text:
<pre>
root@localhost:~/svn.hylands.org/linux/gpio/app# ./gpio input 136
root@localhost:~/svn.hylands.org/linux/gpio/app# ./gpio output 137 0
root@localhost:~/svn.hylands.org/linux/gpio/app# ./gpio get 136
0
root@localhost:~/svn.hylands.org/linux/gpio/app# ./gpio output 137 1
root@localhost:~/svn.hylands.org/linux/gpio/app# ./gpio get 136
1
root@localhost:~/svn.hylands.org/linux/gpio/app#
</pre>
The text above show that driver work properly, GPIO_136 is configure like input and GPIO_137 is configure like output with value 0, now read GPIO_136 and the result is 0. To make sure configure GPIO_137 with value 1 and GPIO_136 read 1.
<br>
This driver have more options like IRQ, but is not explained here.
'''Under construction'''<br>
4,199
edits