Setting up RNDIS¶
The devkit provides one OTG/Dual-Role port that can be used. This is the USB-C 3.0 port. On a custom baseboard, the USB 2.0 ports could also be setup as OTG if required.
Configuring devkit as dhcp server¶
Configuring systemd to setup usb0 as DHCP server, assigning the devkit ip to 10.1.47.2 and a connected PC to ip 10.1.47.1
Doing it this way makes it easy to connect to a PC as by default Windows tries to get an address over dhcp. However, it does mean that having multiple devkits connected to the same PC won't work as they will all get the same IP address on the same subnet. To get that to work, each devkit would need to be on a separate subnet so the PC could tell which interface to send traffic to.
Note: The latest yocto filesystem should already have these files in place. https://support.criticallink.com/gitweb/?p=meta-mitysom.git;a=commit;h=f0a02d1ec77a2cc1e22e5f915379c75afb895eac
Setups up any usb* network interfaces
/etc/systemd/network/50-usb-dhcpserver.network:
[Match] Name=usb* KernelCommandLine=!nfsroot [Network] DHCPServer=yes Address=10.1.47.2/24 Gateway=10.1.47.1 [DHCPServer] # DHCP Pool will be size 1 starting at 10.1.47.1 PoolSize=1 EmitDNS=no EmitRouter=no
Loads the RNDIS g_ether module on boot
/etc/modules-load.d/g_ether.conf:
g_ether
To manually load g_ether:
modprobe g_ether
Example log:
[ 200.005236] using random self ethernet address [ 200.009707] using random host ethernet address [ 200.015432] usb0: HOST MAC d6:61:fd:d5:9f:4f [ 200.020262] usb0: MAC 82:94:36:23:f5:c5 [ 200.024354] using random self ethernet address [ 200.028827] using random host ethernet address [ 200.033434] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008 [ 200.040083] g_ether gadget: g_ether ready [ 200.055458] IPv6: ADDRCONF(NETDEV_UP): usb0: link is not ready [ 200.814260] g_ether gadget: super-speed config #1: CDC Ethernet (ECM) [ 200.844330] IPv6: ADDRCONF(NETDEV_CHANGE): usb0: link becomes ready root@mitysom-am57x:~# ifconfig usb0 usb0 Link encap:Ethernet HWaddr 82:94:36:23:F5:C5 inet addr:10.1.47.2 Bcast:10.1.47.255 Mask:255.255.255.0 inet6 addr: fe80::8094:36ff:fe23:f5c5/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:110 errors:0 dropped:0 overruns:0 frame:0 TX packets:232 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:17592 (17.1 KiB) TX bytes:22091 (21.5 KiB)
Note: The gadget link speed can be seen in the kernel message. high-speed is usb 2.0 and super-speed is usb 3.0
[ 152.333180] g_cdc gadget: high-speed config #1: CDC Composite (ECM + ACM) [ 164.797196] g_cdc gadget: super-speed config #1: CDC Composite (ECM + ACM)
See the Software FAQ for rndis benchmark speeds
Configuring PC as dhcp server¶
If you plan on having multiple devkits connected to a PC without having to worry about manually changing dhcp settings on each devkit. Then setting up the PC as the dhcp server is best. This requires bridging all connecting rndis devices together so they all get addresses from the dhcp server and can be on the same subnet. This can be setup pretty easily on Linux, see the link below
Go to top