element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Avnet Boards Forums
  • Products
  • Dev Tools
  • Avnet Boards Community
  • Avnet Boards Forums
  • More
  • Cancel
Avnet Boards Forums
Ultra96 Hardware Design Ultra96 V2 USB OTG/Device port
  • Forum
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Avnet Boards Forums to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 8 replies
  • Subscribers 331 subscribers
  • Views 1688 views
  • Users 0 members are here
  • ultra96
Related

Ultra96 V2 USB OTG/Device port

anven
anven over 5 years ago

I am trying to connect Ultra96 to a PC through the USB OTG port (J7 - mini a/b) using the RnDIS driver... however the usb port seems unresponsive. It does not enumerate on either my Windows or Linux PC. Is there anything that needs to be done to enable that port as a device?

 

Thank you

  • Sign in to reply
  • Cancel

Top Replies

  • narrucmot
    narrucmot over 5 years ago in reply to anven +1
    Thank you for sharing your success! Like you, I would have expected this to work out of the box, too. I knew it worked the Pynq image, but did not know this script was required. Perhaps this enhancement…
  • narrucmot
    narrucmot over 5 years ago

    Hi Anton,

     

    It sounds like you might be missing the g_ether RNDIS USB Gadget Ethernet driver in your kernel.  Are you using PetaLinux?  You might want to try using a known-good PetaLinux BSP for the Ultra96-V2Ultra96-V2 that has has USB gadget Ethernet enabled.

    https://www.element14.com/community/community/designcenter/zedboardcommunity/ultra96/?showTab=2

     

    This Xilinx forums post provides more detail of what is needed to enable USB gadget Ethernet:

    https://forums.xilinx.com/t5/Embedded-Linux/High-speed-RNDIS-on-ULTRA96/td-p/1050372

     

     

    --Tom

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • anven
    anven over 5 years ago in reply to narrucmot

    Thanks Tom,

    I am using petalinux and the 2019.2 BSP and I thought I added all the USB Gadgets and RNDIS options under the kernel configurator... Obviously I must have missed something.

    I know the Pynq image works and enumerates to 192.168.3.1 seamlessly... now I just need to get my own build to do the same (I have some PL gpio tweaks that need to be baked in).

     

    This may be a noobie question, but Is there a way to compare the kernel settings file between pynq for example and my custom one? Pynq is ubuntu based I think, but likely petalinux was still involved in kernel configuration...

     

     

    Anton

     

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • narrucmot
    narrucmot over 5 years ago in reply to anven

    Pynq uses a Ubuntu root filesystem and a kernel built with PetaLinux.  If you have built Pynq from scratch and have the PetaLinux project for it you may be able to compare kernel configurations to determine what is missing/needed in your own PetaLinux project.

     

    --Tom

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • anven
    anven over 5 years ago in reply to narrucmot

    I am more confused now - I do see a usb_gadget under /sys/kernel/config/usb_gadget.... (in my build).. I would have expected it to be there if configfs option was selected in configurator... but it was not

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • anven
    anven over 5 years ago

    I got it to work - the secret was in the usb gadget driver configuration. I was under impression that it should work out of the box, as long as the kernel rndis module was selected, but I guess the below sequence is also required. This was copied from the PYNQ project:

     

    #!/bin/bash
    # Script Adapted from http://irq5.io/2016/12/22/raspberry-pi-zero-as-multiple-usb-gadgets/
    cd /sys/kernel/config/usb_gadget/
    mkdir -p g
    cd g
    echo 0x1d6b > idVendor  # Linux Foundation
    echo 0x0104 > idProduct # Multifunction Composite Gadget
    echo 0x0100 > bcdDevice # v1.0.0
    echo 0x0200 > bcdUSB  # USB 2.0
    echo 0xEF > bDeviceClass
    echo 0x02 > bDeviceSubClass
    echo 0x01 > bDeviceProtocol
    mkdir -p strings/0x409
    echo "0000" > strings/0x409/serialnumber
    echo "Xilinx Inc."   > strings/0x409/manufacturer
    echo "PYNQ-USB"   > strings/0x409/product
    echo 1  > os_desc/use
    echo 0xcd  > os_desc/b_vendor_code
    echo MSFT100 > os_desc/qw_sign
    mkdir -p functions/acm.usb0  # serial
    mkdir -p functions/rndis.usb0  # network
    mkdir -p functions/mass_storage.ms0
    echo RNDIS  > functions/rndis.usb0/os_desc/interface.rndis/compatible_id
    echo 5162001 > functions/rndis.usb0/os_desc/interface.rndis/sub_compatible_id
    echo /usr/local/share/fatfs > functions/mass_storage.ms0/lun.0/file
    echo 1 > functions/mass_storage.ms0/lun.0/removable
    mkdir -p configs/c.1
    echo 250 > configs/c.1/MaxPower
    if [ ! -e os_desc/c.1 ]; then
    ln -s configs/c.1 os_desc/
    fi
    if [ ! -e configs/c.1/rndis.usb0 ]; then
    ln -s functions/rndis.usb0 configs/c.1/
    fi
    if [ ! -e configs/c.1/acm.usb0 ]; then
    ln -s functions/acm.usb0 configs/c.1/
    fi
    if [ ! -e configs/c.1/mass_storage.ms0 ]; then
    ln -s functions/mass_storage.ms0 configs/c.1/
    fi
    udevadm settle -t 5 || :
    ls /sys/class/udc/ > UDC
    echo "" > /sys/kernel/config/usb_gadget/g/UDC
    ls /sys/class/udc/ > UDC
    ifconfig usb0 192.168.3.1

     

    Once executed, Windows 10 detected the RNDIS device

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • narrucmot
    narrucmot over 5 years ago in reply to anven

    Thank you for sharing your success!  Like you, I would have expected this to work out of the box, too.  I knew it worked the Pynq image, but did not know this script was required.  Perhaps this enhancement can be built into a future Ultra96-V2 PetaLinux BSP release.

     

    Cheers,

    Tom

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • narrucmot
    narrucmot over 5 years ago in reply to anven

    When I run this script on my Ultra96-V2 I get an error at the line "echo /usr/local/share/fatfs > functions/mass_storage.ms0/lun.0/file".

     

    mass_storage.ms0/lun.0: unable to open backing file: /usr/local/share/fatfs

    ./usb_gadget_ethernet.sh: line 25: echo: write error: No such file or directory

     

    Is there a fix or workaround for this?  I don't believe it is required for using the USB as an Ethernet device.  I believe this is needed to use the USB as mass storage.

     

    --Tom

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • anven
    anven over 5 years ago in reply to narrucmot

    Ah, yes - i did comment out All the Mass storage references in my version of the script. One above is verbatum from pynq.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube