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?
Stack Exchange network consists of 181 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.Visit Stack Exchange
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.Sign up to join this community
You cannot use the Raspberry Pi 3 as a USB gadget. At the time of writing this is only possible on the Raspberry Pi 0, 0W, A, A+, and 4. The Pi B, B+, 2, 3, 3A+, and 3B+ lack the required pin for OTG.
If you have a Pi Zero, this gist has some examples that work with minimal configuration like
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
lukas2005's original answer linked to iSticktoit.net's 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.
USB gadget? Do you wan't it to act as a slave device like USB flash drive?