UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

取消
显示结果 
搜索替代 
您的意思是: 
Highlighted
Explorer
Explorer
204 次查看

petalinux 中怎么加入u盘

我的petalinux 2018.2 已经建立好了,我也可以访问SD 卡了。可以我不知道怎么访问我的usb 盘

我的硬件是zynq 7000, 板子上有usb 接口。

https://forums.xilinx.com/t5/Embedded-Linux/how-to-install-and-test-usb-disk-on-petalinux/td-p/896545

这里有些回答,但还是没有得到答案。

 

Kernel Configuration

Ensure the below config parameters are selected

Device Drivers
USB support
    <*> Support for Host-side USB
    <*> EHCI HCD (USB 2.0) support
    <*> USB Mass Storage support
    <*> ChipIdea Highspeed Dual Role Controller
    <*> ChipIdea host controller
        USB Physical Layer drivers --->
        <*> Generic ULPI Transceiver Driver

 

Devicetree

    usb_0: usb@e0002000 {
         compatible = "xlnx,zynq-usb-2.20.a", "chipidea,usb2";
         clocks = <&&clkc 28>
         dr_mode = "host";
         interrupt-parent = <&&intc>;
         interrupts = <0 21 4>;
         reg = <0xe0002000 0x1000>;
         usb-phy = <&&usb_phy0>;
     };
 
 usb_phy0: phy0 {
    compatible = "ulpi-phy";
    #phy-cells = <0>;
    reg = <0xe0002000 0x1000>;
    view-port = <0x170>;
    drv-vbus;
}

 

我会用petalinux-config 

但不知道怎么改devicetree

 

0 项奖励
5 条回复
Xilinx Employee
Xilinx Employee
177 次查看

回复: petalinux 中怎么加入u盘

hi ,

关于修改devicetree:

在petalinux工程目录下,project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi

编辑该文件,加入需要修改的部分。

 

----------------------------------------------------------------------------------------------

如果提供的信息能解决您的问题,请标记为接受为解决方案

如果您认为帖子有帮助,请点击“奖励”。谢谢!

----------------------------------------------------------------------------------------------

 

0 项奖励
Explorer
Explorer
127 次查看

回复: petalinux 中怎么加入u盘

谢谢你的回答。

我把文件改成这样, 就是把上面那段添加到system-user.dtsi

文件如下:

/include/ "system-conf.dtsi"
/ {
};
/ {
};

usb_0: usb@e0002000 {
compatible = "xlnx,zynq-usb-2.20.a", "chipidea,usb2";
clocks = <&&clkc 28>
dr_mode = "host";
interrupt-parent = <&&intc>;
interrupts = <0 21 4>;
reg = <0xe0002000 0x1000>;
usb-phy = <&&usb_phy0>;
};
usb_phy0: phy0 {
compatible = "ulpi-phy";
#phy-cells = <0>;
reg = <0xe0002000 0x1000>;
view-port = <0x170>;
drv-vbus;
}

 

结果报错如下:

 

