Difference between revisions of "RockpiE/dev/usbnet"
(Created page with "{{rockpiE_header}} {{Languages|rockpiE/dev/adb}} ROCK Pi E > Development > USB Device Network] === Requirement ==...") |
|||
Line 1: | Line 1: | ||
{{rockpiE_header}} | {{rockpiE_header}} | ||
{{Languages|rockpiE/dev/adb}} | {{Languages|rockpiE/dev/adb}} | ||
− | [[rockpiE | ROCK Pi E]] > [[rockpiE/dev | Development]] > [[rockpiE/dev/usbnet | USB Device Network | + | [[rockpiE | ROCK Pi E]] > [[rockpiE/dev | Development]] > [[rockpiE/dev/usbnet | USB Device Network]] |
=== Requirement === | === Requirement === |
Latest revision as of 08:39, 24 November 2020
ROCK Pi E > Development > USB Device Network
Contents
Requirement
- ROCK Pi E mainboard
- eMMC module
- Power adapter
- USB Male A to Dupont cable.
- One port is Male A type and the other includes three Dupont lines.
- Hardware connection
ROCK Pi E 40-pin Header | USB Interface | USB Male A to Dupont Cable |
---|---|---|
PIN#18 | Data+ | Green wire |
PIN#16 | Data- | White wire |
PIN#14 | GND | Black wire |
Software preparation
- Kernel version
USB gadget driver must be enabled to configure usb net. You need to update the kernel to at least version 4.4.194-16 rockchip.
- Stop conflicting services
So far, Dupont cable OTG port only supports one Gadget function. To use use USB net, here need to stop rockchip-adbd service.
root@rockpie:~# systemctl stop rockchip-adbd root@rockpie:~# systemctl disable rockchip-adbd root@rockpie:~# reboot
Load kernel module
- Connect the ROCK Pi E to PC with a Male A type and the other includes three Dupont lines cable.
- Install kernel module on ROCK Pi S
root@rockpis:~# modprobe g_ether
dmesg shoule output the folowing:
root@rockpis:~# dmesg -c [ 25.792177] using random self ethernet address [ 25.792239] using random host ethernet address [ 25.794179] usb0: HOST MAC fe:fc:51:10:b2:fa [ 25.794444] usb0: MAC 82:21:a8:1b:f3:4a [ 25.794539] using random self ethernet address [ 25.794589] using random host ethernet address [ 25.794787] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008 [ 25.794819] g_ether gadget: g_ether ready [ 25.797133] dwc2 ff400000.usb: bound driver g_ether [ 25.988410] dwc2 ff400000.usb: new device is high-speed [ 26.068210] dwc2 ff400000.usb: new device is high-speed [ 26.132742] dwc2 ff400000.usb: new address 39 [ 26.154634] g_ether gadget: high-speed config #1: CDC Ethernet (ECM)
Bring up the usb0 device
root@rockpie:~# ifconfig usb0 up
Now you should have usb0 on ROCK Pi E enabled.
On the host PC Ubuntu 16.04, the dmesg gives something like below:
radxa@x86_64_pc:~$ sudo dmesg -c [974637.533636] usb 1-4.1: new high-speed USB device number 121 using xhci_hcd [974637.635515] usb 1-4.1: New USB device found, idVendor=0525, idProduct=a4a2 [974637.635520] usb 1-4.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [974637.635523] usb 1-4.1: Product: RNDIS/Ethernet Gadget [974637.635525] usb 1-4.1: Manufacturer: Linux 4.4.143-46-rockchip-gef70dd2c725e with ff400000.usb [974637.636655] cdc_subset: probe of 1-4.1:1.0 failed with error -22 [974637.637971] cdc_ether 1-4.1:1.0 usb0: register 'cdc_ether' at usb-0000:00:14.0-4.1, CDC Ethernet Device, 8a:11:bc:e7:60:26 [974637.650141] cdc_ether 1-4.1:1.0 enp0s20f0u4u1: renamed from usb0 [974637.678705] IPv6: ADDRCONF(NETDEV_UP): enp0s20f0u4u1: link is not ready [974637.694633] IPv6: ADDRCONF(NETDEV_UP): enp0s20f0u4u1: link is not ready
enp0s20f0u4u1 is the "USB network card" for ROCK Pi E. ifconfig enp0s20f0u4u1 gives us the info about it.
Setup USB Network
On ROCK Pi E.
root@rockpie:~# IP=10.0.1.1 root@rockpie:~# HOST_IP=10.0.1.2 root@rockpie:~# ifconfig usb0 $IP netmask 255.255.255.0 root@rockpie:~# route
On host PC
radxa@x86_64_pc:~$ HOST_IP=10.0.1.2 radxa@x86_64_pc:~$ sudo ifconfig enp0s20f0u4u1 $HOST_IP netmask 255.255.255.0
Test the network, on ROCK Pi E
root@rockpie:~# ping $HOST_IP
Test network traffic, on host PC
radxa@x86_64_pc:~$ iperf -s ------------------------------------------------------------ Server listening on TCP port 5001 TCP window size: 128 KByte (default) ------------------------------------------------------------ [ 4] local 10.0.1.2 port 5001 connected with 10.0.1.1 port 48264 [ ID] Interval Transfer Bandwidth [ 4] 0.0-10.0 sec 113 MBytes 94.6 Mbits/sec
Test network traffic, on ROCK Pi E:
root@rockpie:~# iperf -c $HOST_IP ------------------------------------------------------------ Client connecting to 10.0.1.2, TCP port 5001 TCP window size: 85.0 KByte (default) ------------------------------------------------------------ [ 3] local 10.0.1.1 port 48264 connected with 10.0.1.2 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 113 MBytes 94.8 Mbits/sec
Troubleshooting
- Refer Troubleshooting page
- Post your issue on the forum: https://forum.radxa.com/c/rockpiE