Hi! Sorry if the formatting of this post is odd - it's my first time posting to the forum.
Currently, I am trying to use a Raspberry Pi Zero W as an Ethernet gadget, using the dwc2 overlay.
However, no matter the operating system, the USB gadget is not recognised by the operating system at all, regardless of the USB cable that is used (all transfer data + power, rather than just power).
I have tested Arch Linux, Xubuntu 18.04.1 LTS, Windows 7, Windows 10 (both Windows versions come with / download the driver for the gadget automatically), and Mac OS (which I have very little experience with, but appeared to not use the Ethernet gadget). Previous versions of Raspbian (I tested 2017-06-21-raspbian-lite), worked as expected, and was detected as an Ethernet gadget, along with an attempt to make a network connection with the host computer. All images in the current 2018-* do not work.
Therefore, I believe that there is something wrong with the 2018-* releases of Raspbian, however, I see no errors regarding USB OTG or the enabling of the g_ethernet driver - a host MAC and MAC address can be seen to be set, even though the host device (a laptop or desktop) cannot see the Raspberry Pi Zero W.
I have tested the USB port itself, using a Micro-USB -> full-size USB port. A keyboard via this adapter works as expected, and is detected as a keyboard.
Steps to reproduce:
1. Edit config.txt with the last line being dtoverlay=dwc2
2. Edit cmdline.txt, inserting a space-delimited line of modules-load=dwc2,g_ether after rootwait
3. (Optional) Connect the Pi to a HDMI-compatible monitor
4. Wait around 90s (or until the Pi has fully booted)
Alternatively, follow the steps provided in Andrew's blog:
https://blog.gbaman.info/?p=791
Expectation:
On Arch Linux/Xubuntu 18.04.1 LTS, I expect NetworkManager to detect a device, which would attempt to make a bad Ethernet connection. When using lsusb in a terminal on the host device, I would expect a new device to be added. When using dmesg in a terminal on the host device, I would expect it to contain information about the connection.
On Windows 7/10, I would expect the RNDIS driver to be installed, and to be able to use PuTTY to connect to the Raspberry Pi Zero via a local network connection.
I do not know what to expect on a Mac OS machine, but I would expect to see the same results as either the Windows 7/10 machine, or the Arch Linux/Xubuntu 18.04.1 LTS machine.
Please let me know if there is any information you would like me to provide. I don't have free access to either a Windows machine or a Mac OS machine, but I do have free access to an Arch Linux machine or Xubuntu 18.04.1 LTS LiveCD. And, sorry about the formatting! Any help would be greatly appreciated.
-
- Posts: 5
- Joined: Wed Aug 22, 2018 12:13 am
Raspberry Pi Zero W - Cannot use / connect to USB OTG Ethernet
Last edited by Charged_Neon on Wed Aug 22, 2018 7:42 am, edited 1 time in total.
Re: Raspberry Pi Zero W - Cannot use / connect to USB OTG Ethernet
In my experience, the problem is that unless/until you fix it, the usb0 device on the Zero won't have an IP address.
That is, if you can get to a shell prompt on the Zero and type:
you will see that it is "UP", but you won't see any (ipv4) IP address.
I have developed ways to fix this, but can you verify that to make sure that is the case before we proceed further?
P.S. There is, of course, also the usual question of whether or not sshd is running on the Zero. Others will no doubt chime in on that topic.
That is, if you can get to a shell prompt on the Zero and type:
Code: Select all
ifconfig usb0
I have developed ways to fix this, but can you verify that to make sure that is the case before we proceed further?
P.S. There is, of course, also the usual question of whether or not sshd is running on the Zero. Others will no doubt chime in on that topic.
"L'enfer, c'est les autres"
G fytc hsqr rum umpbq rm qyw rm rfc kmbq md rfgq dmpsk:
Epmu Sn!
J lnacjrw njbruh-carppnanm vxm rb mnuncrwp vh yxbcb!
G fytc hsqr rum umpbq rm qyw rm rfc kmbq md rfgq dmpsk:
Epmu Sn!
J lnacjrw njbruh-carppnanm vxm rb mnuncrwp vh yxbcb!
Re: Raspberry Pi Zero W - Cannot use / connect to USB OTG Ethernet
It is quite possible that the Pi 0 W is faulty, either a permanent short in the USB socket or a short under/within the SOC, causing the interface to be permanently in host mode. It will still work with keyboard/mouse attached but not as a gadget.Charged_Neon wrote: ↑Wed Aug 22, 2018 12:43 amHowever, no matter the operating system, the USB gadget is not recognised by the operating system at all, regardless of the USB cable that is used (all transfer data + power, rather than just power).
I have a Pi 0 that is like that and can not be used as a gadget anymore, this Pi 0 was working in gadget mode but suddenly for no apparent reason it stopped.
The road to insanity is paved with static ip addresses
-
- Posts: 5
- Joined: Wed Aug 22, 2018 12:13 am
Re: Raspberry Pi Zero W - Cannot use / connect to USB OTG Ethernet
n67, here is the output of
I can ascertain this, by giving the Pi Zero W a wpa_supplicant.conf entry, and connecting the middlemost USB port to the host PC. All services seem to be working as expected (including sshd).
Here is the output of dmesg
Emst, it is quite possible that it is faulty - I'm open to the notion. However, this doesn't explain why I can use an older version of Raspbian, make the same modifications as outlined, and get the expected result of a USB-connected Pi Zero W. The main issue, is that the host device cannot see any information about the USB device - the Pi Zero W doesn't appear in lsusb, nor dmesg, nor creates an interface on the host device.
Code: Select all
ifconfig usb0
Code: Select all
usb0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 3e:2d:f6:27:a4:69 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Here is the output of dmesg
Code: Select all
[ 3.959058] dwc2 20980000.usb: 20980000.usb supply vusb_d not found, using dummy regulator
[ 3.959213] dwc2 20980000.usb: 20980000.usb supply vusb_a not found, using dummy regulator
[ 4.413197] dwc2 20980000.usb: EPs: 8, dedicated fifos, 4080 entries in SPRAM
[ 4.454472] dwc2 20980000.usb: DWC OTG Controller
[ 4.454564] dwc2 20980000.usb: new USB bus registered, assigned bus number 1
[ 4.454655] dwc2 20980000.usb: irq 33, io mem 0x20980000
[ 4.455137] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[ 4.455152] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 4.455162] usb usb1: Product: DWC OTG Controller
[ 4.455171] usb usb1: Manufacturer: Linux 4.14.62+ dwc2_hsotg
[ 4.455178] usb usb1: SerialNumber: 20980000.usb
[ 4.456579] hub 1-0:1.0: USB hub found
[ 4.463074] hub 1-0:1.0: 1 port detected
[ 4.601079] using random self ethernet address
[ 4.601092] using random host ethernet address
[ 4.602528] usb0: HOST MAC <redacted>
[ 4.602656] usb0: MAC <redacted>
[ 4.602722] using random self ethernet address
[ 4.602733] using random host ethernet address
[ 4.603122] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[ 4.603135] g_ether gadget: g_ether ready
[ 4.603152] dwc2 20980000.usb: bound driver g_ether
Emst, it is quite possible that it is faulty - I'm open to the notion. However, this doesn't explain why I can use an older version of Raspbian, make the same modifications as outlined, and get the expected result of a USB-connected Pi Zero W. The main issue, is that the host device cannot see any information about the USB device - the Pi Zero W doesn't appear in lsusb, nor dmesg, nor creates an interface on the host device.
Re: Raspberry Pi Zero W - Cannot use / connect to USB OTG Ethernet
It works for me with raspbian lite from 2018-06-27 on a Pi 0 W connected to a PC with Windows 7 Professional.
The road to insanity is paved with static ip addresses
-
- Posts: 5
- Joined: Wed Aug 22, 2018 12:13 am
Re: Raspberry Pi Zero W - Cannot use / connect to USB OTG Ethernet
I can confirm that this occurs only with Stretch-based images.
This includes: 2017-08-16-raspbian-stretch-lite, 2017-09-07-raspbian-stretch-lite, 2017-11-29-raspbian-stretch-lite, 2018-03-13-raspbian-stretch-lite, 2018-04-18-raspbian-stretch-lite, 2018-06-27-raspbian-stretch-lite.
When connected to the Pi with the last Jessie release (2017-06-21-raspbian-jessie-lite), my Arch Linux laptop's NetworkManager attempts to make a connection.
When I check with lsusb, I see this device:
When I run dmesg, I see these messages:
Ignoring the errors - this connects, and I am able to SSH into the Rapsberry Pi using the Avahi mDNS name raspberrypi.local.
After trying all of the aforementioned images, I have reflashed the Pi with 2018-06-27-raspbian-stretch-lite, and followed Andrew's blog to the letter. This has not solved the problem.
Equally, plugging this into a Windows 10 device does not create a new network interface, nor does it appear in Device Manager.
Ernst, do you have the output of dmesg or lsusb on a Linux host? Do you have the output of dmesg on the Raspberry Pi Zero W?
This includes: 2017-08-16-raspbian-stretch-lite, 2017-09-07-raspbian-stretch-lite, 2017-11-29-raspbian-stretch-lite, 2018-03-13-raspbian-stretch-lite, 2018-04-18-raspbian-stretch-lite, 2018-06-27-raspbian-stretch-lite.
When connected to the Pi with the last Jessie release (2017-06-21-raspbian-jessie-lite), my Arch Linux laptop's NetworkManager attempts to make a connection.
When I check with lsusb, I see this device:
Code: Select all
Bus 001 Device 005: ID 0525:a4a2 Netchip Technology, Inc. Linux-USB Ethernet/RNDIS Gadget
Code: Select all
[ 612.013103] usb 1-1.2: new high-speed USB device number 5 using ehci-pci
[ 612.199015] cdc_subset: probe of 1-1.2:1.0 failed with error -22
[ 612.200145] cdc_subset 1-1.2:1.1 usb0: register 'cdc_subset' at usb-0000:00:1a.0-1.2, Linux Device, b6:bd:7a:89:90:0a
[ 612.200181] usbcore: registered new interface driver cdc_subset
[ 612.200421] cdc_ether: probe of 1-1.2:1.0 failed with error -16
[ 612.200442] usbcore: registered new interface driver cdc_ether
[ 612.209305] cdc_subset 1-1.2:1.1 enp0s26u1u2i1: renamed from usb0
[ 612.270984] IPv6: ADDRCONF(NETDEV_UP): enp0s26u1u2i1: link is not ready
[ 701.252152] nf_conntrack version 0.5.0 (65536 buckets, 262144 max)
After trying all of the aforementioned images, I have reflashed the Pi with 2018-06-27-raspbian-stretch-lite, and followed Andrew's blog to the letter. This has not solved the problem.
Equally, plugging this into a Windows 10 device does not create a new network interface, nor does it appear in Device Manager.
Ernst, do you have the output of dmesg or lsusb on a Linux host? Do you have the output of dmesg on the Raspberry Pi Zero W?
Re: Raspberry Pi Zero W - Cannot use / connect to USB OTG Ethernet
Did you have a look for in the device manager for a yellow exclamation mark ? Sometime things go funny and Windows does not recognize a device if a previous driver installation failed.Charged_Neon wrote: ↑Wed Aug 22, 2018 12:31 pmEqually, plugging this into a Windows 10 device does not create a new network interface, nor does it appear in Device Manager.
The road to insanity is paved with static ip addresses
-
- Posts: 5
- Joined: Wed Aug 22, 2018 12:13 am
Re: Raspberry Pi Zero W - Cannot use / connect to USB OTG Ethernet
There is nothing in the Device Manager with a yellow exclamation mark - typically Windows, if it can't find the driver, will download the correct one and use that instead. I know, as I used to use Windows much more frequently with a Raspberry Pi Zero (with camera connector) as a USB OTG device. To me, it is suggesting that Raspbian doesn't (for an unbeknownst reason) do any link negotiation, either as a USB device or as a network device.
Re: Raspberry Pi Zero W - Cannot use / connect to USB OTG Ethernet
Try putting:
in /etc/rc.local (and rebooting the Zero).
Yes, the last two octets in the above command can be whatever you like...
Code: Select all
ifconfig usb0 169.254.119.23
Yes, the last two octets in the above command can be whatever you like...
"L'enfer, c'est les autres"
G fytc hsqr rum umpbq rm qyw rm rfc kmbq md rfgq dmpsk:
Epmu Sn!
J lnacjrw njbruh-carppnanm vxm rb mnuncrwp vh yxbcb!
G fytc hsqr rum umpbq rm qyw rm rfc kmbq md rfgq dmpsk:
Epmu Sn!
J lnacjrw njbruh-carppnanm vxm rb mnuncrwp vh yxbcb!
-
- Posts: 5
- Joined: Wed Aug 22, 2018 12:13 am
Re: Raspberry Pi Zero W - Cannot use / connect to USB OTG Ethernet
Tried that, and still no luck. There are no USB devices detected on the host device via lsusb, NetworkManager doesn't show any new interfaces, and dmesg doesn't show any new USB devices.
The Pi definitely has the IP address ( 169.254.119.23 ) set, as the small bash script printing it out onto the screen shows the same IP address.
The Pi definitely has the IP address ( 169.254.119.23 ) set, as the small bash script printing it out onto the screen shows the same IP address.