Page 1 of 1

USB Gadget mode on new 3 A+?

Posted: Mon Dec 03, 2018 8:45 pm
by BeauSlim
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.

Re: USB Gadget mode on new 3 A+?

Posted: Mon Dec 03, 2018 8:58 pm
by DirkS
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.

Re: USB Gadget mode on new 3 A+?

Posted: Tue Dec 04, 2018 5:31 am
by W. H. Heydt
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.

Re: USB Gadget mode on new 3 A+?

Posted: Tue Dec 04, 2018 11:11 am
by drgeoff
@W. H. Heydt
You should read what DirkS linked to.

Re: USB Gadget mode on new 3 A+?

Posted: Tue Dec 04, 2018 1:25 pm
by hippy
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.

Re: USB Gadget mode on new 3 A+?

Posted: Tue Dec 04, 2018 1:41 pm
by fruitoftheloom
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

Re: USB Gadget mode on new 3 A+?

Posted: Tue Dec 04, 2018 1:49 pm
by thagrol
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.

Re: USB Gadget mode on new 3 A+?

Posted: Tue Dec 04, 2018 11:24 pm
by BeauSlim
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.