You have an Ultra96-V2 board, but want more data throughput than the on-board WiFi can provide. What do you do? A USB-to-Ethernet adapter () is inexpensive and provides excellent throughput, but requires a wired Ethernet infrastructure. Likewise, modern laptops often do not have a wired Ethernet jack but have lots of USB ports. That makes USB gadget Ethernet a compelling solution to get a high throughput connection. We often get asked on the Element14 forums (Ultra96 Hardware Design Forum) about how to enable USB gadget Ethernet on the Ultra96-V2 board, and thanks to a helpful forums user and some other helpful internet links we now have a solution. Starting with the PetaLinux 2020.1 BSP for the Ultra96-V2 this is now built into the OS image, and can can be manually added to older PetaLinux BSPs.
Here is the link to the Ultra96-V2 USB gadget Ethernet shell script on github:
Hardware you will need:
- USB micro-B cable (for UART connection)
- Linux PC with at least two available USB ports (USB 3.0 preferred for Ethernet)
How to Enable USB Gadget Ethernet on the Ultra96-V2 Board
In the PetaLinux 2020.1 BSP OS image for the Ultra96-V2 the USB gadget Ethernet startup script can be found in the root user's home folder (/home/root) and can be run from there. Connect the Ultra96-V2 board to the PC with the USB cables for the UART (J1 on the UART adapter) and Ethernet (J7). Boot your Ultra96-V2 board and run the USB gadget Ethernet startup script:
# cd ~
The script will run and bring up the 'usb0' Ethernet interface with a static IP address of 192.168.3.1. This is customizable in the script if this conflicts with another LAN.
If running a Linux virtual machine be sure to select the new USB device for use in the Linux guest OS:
Disable the other Ethernet interfaces on the host PC (both wired and WiFi) and assign the USB gadget Ethernet on the host a static IP address (e.g. 192.168.3.3). In this case the Linux host named this interface 'enp0s12u3', but it could have a different name on other PCs:
$ sudo ifconfig enp0s12u3 192.168.3.3
Do a ping test on the Ultra96-V2 to verify the USB Ethernet connection is active.
# ping 192.168.3.3 -I 192.168.3.1
If you have iperf3 installed on the Linux host you can run a iperf3 throughput test between the Ultra96-V2 board and the host.
Run the iperf3 server on the Linux host:
$ iperf3 -s -i 2 -B 192.168.3.3
Run the iperf3 client on the Ultra96-V2 target:
# iperf3 -c 192.168.3.3 -i 2 -t 20 -B 192.168.3.1
We now have an active Ethernet connection over USB 3.0 that can achieve over 200 Mbps Ethernet throughput! This Ethernet connection can now be used for remote access over ssh, copying of files, debugging software, etc. Anything that requires a connection to the board, but requires more bandwidth than a UART or WiFi can provide.