I'm trying to use the Broadcom BCM2835 OTG functionality to use the RPi as a Ethernet gadget in order to establish a network connection with a host (I found this is used with RPi Zero). The OTG is supported in RPi B1 as you can see in the Broadcom BCM2835 specification.
I tried to recompiled the kernel with the module:
Device Drivers > USB support > OTG support
CONFIG_USB_OTG:
The most notable feature of USB OTG is support for a
"Dual-Role" device, which can act as either a device
or a host. The initial role is decided by the type of
plug inserted and can be changed later when two dual
role devices talk to each other.
Select this only if your board has Mini-AB/Micro-AB
connector.
Symbol: USB_OTG [=y]
Type : boolean
Prompt: OTG support
Location:
-> Device Drivers
-> USB support (USB_SUPPORT [=y])
-> Support for Host-side USB (USB [=y])
Defined at drivers/usb/core/Kconfig:44
Depends on: USB_SUPPORT [=y] && USB [=y] && PM [=y]
I added the usb0 interface configuration to /etc/network/interfaces
.
allow-hotplug usb0
mapping hotplug
script grep
map usb0
iface usb0 inet static
address 192.168.2.1
netmask 255.255.255.0
broadcast 192.168.2.255
I added line dtoverlay=dwc2
to /boot/config.tx
file.
I added dwc2
and g_ether
to /etc/modules
.
Nothing worked. The output of ifconfig usb0
is:
usb0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.2.1 netmask 255.255.255.0 broadcast 192.168.2.255
ether ba:b9:a5:2a:b2:04 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
The host doesn't recognize any USB device when plug.
It's possible to use USB A as a slave? Any idea to solve it?