lmore3
Posts: 11
Joined: Tue Dec 22, 2015 6:38 am

Raspberry Pi zero USB gadget not working

Fri Jan 11, 2019 9:05 pm

I'm trying to use the pi zero w as a USB ethernet gadget but it's not working at all. If I leave out the SD card it shows the bootloader on my computer and I can use usbboot https://github.com/raspberrypi/usbboot but that's the only thing that works. I also tried plugging a keyboard in and that works.

User avatar
HawaiianPi
Posts: 3418
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Raspberry Pi zero USB gadget not working

Sat Jan 12, 2019 11:16 am

I have a pre-configured Raspbian Lite USB Gadget mode image you could try, just to make sure it works on your Pi Zero.

2018-11-13-raspbian-stretch-lite-Pi0USB.zip
SHA256 = 32ca25d28122cea2fd40d3f8d8c0e0ac2efd88fb5f569d0976828f42a604c2ed

It's the default Raspbian Stretch Lite image with Pi0(W) USB Ethernet Gadget mode pre-configured (config/cmdline .txt files modified and "ssh" file added with no other changes). Just write it you your SD card with Etcher and DO NOT modify anything (just burn-n-boot).
  1. Put the card in your Pi0 or Pi0W
  2. Connect a normal micro USB data cable to the USB data port of the Pi0 (the one closest to the HDMI)
  3. Do not connect anything to the power port (the one closest to the outer edge)
  4. Connect the other end of the micro USB cable to your main PC and the Pi0 should start to boot
It should boot up in USB Ethernet Gadget mode.
Note that the first boot can take awhile, so give it a couple of minutes before you try to SSH in.

If it doesn't work, verfiy the SHA256 hash sum of the download, and check Device Manager to see what driver (if any) was installed.

If you don't see this USB Ethernet/RNDIS Gadget driver,
Image
then something is wrong with your Windows system (it's installing the wrong driver), and you can try this driver (all the details match the driver installed in my Win10 system). Other hardware - Acer USB Ethernet/RNDIS Gadget

If you DO see that driver but it has a problem, right click on it and uninstall it, then click on scan for hardware changes in the Action menu. If that doesn't fix it you can try the driver linked above.

If the driver appears to be working, but you can't SSH into [email protected] then Zeroconf/mDNS is not working on your system (install Apple's Bonjour Printer service).

This image was tested and confirmed working on my Windows 10 notebook with my Pi0W.

The difinitive guide to USB Gadget mode can be found here: https://blog.gbaman.info/?p=791
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

lmore3
Posts: 11
Joined: Tue Dec 22, 2015 6:38 am

Re: Raspberry Pi zero USB gadget not working

Sun Jan 13, 2019 10:24 pm

I flashed the image and it booted fine but it still didn't work. I uploaded dmesg here https://pastebin.com/6t7i3Rqx

User avatar
thagrol
Posts: 1281
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Raspberry Pi zero USB gadget not working

Mon Jan 14, 2019 5:20 pm

lmore3 wrote:
Sun Jan 13, 2019 10:24 pm
I flashed the image and it booted fine but it still didn't work. I uploaded dmesg here https://pastebin.com/6t7i3Rqx
Is that dmesg fromn the zero or the USB host?

If it's from the zero, exactly what do you have connected and to which ports? At a guess, do you have a Dell USB keyboard connected to the inner microUSB port and the USB host to the outer one?

If this is the case, it isn't going to work. Despite there being two microUSB sockets, there is only one port on the SoC and the outer most socket is power only. For USB gadget to work, you must connect the host directly to the inner port without an otg adapter.
Note to self: don't feed the trolls

If I've asked you a question, please answer it. I'm unlikely to be able to help without that information.

lmore3
Posts: 11
Joined: Tue Dec 22, 2015 6:38 am

Re: Raspberry Pi zero USB gadget not working

Wed Jan 16, 2019 8:37 am

It's from the pi. I plugged it into my laptop at first but after it completely booted I connected a keyboard by plugging a battery bank in the other port, unplugging it from my computer, and plugging in a keyboard so I can get the log. I already knew about only one port being able to transfer data.

User avatar
HawaiianPi
Posts: 3418
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Raspberry Pi zero USB gadget not working

Thu Jan 17, 2019 11:44 am

lmore3 wrote:
Sun Jan 13, 2019 10:24 pm
I flashed the image and it booted fine but it still didn't work. I uploaded dmesg here https://pastebin.com/6t7i3Rqx
What, exactly, didn't work?

Did the correct network adapter get installed on your PC (USB Ethernet/RNDIS Gadget)?
  • If the answer is no, then nothing you do to the Pi Zero matters, because the problem is your PC.
  • If your PC runs Windows, see my earlier post for a driver link.
If the network adapter is correctly installing, then what else is wrong?

You really need to give us more details. You basically came here and told us something we know works, doesn't work, with literally no information about your setup, procedures, or specifics about the problem you're having. That image of mine has been tested on a Pi Zero v1.3 and a Pi Zero W on a couple of different Windows 10 computers (it works).
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

User avatar
thagrol
Posts: 1281
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Raspberry Pi zero USB gadget not working

Thu Jan 17, 2019 7:52 pm

As HawaiianPi has said, we need much more information before we can offer more help.

I have no reason to believe that his image isn't solid. I, and others, have had sucess running a variety of USB gadgets on raspbian with hosts running linux, windows, and Mac OS.

This stuff works.

So...
  • What OS is your USB host running?
  • From the zero:
    • Post your /boot/config.txt
    • Post your /boot/cmdline.txt
    • Post the output of

      Code: Select all

      lsusb
    • Post the output of

      Code: Select all

      ifconfig -a
    You can get those last two without swaping to a keyboard via the serial console (if you have the hardware) or by calling a suitable script from cron or /etc/rc.local
  • If the USB host is running windows
    • Post the relevant part of Device manager with the zero connected and booted.
    • Examine Event Viewer for anything relevant
    • Under Control Panel > Network and Internet > Network Connections
      do you see an ethernet device for the zero?
    • If so, post the output of a right click then "Status" and then of the "details" button.
  • If your USB host is running linux,
    • post the output of dmesg on that with the zero connected
    • Post the output of

      Code: Select all

      lsusb
    • Post the output of

      Code: Select all

      ifconfig -a
The linux commands above must be preformed on the USB host to be useful and may need to be prefixed with sudo.

If your host is a Mac, youll need work out the equivalent commnds yourself.

My next guess, based on your use of a know good configuration (HawaiianPi's image) is that either the USB host has failed to install a driver or that it has done so but the the network interfaces on one, or both, ends are not correctly configured. However, this is a guess. Without more info from you we can't do other than guess.

Oh, and the most usefull tool I've come across when debugging USB gadget mode issues is a serial conenction. Directly to another Pi or via a USB to 3.3v TTL dongle.
Note to self: don't feed the trolls

If I've asked you a question, please answer it. I'm unlikely to be able to help without that information.

User avatar
HawaiianPi
Posts: 3418
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: Raspberry Pi zero USB gadget not working

Thu Jan 17, 2019 11:54 pm

thagrol wrote:
Thu Jan 17, 2019 7:52 pm
Oh, and the most usefull tool I've come across when debugging USB gadget mode issues is a serial conenction. Directly to another Pi or via a USB to 3.3v TTL dongle.
Yup, those are handy little gadgets. I use CP2102 USB-TTL (3V3) adapters I get from eBay for less than $2. When connected to another computer you can watch the boot process in a serial terminal and see what's going on (or going wrong) and then login to troubleshoot.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

Return to “Troubleshooting”