【发布时间】:2019-04-05 08:58:20
【问题描述】:
我正在尝试在由 OpenWRT 驱动的板上实现恢复模式。 我有一个按钮连接到一些 GPIO:GPIO_PL4。
我使用下一个表达式将 gpio 名称转换为数字表示:
(position of letter in alphabet - 1) * 32 + pin number
所以我得到了PL4 -- 356 映射。
我尝试将下一行添加到 uboot 环境文件 uEnv-default.txt:
if gpio input 356; then
echo "The button is pressed";
fi;
但在启动过程中收到错误消息:
gpio: requesting pin 356 failed
gpio - query and control gpio pins
Usage:
gpio <input|set|clear|toggle> <pin>
- input/set/clear/toggle the specified pin
gpio status [-a] [<bank> | <pin>] - show [all/claimed] GPIOs
然后我尝试使用 gpio status -a 获取有关 GPIO 的信息:
gpio status -a (within uEnv-default.txt)
得到下一个输出:
Bank PA:
...
Bank PL:
PL0: func
...
PL4: func // does it mean that I'm not able to use it as an input
...
PL11: func
PL12: input: 0 [ ]
PL13: input: 0 [ ]
....
所以问题是:我能否将 PL4 gpio 引脚用作当前 gpio 配置的输入,如果不能,如果可能的话,我该如何更改此引脚的 gpio 配置?
我想,我必须在 U-Boot 上应用补丁才能进行正确的 gpio 配置,对吗?
【问题讨论】: