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!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor mahe.blue
Visitor
1,559 Views
Registered: ‎01-31-2018

Petalinux 2016.4 USB failed

In our project we use Zynq 7000 (XC7Z010) in our custom module with Petalinux kernel version 4.6.0. The zynq module has been used as a USB peripheral (Slave) device. In system-top.dts, USB device tree node property “dr_mode” changed as “peripheral” which controls the mode of the device driver.

 

Kernel configuration:  http://www.wiki.xilinx.com/Zynq+Linux+USB+Device+Driver

 

Logs:

 

# dmesg | grep -i USB

usbcore: registered new interface driver usbfs

usbcore: registered new interface driver hub

usbcore: registered new device driver usb

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

usbcore: registered new interface driver usbhid

usbhid: USB HID core driver

gadgetfs: USB Gadget filesystem, version 24 Aug 2004

 

# lsusb

unable to initialize libusb: -99

 

# lsmod

Not tainted

usb_f_mass_storage 30347 2 - Live 0xbf025000

libcomposite 34188 6 usb_f_mass_storage, Live 0xbf014000

configfs 22169 3 usb_f_mass_storage,libcomposite, Live 0xbf008000

gadgetfs 15217 0 - Live 0xbf000000

 

Directory /sys/class/udc is empty

so i could not attach the gadget to the UDC driver

> udc-core: couldn't find an available UDC - added [g1] to list of pending drivers

 

Though I have enabled ChipIdea device controller as mentioned in Xilinx wiki.

Under  /sys/class/udc  I see no available udc drivers. The expected ci_hdrc.0 doesn't show up.

 

Any technical suggestions would be appreciated.

0 Kudos
5 Replies
Xilinx Employee
Xilinx Employee
1,513 Views
Registered: ‎02-07-2018

Re: Petalinux 2016.4 USB failed

Looks that might be order of inserting modules matter,

 

I am adding the steps below , you can follow it even this is different petalinux version but should work.

Can you please try to insert modules as mentioned below:

cd lib/modules/4.9.0-xilinx-v2017.3/
cd kernel/fs/configfs/
modprobe configfs.ko

cd ../..
cd drivers/usb/gadget
modprobe libcomposite.ko

cd function/
insmod usb_f_mass_storage.ko

cd ../legacy/

insmod gadgetfs.ko

dd if=/dev/zero of=/tmp/mydev count=256 bs=1M
insmod g_mass_storage.ko file=/tmp/mydev removable=1

 

After this step connect the USB male to male cable between target USB port and host USB port, it will detect as a USB drive.

and Make sure change the jumper settings as per peripheral mode.

 

In case if you still face issues let me know, i will try my end and update you. 

 

Thanks & Regards

Aravind

 

 

0 Kudos
Visitor mahe.blue
Visitor
1,502 Views
Registered: ‎01-31-2018

Re: Petalinux 2016.4 USB failed

Thanks for your reply.

I have issue with UDC as i have mentioned earlier.

 

# insmod g_mass_storage.ko file=/tmp/mydev removable=1
udc-core: couldn't find an available UDC - added [g_mass_storage] to list of pending drivers

 

>> Though I have enabled ChipIdea device controller as mentioned in Xilinx wiki.

>> Under  /sys/class/udc  I see no available udc drivers. The expected ci_hdrc.0 doesn't show up.

 

Any suggestions/tips are welcome.

0 Kudos
Adventurer
Adventurer
1,487 Views
Registered: ‎06-13-2017

Re: Petalinux 2016.4 USB failed

I cannot understand why people are still using those multiple commands like 'insmod' and others. At least for Microzed this is totally useless because if you properly update device tree the USB memory sticks are detected and mounted automatically.

0 Kudos
Xilinx Employee
Xilinx Employee
1,464 Views
Registered: ‎02-07-2018

Re: Petalinux 2016.4 USB failed

HI,

