V19.07 Raspberry Pi Zero W Ethernet over USB[OTG] Not Working

I have spent a number of hours following various guides on setting up OpenWrt on a RPi Zero W with Ethernet over USB. I have no problem with OpenWrt running on the RPi nor the WiFi, but I can't get the USB Ethernet working. It doesn't show up in any way on my laptop when I plug the RPi into my laptop nor as an interface in OpenWrt. However, I know that my laptop setup and all hardware is good because I am able to get it working using Raspbian.

This is the tutorial that got me started on the idea and the setup is ultimately what I want, but I want to use the latest OpenWrt 19.07. I tried using the LEDE image linked in the README and everything worked as expected.

With OpenWrt 19.07, I tried installing the kmod-usb-dwc2 and kmod-usb-gadget-eth packages and adding dtoverlay=dwc2 to /boot/config.txt but there was no connection when plugged into my laptop and no interface showed up in OpenWrt (with ifconfig). I started messing around and searching online trying various other things. I tried the kmod-usb-core kmod-usb-net kmod-usb-net-asix kmod-usb-net-asix-ax88179 kmod-usb-net and kmod-usb-net-cdc-ether packages which also didn't seem to help. No interface shows up in OpenWrt under ifconfig and nothing shows up on my laptop.

Eventually, after trying everything I could think of, I resorted to building a snapshot image as advised here on the OpenWrt Raspberry Pi page. It states in the 'How to use USB-Ethernet with Raspberry Pi Zero' section that system does not support USB OTG by default so you need to compile your own brcm2708-brcm2708 image with the kmod-usb-net, kmod-usb-net-asix, and asix-ax88179 kernel modules.

So I followed the instructions here to build an image on the openwrt-19.07 branch. After successfully creating the image, with the added kernel modules I still was not able to get any results. I've tried adding all kernel modules under USB Support in MenuConfig but still no results.

My next test is building the 18.06 and 17.01 releases and see if that makes any difference and perhaps trying to figure out why.

Please help!
What am I missing/need to change/fix to get Ethernet over USB working with my Pi Zero??

Updates:

  • I have confirmed that everything works correctly when using LEDE/OpenWrt v17.01.6
  • I have confirmed Ethernet over USB works in the Raspbian lite OS using the gadget driver (same drive as used on OpenWrt)
  • I have confirmed that OpenWrt v18.06.8 and v18.06.0 don't work and presumably has the same problem as v19
  • Here is a comparison of the dmesg output from LEDE (left side) and OpenWrt v18.06.0 (right side)

Note, my laptop is running Manjaro.

Some of the sources I've used to try to get it working are are follows:
http://blog.gbaman.info/?p=699
https://forum.openwrt.org/t/solved-adding-a-secondary-card/11071/8
https://superuser.com/questions/1512182/rndis-connection-with-rpi-0
http://shallowsky.com/blog/linux/raspberry-pi-ethernet-gadget.html
https://openwrt.org/toh/raspberry_pi_foundation/raspberry_pi

1 Like

This is for usb connected nic's... not for OTG...

If I were you... i'd repeat that so you are 100% then also set it up in raspbian for which there are a few guides... then you'll have a solid foundation to troubleshoot the 19.x issues from.

Thanks for the advise. I've updated my post with my findings so far. However, I'm unsure how to proceed further.

1 Like
  • The dmesg will likely be very useful as is confirming it does work on that alternate 17 rom
  • To report a bug, you'd either have to confirm non-third party 17(works) or master works or not ( bug has been fixed and not backported )
  • You could also touch base with the person who made the working 17 rom to confirm if any core changes were made to the source
  • or find the "add support" commit message for the zero and see if it mentions OTG support
  • I have confirmed it does work as expected in OpenWrt v17.01.6 specified in my main post.
  • I have also just confirmed that compiling off OpenWrt master does not work as expected. Same with v19.07.2, v18.06.0, and v18.06.8 (downloaded releases from OpenWrt website).
  • I'm not sure if this is helpful/relavent but I've found that there are a couple of dwc/otg patch files under target/linux/brcm2708/patches-4.4 on the v17.01.6 source code that is not in the target/linux/brcm2708/patches-4.9 folder on tag v18.06.0.
  • For additional clarification, the working LEDE version is an official version released as OpenWrt v17.01.6, not a third party version.
