STM32 MPU Family - MCU Support Tips and Tricks - Ethernet-over-USB Ubuntu 16.04 Set-up |
Driver installation
Using Console to the target, first check that usb0 network interface is UP:
root@stm32mp1:~# ifconfig usb0
usb0 Link encap:Ethernet HWaddr 32:2A:2F:8F:9C:A8
inet addr:192.168.7.2 Bcast:192.168.7.255 Mask:255.255.255.0
inet6 addr: fe80::302a:2fff:fe8f:9ca8%3200150032/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1751 errors:0 dropped:30 overruns:0 frame:0
TX packets:759 errors:0 dropped:2 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:159931 (156.1 KiB) TX bytes:218433 (213.3 KiB)
Then, check that dedicated USB OTG cable is connected to the target.
On the Ubuntu PC, the driver is part of Linux kernel and USB Gadget should be visible:
stm32bv@gnbcxd0102: lsusb
Bus 002 Device 002: ID 8087:8002 Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:800a Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 002: ID 0451:8140 Texas Instruments, Inc.
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 087: ID 0483:3752 STMicroelectronics
Bus 003 Device 003: ID 03f0:094a Hewlett-Packard Optical Mouse [672662-001]
Bus 003 Device 002: ID 03f0:034a Hewlett-Packard Elite Keyboard
Bus 003 Device 040: ID 0483:3752 STMicroelectronics
Bus 003 Device 004: ID 0451:8142 Texas Instruments, Inc. TUSB8041 4-Port Hub
Bus 003 Device 088: ID 1d6b:0104 Linux Foundation Multifunction Composite Gadget
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
stm32bv@gnbcxd0102:
Network Interface Set-up
We now have to configure Ethernet connection, updating /etc/network/interfaces configuration file.
stm32bv@gnbcxd0102:~# more /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
allow-hotplug enp0s6u4
# auto enp0s6u4
iface enp0s6u4 inet static
address 192.168.7.1
netmask 255.255.255.0
network 192.168.7.0
gateway 192.168.7.1
Note that the name of the network interface enp0s6u4 may be different.
The connection is ready now !
The target is reachable with 192.168.7.2 IP address.