我是靠谱客的博主 爱笑板栗,这篇文章主要介绍Jetson-TX2中GPIO端口号的计算及端口的控制,现在分享给大家,希望可以做个参考。

Jetson-TX2中引脚总共有两个group,分别是main和aon参见tegra186-gpio.h,分别是320和256,具体的计算公式如下:

group+ (port * 8 + pin)

tegra186-gpio.h文件:

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* GPIOs implemented by main GPIO controller */ #define TEGRA_MAIN_GPIO_PORT_A 0 #define TEGRA_MAIN_GPIO_PORT_B 1 #define TEGRA_MAIN_GPIO_PORT_C 2 #define TEGRA_MAIN_GPIO_PORT_D 3 #define TEGRA_MAIN_GPIO_PORT_E 4 #define TEGRA_MAIN_GPIO_PORT_F 5 #define TEGRA_MAIN_GPIO_PORT_G 6 #define TEGRA_MAIN_GPIO_PORT_H 7 #define TEGRA_MAIN_GPIO_PORT_I 8 #define TEGRA_MAIN_GPIO_PORT_J 9 #define TEGRA_MAIN_GPIO_PORT_K 10 #define TEGRA_MAIN_GPIO_PORT_L 11 #define TEGRA_MAIN_GPIO_PORT_M 12 #define TEGRA_MAIN_GPIO_PORT_N 13 #define TEGRA_MAIN_GPIO_PORT_O 14 #define TEGRA_MAIN_GPIO_PORT_P 15 #define TEGRA_MAIN_GPIO_PORT_Q 16 #define TEGRA_MAIN_GPIO_PORT_R 17 #define TEGRA_MAIN_GPIO_PORT_T 18 #define TEGRA_MAIN_GPIO_PORT_X 19 #define TEGRA_MAIN_GPIO_PORT_Y 20 #define TEGRA_MAIN_GPIO_PORT_BB 21 #define TEGRA_MAIN_GPIO_PORT_CC 22 #define TEGRA_MAIN_GPIO_PORT_DD 23 #define TEGRA_MAIN_GPIO(port, offset) ((TEGRA_MAIN_GPIO_PORT_##port * 8) + offset) /* GPIOs implemented by AON GPIO controller */ #define TEGRA_AON_GPIO_PORT_S 0 #define TEGRA_AON_GPIO_PORT_U 1 #define TEGRA_AON_GPIO_PORT_V 2 #define TEGRA_AON_GPIO_PORT_W 3 #define TEGRA_AON_GPIO_PORT_Z 4 #define TEGRA_AON_GPIO_PORT_AA 5 #define TEGRA_AON_GPIO_PORT_EE 6 #define TEGRA_AON_GPIO_PORT_FF 7 #define TEGRA_AON_GPIO(port, offset) ((TEGRA_AON_GPIO_PORT_##port * 8) + offset)

1.GPIO8/ALS_PROX_INT在Jetson-TX2-Generic-Customer-Pinmux-Template文件GPIO一栏中查找对应值为GPIO3_PI.04(如下图),根据tegra186-gpio.h中对应的PI为PORT_I的缩写即在main组即#define TEGRA_MAIN_GPIO_PORT_I 8,所以group是320,port为8,pin为4。

group+ (port * 8 + pin)=320+(8*8+4)=388

2.GPIO10/WIFI_WAKE_AP在Jetson-TX2-Generic-Customer-Pinmux-Template文件GPIO一栏中查找对应值为GPIO3_PC.00(如下图),根据tegra186-gpio.h中对应的PC为PORT_C的缩写即在main组即#define TEGRA_MAIN_GPIO_PORT_C 2,所以group是320,port为2,pin为0。

group+ (port * 8 + pin)=320+(2*8+0)=336

控制GPIO口的语句为:(在root权限下,正极接3.3V负极接端口)

echo 388 > /sys/class/gpio/export   //端口号

echo out > /sys/class/gpio/gpio388/direction    //方向

echo 1 > /sys/class/gpio/gpio388/value      //电平值

以上为GPIO口输出为高电平。

参考资料:

  1. https://blog.csdn.net/qq_38880380/article/details/78799103
  2. https://devtalk.nvidia.com/default/topic/1003613/jetson-tx2/gpio-doesn-t-work-/1

最后

以上就是爱笑板栗最近收集整理的关于Jetson-TX2中GPIO端口号的计算及端口的控制的全部内容,更多相关Jetson-TX2中GPIO端口号内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(72)

评论列表共有 0 条评论

立即
投稿
返回
顶部