Difference between revisions of "GPIO/zh"

From FriendlyELEC WiKi
Jump to: navigation, search
(Created page with "English")
 
(updated by API)
Line 1: Line 1:
 
[[GPIO|English]]
 
[[GPIO|English]]
 +
 +
===S5P4418/S5P6818下计算Linux gpio索引号的方法===
 +
看管脚定义,共有GPIOA ~ GPIOD 4 组,<br/>
 +
用以下命令看GPIO针脚<br/>
 +
<syntaxhighlight lang="bash">
 +
#/bin/sh
 +
cd /sys/class/gpio
 +
for i in gpiochip* ; do echo `cat $i/label`: `cat $i/base` ; done
 +
</syntaxhighlight>
 +
在T2上输出
 +
<syntaxhighlight lang="bash">
 +
nxp-gpio.0: 0
 +
nxp-gpio.4: 128
 +
nxp-gpio.5: 160
 +
nxp-gpio.1: 32
 +
nxp-gpio.2: 64
 +
nxp-gpio.3: 96
 +
</syntaxhighlight>
 +
每一个label表示一组,上面是显示6组,<br/>
 +
那么,对应的就是<br/>
 +
<syntaxhighlight lang="bash">
 +
nxp-gpio.0: 0        -> GPIOA
 +
nxp-gpio.4: 128        -> GPIOE  ->AliveGPIO3
 +
nxp-gpio.5: 160        -> GPIOF  ->AliveGPIO5
 +
nxp-gpio.1: 32        -> GPIOB
 +
nxp-gpio.2: 64        -> GPIOC
 +
nxp-gpio.3: 96        -> GPIOD
 +
</syntaxhighlight>
 +
每一组之间差32,是通过cat gpiochip0/ngpio查看的

Revision as of 03:30, 20 March 2019

English

S5P4418/S5P6818下计算Linux gpio索引号的方法

看管脚定义,共有GPIOA ~ GPIOD 4 组,
用以下命令看GPIO针脚

#/bin/sh
cd /sys/class/gpio
for i in gpiochip* ; do echo `cat $i/label`: `cat $i/base` ; done

在T2上输出

nxp-gpio.0: 0
nxp-gpio.4: 128
nxp-gpio.5: 160
nxp-gpio.1: 32
nxp-gpio.2: 64
nxp-gpio.3: 96

每一个label表示一组,上面是显示6组,
那么,对应的就是

nxp-gpio.0: 0         -> GPIOA
nxp-gpio.4: 128         -> GPIOE  ->AliveGPIO3
nxp-gpio.5: 160         -> GPIOF  ->AliveGPIO5
nxp-gpio.1: 32         -> GPIOB
nxp-gpio.2: 64         -> GPIOC
nxp-gpio.3: 96         -> GPIOD

每一组之间差32,是通过cat gpiochip0/ngpio查看的