Setting up RNDIS¶
The devkit provides one USB 2.0 Dual-Role port that can be used. On a custom baseboard, the second USB 2.0 port could also be setup as Dual Role 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.
Note: The Linux kernel is working on removing the existing RNDIS driver. Brief testing of the replacement "g_cdc" worked.
/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-am62x:~# ifconfig usb0 usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 metric 1 inet 10.1.47.2 netmask 255.255.255.0 broadcast 10.1.47.255 inet6 fe80::3413:c9ff:fe10:5ee1 prefixlen 64 scopeid 0x20<link> ether 36:13:c9:10:5e:e1 txqueuelen 1000 (Ethernet) RX packets 153 bytes 19598 (19.1 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 38 bytes 7059 (6.8 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
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