NOTE: Resolving any missing task queue dependencies
Initialising tasks: 100% |#######################################| Time: 0:00:14
Checking sstate mirror object availability: 100% |###############| Time: 0:00:01
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
ERROR: device-tree-xilinx+gitAUTOINC+f38738e568-r0 do_compile: Function failed: do_compile (log file is located at /home/liwenz/alinx/gpio/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/device-tree/xilinx+gitAUTOINC+f38738e568-r0/temp/log.do_compile.130709)
ERROR: Logfile of failure stored in: /home/liwenz/alinx/gpio/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/device-tree/xilinx+gitAUTOINC+f38738e568-r0/temp/log.do_compile.130709
Log data follows:
| DEBUG: Executing shell function do_compile
| Error: /home/liwenz/alinx/gpio/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/device-tree/xilinx+gitAUTOINC+f38738e568-r0/system-user.dtsi:7.8-20 syntax error
| FATAL ERROR: Unable to parse input tree
| WARNING: /home/liwenz/alinx/gpio/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/device-tree/xilinx+gitAUTOINC+f38738e568-r0/temp/run.do_compile.130709:1 exit 1 from 'dtc -I dts -O dtb -R 8 -p 0x1000 -b 0 -i /home/liwenz/alinx/gpio/build/../components/plnx_workspace/device-tree/device-tree -i /home/liwenz/alinx/gpio/build/tmp/work-shared/plnx-zynq7/kernel-source/include -i /home/liwenz/alinx/gpio/build/tmp/work-shared/plnx-zynq7/kernel-source/include -i /home/liwenz/alinx/gpio/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/device-tree/xilinx+gitAUTOINC+f38738e568-r0 -o ${DTS_NAME}.dtb `basename ${DTS_FILE}`.pp'
| ERROR: Function failed: do_compile (log file is located at /home/liwenz/alinx/gpio/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/device-tree/xilinx+gitAUTOINC+f38738e568-r0/temp/log.do_compile.130709)
ERROR: Task (/home/liwenz/petalinux/components/yocto/source/arm/layers/meta-xilinx/meta-xilinx-bsp/recipes-bsp/device-tree/device-tree.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 3004 tasks of which 2991 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
/home/liwenz/petalinux/components/yocto/source/arm/layers/meta-xilinx/meta-xilinx-bsp/recipes-bsp/device-tree/device-tree.bb:do_compile
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
ERROR: Failed to build project

 

其实别人给我这么说的:

Please follow below steps.

 1 . Open system-user.dtsi and add below device tree changes.

 vim project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi

 

/include/ "system-conf.dtsi"
/ {
};

&usb0 {
dr_mode = "host";
status = "okay";
};

 

&usb1 {
dr_mode = "host";
status = "okay";
};

 

petalinux-build

 

我这么做,可以 petalinux-build 但没有变化,还是看不到u 盘。

还有devicetree 在petalinux-build 后是不是有个结果文件,这样可以核对检查。

workproject/components/plnx_workspace/device-tree/device-tree 下有个

zynq-7000.dtsi 我以为他就是结果文件

上面推荐那么修改,这个文件没变化。 usb 段是这样的

usb0: usb@e0002000 {
compatible = "xlnx,zynq-usb-2.20a", "chipidea,usb2";
status = "disabled";
clocks = <&clkc 28>;
interrupt-parent = <&intc>;
interrupts = <0 21 4>;
reg = <0xe0002000 0x1000>;
phy_type = "ulpi";
};

这里有个disabled , 但我发现串口, sd 都是disable 但他们可以用

0 项奖励
Moderator
Moderator
91 次查看

回复: petalinux 中怎么加入u盘

Hi, @liwenz

 

zynq-7000.dtsi 是工具根据您所导入的hdf文件自动生成的device tree文件,并不是结果文件。您可以通过在system-user.dtsi添加的相关代码对device tree进行修改,重新生成新的dtb文件

 

根据您的报错信息看来是dtsi文件的语法错误。您可以参考一下这个链接尝试解决您的问题。

 

https://forums.xilinx.com/t5/Embedded-Linux/Petalinux-2015-2-1-usb-not-working/td-p/654349

 

-------------------------------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------------------------------
如果提供的信息能解决您的问题,请标记为“接受为解决方案”。
如果您认为帖子有帮助,请点击“奖励”。谢谢!
-------------------------------------------------------------------------------------------------
0 项奖励
Xilinx Employee
Xilinx Employee
75 次查看

回复: petalinux 中怎么加入u盘

@liwenz

 

hi , 

 

1. build 失败是因为device tree语法错误,
Error: /home/liwenz/alinx/gpio/build/tmp/work/plnx_zynq7-xilinx-linux-gnueabi/device-tree/xilinx+gitAUTOINC+f38738e568-r0/system-user.dtsi:7.8-20 syntax error
提示中有出错的行数。这儿&&clkc 28应该是&clkc 28,后面的也一样。

 

2. status = "disabled"; 是关闭的。SD可以用是因为在别的地方打开了(具体应该是pcw.dtsi里)。dts文件是向前覆盖的,生效的是最后一次描述的地方.

 

3. dts编译结果是dtb文件,不是这个zynq-7000.dtsi。dtb可以反编译来核对。不过更简单的方法是在系统启动后 /proc/device-tree目录下查看.

 

4. 建议看下devicetree相关的东西,下面的链接供参考。

http://xilinx.eetrend.com/d6-xilinx/article/2015-10/9340.html
https://elinux.org/Device_Tree_Usage

 


----------------------------------------------------------------------------------------------
如果提供的信息能解决您的问题,请标记为“接受为解决方案”。
如果您认为帖子有帮助,请点击“奖励”。谢谢!

 

0 项奖励
Explorer
Explorer
61 次查看

回复: petalinux 中怎么加入u盘

现在我可以看到u盘了

root@gpio:~# random: crng init done
usb 1-1: USB disconnect, device number 2
lsusb
Bus 001 Device 001: ID 1d6b:0002
root@gpio:~# usb 1-1: new high-speed USB device number 3 using ci_hdrc
usb 1-1: New USB device found, idVendor=058f, idProduct=6387
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1: Product: Mass Storage
usb 1-1: Manufacturer: Generic
usb 1-1: SerialNumber: 086027D0
usb-storage 1-1:1.0: USB Mass Storage device detected
scsi host0: usb-storage 1-1:1.0
scsi 0:0:0:0: Direct-Access Generic Flash Disk 8.07 PQ: 0 ANSI: 4
sd 0:0:0:0: Attached scsi generic sg0 type 0
sd 0:0:0:0: [sda] 61440000 512-byte logical blocks: (31.5 GB/29.3 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
sda: sda1
sd 0:0:0:0: [sda] Attached SCSI removable disk
FAT-fs (sda1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
ls
root@gpio:~# ls /mnt
root@gpio:~# mount /dev/sda1 /mnt
root@gpio:~# ls /mnt
System Volume Information boot bootmgr.efi setup.exe support
autorun.inf bootmgr efi sources
root@gpio:~#

 

文件修改如下:

  

/include/ "system-conf.dtsi"
/ {
};
/{
usb_phy0: usb_phy@0 {
compatible = "usb-nop-xceiv";
#phy-cells = <0>;
//reg = <0xe0002000 0x1000>;
//view-port = <0x170>;
//drv-vbus;
};
};

&usb0 {
//compatible = "xlnx,zynq-usb-2.20.a", "chipidea,usb2";
//clocks = <&&clkc 28>
dr_mode = "host";
//reg = <0xe0002000 0x1000>;
usb-phy = <&usb_phy0>;
};

 

我也不是很懂,但可以看到了。

0 项奖励