This application note explains how to configure and use Ethernet on the i.MX 6ULL SOM.
Ethernet Configuration
If you have several IMX6ULL Starter Kits in a single LAN, check that they all have different MAC addresses and IP addresses. Reset the system and enter the U-Boot command line interface by pressing an arbitrary key on the serial console. Check the MAC address:
IMX6ULL-SOM U-Boot > print ethaddr
ethaddr=3C:FB:96:08:08:29
If necessary, modify the MAC address to a unique value; also, adjust the IP settings for your local network:
IMX6ULL-SOM U-Boot > setenv ethaddr 3C:FB:96:08:08:68
IMX6ULL-SOM U-Boot > setenv ipaddr 192.168.0.68
IMX6ULL-SOM U-Boot > setenv serverip 192.168.0.3
IMX6ULL-SOM U-Boot > setenv gatewayip 192.168.0.1
IMX6ULL-SOM U-Boot > setenv netmask 255.255.255.0
IMX6ULL-SOM U-Boot > saveenv
Saving Environment to NAND...
Erasing NAND...
Erasing at 0x3a0000 -- 100% complete.
Writing to NAND... OK
IMX6ULL-SOM U-Boot >
U-Boot and Linux running on the i.MX 6ULL SOM are configured to pass the IP settings to Linux via its command line:
IMX6ULL-SOM U-Boot > run nandboot
Loading from nand0, offset 0xe20000
...
Starting kernel ...
...
[ 0.000000] Kernel command line: console=ttymxc0,115200 consoleblank=0 panic=3 rootwait=1 rw ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs ubi.fm_autoconvert=1 ignore_loglevel ip=192.168.0.68:192.168.0.3:192.168.0.1:255.255.255.0:6ull_1:eth0:off fec_mac=3C:FB:96:08:08:68
...
[ 5.682235] fec 2188000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
...
~ # ifconfig eth0
eth0 Link encap:Ethernet HWaddr 3C:FB:96:08:08:68
inet addr:192.168.0.68 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
~ #
So the system should be ready to access the local network after booting the i.MX 6ULL SOM board to the Linux shell prompt:
~ # ping 192.168.0.3
PING 192.168.0.3 (192.168.0.3): 56 data bytes
64 bytes from 192.168.0.3: seq=0 ttl=128 time=5.756 ms
64 bytes from 192.168.0.3: seq=1 ttl=128 time=1.994 ms
64 bytes from 192.168.0.3: seq=2 ttl=128 time=1.637 ms
^C
--- 192.168.0.3 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 1.637/3.129/5.756 ms
~ #
Ethernet Throughput
Measure Ethernet performance by copying a file over NFS. Measured throughput is around 90 Mbps:
~ # mount -o nolock 192.168.0.4:/nfs /mnt/
~ # ls -l /mnt
-rw-rw-r-- 1 root root 134217728 Oct 22 2018 128MiB
~ # time cp /mnt/128MiB /dev/null
real 0m 11.84s
user 0m 0.06s
sys 0m 1.25s
~ #
Ethernet Link Detection
The Linux device driver automatically detects presence of the Ethernet link. This is illustrated by the following test scenario:
- Un-plug the Ethernet cable from the board.
- In 1-2 seconds, the following message will appear:
~ # [ 12.962086] fec 2188000.ethernet eth0: Link is Down
- Plug the Ethernet cable back, the following message will appear:
[ 16.082468] fec 2188000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
- Repeat the test several times:
[ 20.241979] fec 2188000.ethernet eth0: Link is Down
[ 23.362394] fec 2188000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
[ 26.481952] fec 2188000.ethernet eth0: Link is Down
[ 29.602366] fec 2188000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
[ 32.721968] fec 2188000.ethernet eth0: Link is Down
[ 34.802360] fec 2188000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
[ 37.921943] fec 2188000.ethernet eth0: Link is Down
[ 40.002408] fec 2188000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
Using Ethernet2 in Parallel with Ethernet1
The second Ethernet interface can be made available on the i.MX 6ULL Starter Kit using the following test scenario:
- Connect the Waveshare LAN8720 ETH Board to the P8 connector of the IMX6ULL-SOM-BSB development baseboard as follows:
Baseboard Pin |
Baseboard Signal |
LAN8720 Pin |
LAN8720 Signal |
P8.1 |
3V3_P |
P2.1 |
3V3 |
P8.2 |
3V3_P |
P2.2 |
2V5 |
P8.3 |
GND |
P2.3 |
GND |
P8.4 |
GND |
P2.4 |
GND |
P8.5 |
RMII_MDC |
P2.5 |
MDC |
P8.6 |
RMII_MDIO |
P2.6 |
MDIO |
P8.7 |
RMII2_CRS_DV |
P2.7 |
CRS_DV |
P8.8 |
RMII2_CLK |
P2.8 |
R_RX_CLK |
P8.9 |
RMII2_RXD1 |
P2.9 |
RXD1 |
P8.10 |
RMII2_RXD0 |
P2.10 |
RXD0 |
P8.11 |
RMII2_TXD0 |
P2.11 |
TXD0 |
P8.12 |
RMII2_TXEN |
P2.12 |
TX_EN |
P8.13 |
RMII2_RXER |
P2.13 |
NC |
P8.14 |
RMII2_TXD1 |
P2.14 |
TXD1 |
- Enable the second Ethernet interface (fec2) in the projects/rootfs/rootfs.dts file:
&fec2 {
...
status = "okay";
...
};
- Build and update the DTB as described in Installing and Activating Cross Development Environment application note.
- Boot the system and make sure Ethernet1 is working:
~ # ifconfig eth0
eth0 Link encap:Ethernet HWaddr 3C:FB:96:08:08:68
inet addr:192.168.0.68 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:166 (166.0 B) TX bytes:0 (0.0 B)
~ # ping 192.168.0.3
PING 192.168.0.3 (192.168.0.3): 56 data bytes
64 bytes from 192.168.0.3: seq=0 ttl=128 time=4.443 ms
64 bytes from 192.168.0.3: seq=1 ttl=128 time=1.640 ms
64 bytes from 192.168.0.3: seq=2 ttl=128 time=1.613 ms
^C
--- 192.168.0.3 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 1.613/2.565/4.443 ms
~ #
- Disable Ethernet1 and enable Ethernet2:
~ # ifconfig eth0 down
~ # ifconfig eth1 192.168.0.78
[ 30.817297] Generic PHY 2188000.ethernet-1:01: attached PHY driver [Generic PHY] (mii_bus:phy_addr=2188000.ethernet-1:01, irq=-1)
~ #
- Un-plug the Ethernet cable from the IMX6ULL-SOM-BSB baseboard and plug it into the LAN8720 ETH Board, the following message will appear:
[ 47.442378] fec 20b4000.ethernet eth1: Link is Up - 100Mbps/Full - flow control rx/tx
- Make sure Ethernet2 is working:
~ # ping 192.168.0.3
PING 192.168.0.3 (192.168.0.3): 56 data bytes
64 bytes from 192.168.0.3: seq=0 ttl=128 time=3.087 ms
64 bytes from 192.168.0.3: seq=1 ttl=128 time=1.626 ms
64 bytes from 192.168.0.3: seq=2 ttl=128 time=1.590 ms
^C
--- 192.168.0.3 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 1.590/2.101/3.087 ms
~ #
Using Ethernet2 with Ethernet1 Disabled
This test scenario is very similar to the previous one:
- Connect the Waveshare LAN8720 ETH Board to the P8 connector of the IMX6ULL-SOM-BSB development baseboard as described above.
- Disable the first Ethernet interface (fec1) in the projects/rootfs/rootfs.dts file:
/*
* Disabling fec1 by status = "disabled" will break fec2
* since the MDIO bus is shared by them.
* So use this macro to disable fec1 and enable fec2.
*/
#define FEC1_DISABLE
- Enable the second Ethernet interface (fec2) in the projects/rootfs/rootfs.dts file:
&fec2 {
...
status = "okay";
...
};
- Build and update the DTB as described in Installing and Activating Cross Development Environment application note.
- Boot the system and make sure Ethernet2 is working:
~ # ifconfig eth0
eth0 Link encap:Ethernet HWaddr 46:F7:01:04:4B:0F
inet addr:192.168.0.68 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
~ # ping 192.168.0.3
PING 192.168.0.3 (192.168.0.3): 56 data bytes
64 bytes from 192.168.0.3: seq=0 ttl=128 time=3.221 ms
64 bytes from 192.168.0.3: seq=1 ttl=128 time=1.665 ms
64 bytes from 192.168.0.3: seq=2 ttl=128 time=1.639 ms
^C
--- 192.168.0.3 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 1.639/2.175/3.221 ms
~ #