1 Like

ok cool... i thought you said that you'd only used a rom from another site.

The OpenWrt image linked to in the tutorial is an official release (v17.01.4) which also works.

Is there anything else I can try to isolate the issue?

I tested v17.01.0 and it seems like it doesn't work in this version (but it works in v17.01.1 as well as the other versions I've listed previously). However, I say 'seems' because the wireless doesn't work either in this version. In order to continue my test of the dwc2 and gadget drivers I downloaded them and installed them manually offline. So unless there's a connection between the wireless not working and the USB Ethernet stuff I don't know/understand, it doesn't work in v17.01.0.
I did confirm it works in v17.01.1.

How would I go about reporting this as a bug?

reporting bugs

make sure you add a link to this thread... the dmesg comparison is particularly useful... also if relavent;

  • bootcode/firmware version/s
  • config.txt / distroconfig.txt ( enabled lines )
  • details of the other device used to test with

i'd help test more... but I only have a rpi4... and the hardware is too dissimilar for lower level comparisons? + i've yet to get my head around ( or buy cables for ) injecting enough mA whilst using the OTG ( usb-C power ) port.

more people with that device using that feature would expedite your issue considerably. worst case scenario, downgrade is an option depending on the security needed and attention to remove known security issues with said releases. ( if i were you i'd just run raspbian until sorted )

Hmm, I didn't know that the Pi 4's USB-C port doubled as OTG capable. I have a Pi 4 and I've yet to see if the issue exists on the Pi 3/Pi 4. So today I built src code off master (adding the kmod-usb-dwc2 and kmod-usb-gadget-eth packages) and tried the image on the Pi 4. As far as I can tell, the USB Ethernet does not work on the Pi 4, however, it seems like there are other issues with the Pi 4 such as the wireless not working (though I didn't try anything to get it to work since my focus was with the USB Ethernet).

I'm not sure about the hardware being too dissimilar or not, but being that it doesn't seem to work on the Pi 4 either, they may be similar enough that fixing one resolves the problem. I suppose trying a Pi 3 or something would help confirm this since the Pi 4 isn't supported in an official version of OpenWrt yet.

Also, assuming you have a USB-C data cable (such as one you'd use for your phone), I simply plugged my Pi 4 into my computer to both power it and test the OTG and it seemed to work fine from a power standpoint. If you still need more power I'd suggest getting a USB-C hub with a barrel power plug on the side. I use one of these (but microUSB) to provide additional power to the USB powers on the hub for my Pi Zero. Although, I was reading today that the Pi 4's USB-C OTG port can only operate as a slave, so using a USB hub probably won't work in that sense.

If you'd be able to help/walk me through fixing the problem, I'd be willing to send you a Pi zero, USB-hub, and mini HDMI to HDMI adapter (and assume that you have an hdmi cable and micro USB charger and potentially a wireless keyboard since the Pi zero can't supply much power). I'm interested to learn how to debug and fix this sort of thing.

always good when people are committed to resolving things :alien:

checking the dmesg again... ;

Init: Port Power? op_state=1
Init: Power Port (0)

possibly suspect... the otg.patch's breaking my wc -l ( very complex )

pi4 host mode tidbits

I got Pi Zero USB OTG working with OpenWrt 19.07.4

The hang up I found was getting the g_ether module to load which creates the 'usb0' interface. On the normal Raspi OS I believe it's triggered in the cmdline.txt in the boot partition, but that didn't work in openwrt so I had to load it manually after boot.

'modprobe g_ether' should load it, and
'modinfo g_ether' should confirm it loaded.
After that you can create a interface that uses 'usb0'

Later added a link in modules.d so it loads each boot.
'echo g_ether > /etc/modules.d/56-g_ether'

For reference I partially used this guide to get the Pi Zero initially setup.

1 Like

can you backup the /etc and /boot ?

Hi @tweak42 can you please help me with the steps to get the USB OTG Ethernet working for Pi 0 W after a fresh install of OpenWRT 23.05.2