I just enabled extra Config options along with default config & I inserted modules in mentioned order, and its working fine. I have verified on zc702 board.
I have attached the config options for your reference what to enable & in device tree you should add dr_mode="peripheral" in usb node like shown in attachment.

 

"> udc-core: couldn't find an available UDC - added [g1] to list of pending drivers" --> The reason for this issue is, you   are providing "dr_mode=host", in device tree ,then only you will get this error , this  already verified now before commenting.

 

root@xilinx-zc702-2017_3:/lib/modules/4.9.0-xilinx-v2017.3/kernel/drivers/usb/gadget# ls
function         legacy           libcomposite.ko
root@xilinx-zc702-2017_3:/lib/modules/4.9.0-xilinx-v2017.3/kernel/drivers/usb/gadget# modprobe libcomposite.ko
root@xilinx-zc702-2017_3:/lib/modules/4.9.0-xilinx-v2017.3/kernel/drivers/usb/gadget/function# insmod usb_f_mass_storage.ko
root@xilinx-zc702-2017_3:/lib/modules/4.9.0-xilinx-v2017.3/kernel/drivers/usb/gadget/function# cd ../legacy/
root@xilinx-zc702-2017_3:/lib/modules/4.9.0-xilinx-v2017.3/kernel/drivers/usb/gadget/legacy# ls
g_mass_storage.ko  g_zero.ko          gadgetfs.ko
root@xilinx-zc702-2017_3:/lib/modules/4.9.0-xilinx-v2017.3/kernel/drivers/usb/gadget/legacy# insmod gadgetfs.ko
gadgetfs: USB Gadget filesystem, version 24 Aug 2004
root@xilinx-zc702-2017_3:/lib/modules/4.9.0-xilinx-v2017.3/kernel/drivers/usb/gadget/legacy# dd if=/dev/zero of=/tmp/mydev count=256 bs=1M
256+0 records in
256+0 records out
root@xilinx-zc702-2017_3:/lib/modules/4.9.0-xilinx-v2017.3/kernel/drivers/usb/gadget/legacy# ls
g_mass_storage.ko  g_zero.ko          gadgetfs.ko
root@xilinx-zc702-2017_3:/lib/modules/4.9.0-xilinx-v2017.3/kernel/drivers/usb/gadget/legacy# insmod g_mass_storage.ko file=/tmp/mydev removable=1
Mass Storage Function, version: 2009/09/11
LUN: removable file: (no medium)
LUN: removable file: /var/volatile/tmp/mydev
Number of LUNs=1
g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
g_mass_storage gadget: userspace failed to provide iSerialNumber
g_mass_storage gadget: g_mass_storage ready
root@xilinx-zc702-2017_3:/lib/modules/4.9.0-xilinx-v2017.3/kernel/drivers/usb/gadget/legacy# g_mass_storage gadget: high-speed config #1: Linux File-Backed Storage
g_mass_storage gadget: high-speed config #1: Linux File-Backed Storage

root@xilinx-zc702-2017_3:/lib/modules/4.9.0-xilinx-v2017.3/kernel/drivers/usb/gadget/legacy#

 

 Thanks & regards

  Aravind

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------

0 Kudos
Visitor m28
Visitor
619 Views
Registered: ‎06-26-2018

Re: Petalinux 2016.4 USB failed

Hi,

I have issue with UDC

I inserted modules in the mentioned order but When I tried to insert g_mass_storage.ko,still this issue is there

udc-core: couldn't find an available UDC - added [g_mass_storage] to list of pending drivers

ci_hdrc.0 is not found under /sys/class/udc.

I'm using petalinux 2017.2 and PS is Z-7014S. config options are same as you have specified in the usb_config_enable.txt file, dr_mode =  "peripheral" in the device tree and 'Userspace-driven configuration filesystem' is

File systems  --->  

Pseudo filesystems  --->
 -*- Userspace-driven configuration filesystem
I can not change it to "*" or "M".

Any suggestions would be appreciated.

Tags (5)