BeauSlim
Posts: 30
Joined: Mon Jul 31, 2017 10:02 am

USB Gadget mode on new 3 A+?

Mon Dec 03, 2018 8:45 pm

Since the new A+ only has one USB port, I'm wondering if it supports gadget mode like the Zero/W does. For example, so you can connect to a PC for Ethernet over USB.

DirkS
Posts: 9806
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: USB Gadget mode on new 3 A+?

Mon Dec 03, 2018 8:58 pm

Theoretical: yes. In practice: dunno.

There's a problem. (see viewtopic.php?f=63&t=227044#p1392654)
USB boot is enabled by default (like on the 3B+) and apparently that's not compatible with gadget mode.

W. H. Heydt
Posts: 10015
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: USB Gadget mode on new 3 A+?

Tue Dec 04, 2018 5:31 am

Search on using gadget mode with the A+. The Pi3A+ should be able to do it the same way. Because the two boards have "normal" USB-A connectors, they lack the extra line that permits the system to switch between master and slave the way the Pi0/Pi0W do. So you're going to be either a master USB device or a slave USB device and the only way to switch is to edit cmdline.txt (IIRC) and possibly config.txt.

But other than those considerations...yes, you should be able to run a Pi3A+ in gadget mode.

drgeoff
Posts: 9260
Joined: Wed Jan 25, 2012 6:39 pm

Re: USB Gadget mode on new 3 A+?

Tue Dec 04, 2018 11:11 am

@W. H. Heydt
You should read what DirkS linked to.

hippy
Posts: 5158
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: USB Gadget mode on new 3 A+?

Tue Dec 04, 2018 1:25 pm

drgeoff wrote:
Tue Dec 04, 2018 11:11 am
@W. H. Heydt
You should read what DirkS linked to.
Everyone needs to bear in mind that "USB Boot" means two things; "USB Host Boot" where a Pi can boot from a USB memory stick or HDD, which works on Pi 3A+, and "USB Device Boot" where the Pi connects to a PC without an SD Card and can have bootcode.bin etc pushed into it over USB, which doesn't currently work on a Pi 3A+.

But "USB Device Boot" not currently working does not preclude the Pi 3A+ being used in gadget mode. The Pi 3A+ must be booted from SD Card and the configuration must be set-up to explicitly enable gadget mode because the OTG ID signal on the 3A+ is tied to 0V so, by default, it only enables host mode.

You will also need to find or build a USB-A to USB-A cable to use gadget mode on a Pi 3A+. The power line in that should be cut if the Pi is powered by its own external PSU.

fruitoftheloom
Posts: 19508
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: USB Gadget mode on new 3 A+?

Tue Dec 04, 2018 1:41 pm

hippy wrote:
Tue Dec 04, 2018 1:25 pm
drgeoff wrote:
Tue Dec 04, 2018 11:11 am
@W. H. Heydt
You should read what DirkS linked to.
Everyone needs to bear in mind that "USB Boot" means two things; "USB Host Boot" where a Pi can boot from a USB memory stick or HDD, which works on Pi 3A+, and "USB Device Boot" where the Pi connects to a PC without an SD Card and can have bootcode.bin etc pushed into it over USB, which doesn't currently work on a Pi 3A+.

But "USB Device Boot" not currently working does not preclude the Pi 3A+ being used in gadget mode. The Pi 3A+ must be booted from SD Card and the configuration must be set-up to explicitly enable gadget mode because the OTG ID signal on the 3A+ is tied to 0V so, by default, it only enables host mode.

You will also need to find or build a USB-A to USB-A cable to use gadget mode on a Pi 3A+. The power line in that should be cut if the Pi is powered by its own external PSU.

An alternative is to use a USBNET Cable:

viewtopic.php?t=131042
adieu

My other Computer is an Asus CS10 ChromeBit running Chrome Operating System.
HP Envy 4500 Wireless Printer supported by HPLIP software in Raspbian Buster.
Raspberry Pi Model 2B v1.1

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

Re: USB Gadget mode on new 3 A+?

Tue Dec 04, 2018 1:49 pm

On the A+ USB gadget mode can be enabled by adding

Code: Select all

dtoverlay=dwc,dr_mode=peripheral
to /boot/config.txt I'd expect the 3A+ to be the same.

You'l then need to load the required g_* module.
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.

BeauSlim
Posts: 30
Joined: Mon Jul 31, 2017 10:02 am

Re: USB Gadget mode on new 3 A+?

Tue Dec 04, 2018 11:24 pm

Thanks to all for the info and clarification of the caveats. Since I'll be running from SD and not looking to have it boot from the USB, it sounds like it will work for my application.

StephenDone
Posts: 1
Joined: Wed Apr 10, 2019 1:55 pm

Re: USB Gadget mode on new 3 A+?

Wed Apr 10, 2019 2:01 pm

thagrol wrote:
Tue Dec 04, 2018 1:49 pm
On the A+ USB gadget mode can be enabled by adding

Code: Select all

dtoverlay=dwc,dr_mode=peripheral
to /boot/config.txt I'd expect the 3A+ to be the same.

You'l then need to load the required g_* module.
Thank you @thagrol.

I can confirm that the addition of the dr_mode to my dtoverlay config allowed an sdcard previously used in a Pi Zero and configured as an HID keyboard to work just as before in a PI 3A+. My line was...

Code: Select all

dtoverlay=dwc2,dr_mode=peripheral
I.E. the PI 3A+ definitely does support USB OTG. But yes, it does not work until you add this extra config option.

Cheers

Steve

Return to “Advanced users”