GPIO lines are attached to gpiochips. Look in /sys/class/gpio and you should see gpiochip240, 248, and 288. I haven’t yet determined which GPIOs are connected to 240.
If you download the pinmux spreadsheet and unhide column G you’ll see GPIO names like GPIO3_PA.00. Ignore the GPIO3_P portion, the A.00 is the important part. The alpha portion is the port, the numeric is the IO in the port. Some ports have a double alpha designation, like AA. Single alphas are attached to gpiochip288 while double alphas are on gpiochip248.
Take the alpha portion as a number (A=0, B=1, …) and multiply by 8 then add the numeric value. Finally add the gpiochip number. For double alphas AA=0, BB=1, …
e.g. GPIO3_PG.02: Single alpha so the gpiochip is 288, G = 6. So we have 288 + 6 * 8 + 2 = 338
Back to the spreadsheet, column A has the signal name and column B has the ball number. The expansion header is labelled with the signal name. The signal name for GPIO3_PG.02 is GPIO28.
以上解释了,为什么是gpio422 对应的是MCLK05,刚开始的时候我也是有些困惑的。
下面我们使用命令行对gpio422进行操作;
1.通过终端进入:
cd /sys/class/gpio
gpiochipX是一组GPIO的控制器,不是具体的GPIO,如果我们想要控制具体的一个,首先查看jetson xavier提供的GPIO和对应的接口,比如上图中,7号引脚对应的是gpio422,这个名字就是写程序要控制的gpio名字。申请用户空间使用权限。
如 echo 422 > export
cd gpio422
ls
echo out > direction
cat direction
不再使用时,使用命令 echo 422 > unexport 解除用户使用权限
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)