How can I use Raspberry Pi 3 as a USB gadget. Is there any way?

How can I enable the USB gadget mode on Raspberry Pi?

  • 1
    What do you mean by USB gadget? Do you wan't it to act as a slave device like USB flash drive? – Mark Aug 24 '17 at 8:59
  • It might be possible, but I don't know of any exact way to do it. What is it you want to achieve? What kind of device do you want the Pi to behave like? The Raspberry Pi Zero is probably easier to get to work as a gadget since it has the right kind of connection, but the real question is what you want it to do, and what you want to send back and forth between the gadget and the host. – Bex Aug 24 '17 at 11:52
  • 1
    @Mark "gadget" is linux slang for whatever device has the b-type USB connection. – Bex Aug 24 '17 at 11:54
  • Here i found this wonderful tutorial isticktoit.net/?p=1383 You just need to follow it for the type of gadget you need which you did not specify. – user64112 Aug 25 '17 at 11:44
  • 4

You cannot use the Raspberry Pi 3 as a USB gadget. At the time of writing this is only possible on the Raspberry Pi Zero, Zero W, and classic Pi model A/A+. The Pi B+, Pi 2, and Pi 3 lack the required pin for OTG.

If you have a Pi Zero, this gist has some examples that work with minimal configuration like g_serial, g_ether, or g_multi. For example, a minimal way to enable the serial gadget is to add dtoverlay=dwc2 to /boot/config.txt and g_serial to /etc/modules

I'm surprised lukas2005's answer got downvoted. iSticktoit.net has good examples of using the more modern ConfigFS approach. The keyboard HID example is a good one to start with. And when you have only one functional micro-USB port, it becomes particularly valuable to configure multiple gadgets at a time, something that is not as readily available with the old g_* kernel modules.

  • 1
    About lukas2005's answer: it may have gotten downvoted because the provided link is about the RPi zero (and variants) while the OP asks about RPi 3 (I didn't downvote, and the link is very useful indeed). – calocedrus Jan 24 '18 at 1:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.