我正在尝试在由OpenWRT驱动的电路板上实现恢复模式。我有一个连接到某个GPIO的按钮:GPIO_PL4。
我使用下一个表达式将gpio名称转换为数字表示:
(position of letter in alphabet - 1) * 32 + pin number
所以我得到了PL4
- 356
映射。
我试图将下一行添加到u引导环境文件qazxsw poi:
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的信息:
gpio status -a
得到了下一个输出:
gpio status -a (within uEnv-default.txt)
所以问题是:我能否使用PL4 gpio引脚作为当前gpio配置的输入,如果没有,如果可能的话,如何更改此引脚的gpio配置?
我想,我必须在U-Boot上应用一个补丁来制作一个合适的gpio配置,对吗?
我找到了解决方案。有两个问题:
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 [ ]
....
命令键入gpio名称:gpio
)。gpio input pl4
提供时钟/电源。看看prcm_apb0_enable