问题描述
使用此处所述的编译的Linux内核,我正在尝试在以下Wiki上导致LED闪烁: Linux GPIO驱动程序.我正在使用Xilinx的Zybo开发板.
Using a linux-kernel compiled as it is described here, I'm trying to make a led blinking following this wiki: Linux GPIO Driver. I'm working with a Zybo-board of Xilinx.
我启用了内核选项:
CONFIG_GPIO_SYSFS=y
CONFIG_SYSFS=y
CONFIG_GPIO_XILINX=y
我检查是否已将SysF安装在/sys中
I checked that I have mounted in /sys the SysFs
我想配置MIO端口的引脚7,因为它连接到板上的led LD4.所以我用了这个表达式:
I want to configure the pin 7 of the MIO port because it is attached to the led LD4 in the board. So I used this expression:
echo 7 > /sys/class/gpio/export
我总是会收到此错误:
export_store: invalid GPIO 7
ash: write error: Invalid argument
我也尝试导出值145 (138+7)
,因为在这里找到了相应的解释: forum_link 和86,因为此人可以正常运行 basic_example .但是我总是遇到同样的错误.
I have also tried to export the values 145 (138+7)
because of the explanation I found here: forum_link and 86 because this guy got the things working basic_example. But I always obtained the same error.
能给我一些帮助吗?也许我必须使用其他偏移量?还是与权限配置有关?
Could you give me some help? Maybe a I have to use other offset? Or is it more related with permission configuration??
推荐答案
我遇到了同样的问题.解决方案是添加906作为"address-gpio"的基础".例如,如果要管理连接到MIO 7的PS的引脚,则应执行以下操作:
I faced the same problem. The solution is to add 906 as a "base" of the "address-gpio". For example, if you want to manage the pin of the PS connected to MIO 7, you should do something like this:
zynq> echo 913 > /sys/class/gpio/export
zynq> echo out > /sys/class/gpio/gpio913/direction
zynq> echo 1 > /sys/class/gpio/gpio913/value
(当然906 + 7 = 913).
(where 906+7=913 of course).
或者,如果您想将其关闭:
Or, if you want to switch it off:
zynq> echo 0 > /sys/class/gpio/gpio913/value
如何找到该值?好吧,就我而言,我很幸运:如果您查看
How do I find this value? Well, in my case I was just lucky: if you have a look in
ls /sys/class/gpio
您可以看到它已经存在gpiochip906
.进入该目录,并查看文件base
(例如,使用"less"):当然只有906值
you can see that it already exists gpiochip906
. Go inside this directory and have a look inside the file base
(using "less" for example): there is only the value 906 of course
这篇关于SysFs接口.我无法在Xilinx的板上(Zybo等)导出gpio引脚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!