jdb
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1697
Joined: Thu Jul 11, 2013 2:37 pm

Re: Modeal A Q: Can it be USB client instead of USB host?

Sun Aug 24, 2014 6:35 pm

There *is* in fact a "gadget" (i.e. USB device) driver for the OTG hardware in the Pi. The dwc2-gadget (formerly s3c-hsotg) driver in the upstream Linux tree is capable of this.

AFAIK, nobody's demoed a working version on a Pi Model A (though it is theoretically possible).
Rockets are loud.
https://astro-pi.org

User avatar
Shoka
Posts: 140
Joined: Sat Jul 12, 2014 8:35 pm
Location: Manchester, UK

Re: Model A Q: Can it be USB client instead of USB host?

Wed Dec 10, 2014 8:56 pm

In the light of the release of the A+ I'd like to investigate the possibilities discussed in this thread.

If I understand the story so far, there is no "theoretical" reason why an A+ should not operate as a USB slave to a B+, including taking power over the "USB" cable, though that cable would need to be specifically constructed, and would presumably violate the USB standard quite severely.

There are ip over USB network stacks in existence for arm, so again theoretically one could use a B+ as the core for a small network of A+'s.

There is mention back up the thread of a driver for the broadcom USB hardware in slave mode, already included in existing kernels.

All in all an interesting story, I wonder why the subject has died ?
Cheers Harry

plugwash
Forum Moderator
Forum Moderator
Posts: 3225
Joined: Wed Dec 28, 2011 11:45 pm

Re: Model A Q: Can it be USB client instead of USB host?

Wed Dec 10, 2014 11:48 pm

Probablly because noone sufficiently knowlageable about kernel hacking has actually put the effort in to make it work.

As for the cable I thin usb A-A cables are fairly easilly available.

User avatar
jacksonliam
Posts: 181
Joined: Tue Feb 07, 2012 10:09 pm

Re: Model A Q: Can it be USB client instead of USB host?

Sun Dec 14, 2014 10:41 pm

Also very interested in this, I assume it's not as simple as patching in the upstream USB gadget driver and loading that module instead of the current USB driver module?

I have a couple of usb a to a cables here which work with the USB bootloader for the model A.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 9599
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Model A Q: Can it be USB client instead of USB host?

Sun Dec 14, 2014 10:48 pm

it would probably require a complete re write of the USB stack to an USB OTG (USB slave) stack, not a simple undertaking.

prudy
Posts: 4
Joined: Thu Jun 20, 2013 8:02 am

Re: Model A Q: Can it be USB client instead of USB host?

Fri Mar 11, 2016 11:07 pm

I have just sent a pull request on gitlab. With this the model A can be used as gadget.
For this:
- need new firmware and kernel with dtb
- dwc2 driver must be compiled in gadget-only mode and 'dtoverlay=dwc2' must be added into config.txt or
- dwc2 driver compiled in gadget-only mode and 'dtoverlay=dwc2,dr_mode=peripheral' added into config.txt

Tested initially with serial and ethernet gadget on usb A-A cable.

mimi123
Posts: 583
Joined: Thu Aug 22, 2013 3:32 pm

Re: Model A Q: Can it be USB client instead of USB host?

Sat Mar 12, 2016 8:43 am

The RPi0 is a better choice for OTG

gregeric
Posts: 1495
Joined: Mon Nov 28, 2011 10:08 am

Re: Model A Q: Can it be USB client instead of USB host?

Sat Mar 12, 2016 8:58 am

@prudy, thank you for fixing this!

nm_su_rpi
Posts: 1
Joined: Mon May 23, 2016 12:11 pm

Re: Model A Q: Can it be USB client instead of USB host?

Tue May 24, 2016 2:41 pm

@prudy, thank you very much. (Now I don't have to wait rpi0 for the gadget test :-)
So, after lots of failed attempts, now my rpiA can "rpiboot" into gadget mode.
(i.e. Booting without SD card into gadget mode.)

My (experimental) setup's boot sequence:-
  • rpiboot downloads usbbootcode.bin.
  • rpiboot downloads buildroot.elf + fat_image+fit_image.
  • buildroot.elf starts u-boot.bin (in the fat_image.)
  • u-boot.bin starts linux_kernel(+device_tree+ramdisk,in the fit_image.)
it is a great learning process for me. But, I understand these U-Boot things are not requred with the upcoming boot files (https://github.com/raspberrypi/tools/issues/44.)
--
mn

drudru
Posts: 1
Joined: Tue Feb 07, 2017 9:13 pm

Re: Model A Q: Can it be USB client instead of USB host?

Tue Feb 07, 2017 9:24 pm

Just to confirm, can a current model A+ be a USB client with the recent kernels?

All signs say yes, but I hesitate. All of the information on the net is geared towards the Zero rather than the A+. So I haven't found a confirmation specifically for the A+.

gregeric
Posts: 1495
Joined: Mon Nov 28, 2011 10:08 am

Re: Model A Q: Can it be USB client instead of USB host?

Wed Feb 08, 2017 9:25 am

It doesn't appear that prudy's patches to dwc2 have made it into the upstream driver. However the extra override in the dwc2 dtoverlay is in current firmware.

So you'll need to compile your own loadable kernel module dwc2.ko with prudy's patches. See https://github.com/raspberrypi/linux/pull/1343

edge0f17
Posts: 15
Joined: Sun Oct 25, 2015 6:55 am

Re: Model A Q: Can it be USB client instead of USB host?

Wed Feb 08, 2017 11:17 am

I don`t think the patches are in linux 4.4, but I have been using gadget mode on a model A with linux 4.9 (a prebuilt version is in firmware-next) and 'dtoverlay=dwc2,dr_mode=peripheral' added into config.txt

Return to “General discussion”

Who is online

Users browsing this forum: No registered users and 59 guests