I have a new RPi5 that I'd like to use in USB gadget mode, but none of the tutorials I have found work for me. I have a few RPi4s that I connect to regularly as USB gadgets but I'm struggling with this 5.
I have a new RPi 5, 8GB. I am using RPi Imager on my Mac to install 64-bit Bookworm with Desktop. I am booting to a 64GB USB3 flashdrive.
I can SSH into the Pi if I tether through my phone's WIFI and power it using an official RPi 27W power supply.
My MacBook Air USB-C ports can supply 35W and after editing config.txt with "usb_max_current_enable=1" as seen hereviewtopic.php?t=361206, I can power the Pi from my Macbook via USB-C/USB-C cable and SSH to it over my phone's WIFI.
The USB-C cable I'm using is the same one that I use to connect to my RPi4s.
On a fresh install, I followed this guide by thagrol viewtopic.php?t=364247 but the Pi was unresponsive as pi@pi.local or at IP 169.254.1.1.
I've not tested on a Mac. My Mac OS knowledge is limited.
We're going to need a lot more information in order to offer any assistance, and you're going to need a way into the Pi5 that doesn't invlove the gadget ethernet. My preference would be a serial connection making use of the official debug probe.
My initial gut feeling is that it's an issue with Network Manager on the Pi. In its defaut configuration it doesn't fall back to self assigned zeroconf IP v4 addresses so it's usb0 interface does not get configured or brought up. Don't bet on that though - the only evidence you've given to support it is that you're using RPiOS Bookworm which uses Network Manager not dhcpcd.
First and most important question: Have you worked through section 6 "Troubleshooting"? If you haven't, please do so as I won't be covering anything that's in that section in this thread.
You may also want to look at Bookworm Point to Point Ethernet (inc g_ether) and Bookworm vs Bullseye - A Guide. Again, it's unlikely I'll go over ground covered in those in this thread.
Some additional troubleshooting suggestions:
- Don't assume your Mac is supplying 35W to the Pi. The Pi 5 only supports two PD modes: the default 5v/3A and the often missing 5v/5A. Since the USB C connector is usually only rated for 5A, 35W requires more than 5V (probably 9v or 12v neither are supported by the Pi). You may also need an "e-marked" cable .
- Boot the SD card (or whatever your boot media is) on a 4B. Does the same thing happen?
- Try the Pi5 with a 4B as the USB host.
- Try going very old school for the Pi5's network configuration - create a profile in /etc/network/interfaces with a static IPv4 address in the subnet the Mac expects. RPiOS will use that in preference to whatever you have configured in NM*.
- Run a network scanner on your Mac to probe the subnet it and the Pi should be on.
- Disconnect everything that the Pi doesn't need to boot to minimise power consumption.
- From the Pi:
- The output from
Code:
head /etc/os-release
- The contents of your config.txt
- The contents of your cmdline.txt
- If you used the libcomposite method, the script you used to create the gadget and details of how you're running it.
- All relevant network configuration files e.g. /etc/network/interfaces, /etc/network/interfaces.d/*, relevant files from /etc/NetworkManager/system-connections, etc.
- Whether the usb0 interface is showing up on the Pi.
- What IPv4 address, if any, does it have? Include netmask if possible.
- The output from
- From the Mac:
- Whether the gadget interface is present
- What IPv4 address this interface has.
- Whether the subnet for it is distinct from all other subnets your Mac has access to.

*: Network Manager
Statistics: Posted by thagrol — Thu Sep 12, 2024 9:33 pm