cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
11,178 Views
Registered: ‎01-26-2016

Cannot start USB mass storage device on PetaLinux 2015.4

Jump to solution

I followed the instructions on http://www.wiki.xilinx.com/Zynq+Linux+USB+Device+Driver to configure the kernel, and set the device tree to "peripheral" mode. I built the image.ub, and boot it on my custom hardware.

 

Kernel initialization shows that the USB ULPI PHY can be properly detected.


ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver

ehci-pci: EHCI PCI platform driver

usbcore: registered new interface driver usb-storage

ULPI transceiver vendor/product ID 0x0424/0x0007

Found SMSC USB3320 ULPI transceiver.

ULPI integrity check: passed.


 

 

After logging in, I follow the instructions under "Testing -> Device Mode -> Mass storage Gadget" to try to configure the USB as a USB peripheral mass storage device. I get the following:


petalinux-7814-10g login: root

Password:

login[892]: root login on 'ttyPS0'

root@petalinux-7814-10g:~# cd /lib/modules/4.0.0-xilinx/kernel/fs/configfs/

root@petalinux-7814-10g:/lib/modules/4.0.0-xilinx/kernel/fs/configfs# insmod configfs.ko

root@petalinux-7814-10g:/lib/modules/4.0.0-xilinx/kernel/fs/configfs# cd ../../drivers/usb/gadget/

root@petalinux-7814-10g:/lib/modules/4.0.0-xilinx/kernel/drivers/usb/gadget# insmod libcomposite.ko

root@petalinux-7814-10g:/lib/modules/4.0.0-xilinx/kernel/drivers/usb/gadget# cd function/

root@petalinux-7814-10g:/lib/modules/4.0.0-xilinx/kernel/drivers/usb/gadget/function# insmod usb_f_mass_storage.ko

root@petalinux-7814-10g:/lib/modules/4.0.0-xilinx/kernel/drivers/usb/gadget/function# dd if=/dev/zero of=/tmp/mydev count=10 bs=1M

10+0 records in

10+0 records out

root@petalinux-7814-10g:/lib/modules/4.0.0-xilinx/kernel/drivers/usb/gadget/function# mount -t configfs none /sys/kernel/config

root@petalinux-7814-10g:/lib/modules/4.0.0-xilinx/kernel/drivers/usb/gadget/function# cd /sys/kernel/config/usb_gadget

root@petalinux-7814-10g:/sys/kernel/config/usb_gadget# mkdir g1

root@petalinux-7814-10g:/sys/kernel/config/usb_gadget# echo "64" > bMaxPacketSize0

-sh: can't create bMaxPacketSize0: Permission denied

root@petalinux-7814-10g:/sys/kernel/config/usb_gadget# echo "0x200" > bcdUSB

-sh: can't create bcdUSB: Permission denied

root@petalinux-7814-10g:/sys/kernel/config/usb_gadget# echo "0x100" > bcdDevice

-sh: can't create bcdDevice: Permission denied

root@petalinux-7814-10g:/sys/kernel/config/usb_gadget# echo "0x03FD" > idVendor

-sh: can't create idVendor: Permission denied

root@petalinux-7814-10g:/sys/kernel/config/usb_gadget# echo "0x0500" > idProduct

-sh: can't create idProduct: Permission denied

root@petalinux-7814-10g:/sys/kernel/config/usb_gadget# mkdir functions/mass_storage.ms0

mkdir: can't create directory 'functions/mass_storage.ms0': No such file or directory

root@petalinux-7814-10g:/sys/kernel/config/usb_gadget# mkdir configs/c1.1

mkdir: can't create directory 'configs/c1.1': No such file or directory

root@petalinux-7814-10g:/sys/kernel/config/usb_gadget# echo /tmp/mydev > functions/mass_storage.ms0/lun.0/file

-sh: can't create functions/mass_storage.ms0/lun.0/file: nonexistent directory

root@petalinux-7814-10g:/sys/kernel/config/usb_gadget# echo 1 > functions/mass_storage.ms0/lun.0/removable

-sh: can't create functions/mass_storage.ms0/lun.0/removable: nonexistent directory

root@petalinux-7814-10g:/sys/kernel/config/usb_gadget# ln -s functions/mass_storage.ms0 configs/c1.1/

ln: configs/c1.1/: No such file or directory

root@petalinux-7814-10g:/sys/kernel/config/usb_gadget# echo "ci_hdrc.0" > UDC

-sh: can't create UDC: Permission denied


 

 

To try to debug, I tried to build a PetaLinux 2015.4 image.ub using the ZC702 BSP downloaded from http://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/embedded-design-tools/2015-4.html. The default BSP config met the requirements specified in http://www.wiki.xilinx.com/Zynq+Linux+USB+Device+Driver. When I built image.ub, and ran on my ZC702 eval board, the kernel hangs after displaying at “zynq-ocm f800c000.ocmc: ZYNQ OCM pool: 256 KiB @ 0xf0080000”. The image.ub that came with the eval board did not have the usb_f_mass_storage.ko module.

 

I would like to run the USB mass storage device on either my custom board or the ZC702, and have it be able to be recognized as a USB mass storage device on my PC.

 

Does anyone know what I am doing wrong?

 

Does anyone have a ZC702 image.ub that can run the USB mass storage device?

 

Is there an PetaLinux 2015.4 image.ub I can use on my ZC702 that will run the USB mass storage device

 

0 Kudos
Reply
1 Solution

Accepted Solutions
Explorer
Explorer
2,341 Views
Registered: ‎07-05-2017

After

root@petalinux-7814-10g:/sys/kernel/config/usb_gadget# mkdir g1

you need to :

root@petalinux-7814-10g:/sys/kernel/config/usb_gadget# cd g1

root@petalinux-7814-10g:/sys/kernel/config/usb_gadget/g1#

 

Then Continue ...

View solution in original post

0 Kudos
Reply
3 Replies
Adventurer
Adventurer
6,007 Views
Registered: ‎04-22-2016

Did you find an answer to your problem eventually?

0 Kudos
Reply
5,997 Views
Registered: ‎01-26-2016

There were a lot of typos in the Xilinx supplied documentation. I fed back a list of those typos. I have not checked to see if the docs have been updated.

0 Kudos
Reply
Explorer
Explorer
2,342 Views
Registered: ‎07-05-2017

After

root@petalinux-7814-10g:/sys/kernel/config/usb_gadget# mkdir g1

you need to :

root@petalinux-7814-10g:/sys/kernel/config/usb_gadget# cd g1

root@petalinux-7814-10g:/sys/kernel/config/usb_gadget/g1#

 

Then Continue ...

View solution in original post

0 Kudos
Reply