Jetson Xavier gpio编程 (8)

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  解除用户使用权限

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

知秋贺

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值