Setting Up Ethernet Link Print


Connecting to Ethernet LAN

To connect the kit to Ethernet LAN, plug the Ethernet cable (included with the kit) between the Ethernet connector on the HGI board and an Ethernet switch (or similar) connected to your LAN. The following picture illustrates connection on the kit side:

To unplug the cable from the kit, push the two buttons on the sides of the cable connector while pulling the connector out of the kit.


Using Ethernet in Linux

When Linux boots, the Ethernet interface is enabled and configured in the default image installed to the kit. The IP address is obtained from a DHCP server. Use the following command to see the IP address that has been assigned to your kit:

root@imx8mmcube:~# ifconfig eth0 eth0 Link encap:Ethernet HWaddr D6:1D:22:5D:D6:B6 inet addr:192.168.1.16 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::d41d:22ff:fe5d:d6b6/64 Scope:Link ...

At this point, you can have the full Linux TCP/IP stack enabled in Linux. To provide a most basic example of how you can use Ethernet in Linux, the following command copies a file from your Linux host to the kit via scp:

$ scp tmp/target.file root@192.168.1.6:/tmp


Setting Ethernet MAC in U-Boot

The Ethernet MAC PHY may or may not be set as a U-Boot environment variable on your kit. If the MAC PHY is not set in U-Boot, the Linux Ethernet kernel driver uses a randomly-generated MAC on every boot. With IP address obtained from DHCP, this will result in your board getting a new IP address on every boot, which is not always convenient.

To set up the board MAC address in U-Boot, perform the following step-wise procedure:

  1. Reset the kit.
  2. Stop at the U-Boot prompt, by hitting any key in the serial console window at the U-Boot countdown.
  3. Run the following command to determine if a MAC PHY address has been already allocated to your kit:
  4. u-boot=> printenv ethaddr

    If this command returns a valid MAC address, all is good, you can proceed to boot to Linux at this point.

  5. If there is no MAC PHY set up in U-Boot, perform the following commands to set up the MAC PHY in U-Boot:
  6. u-boot=> setenv ethaddr 3C:FB:96:DC:59:7F
    u-boot=> saveenv

    If you have several kits on your LAN, increase the last digit for each kit so the MAC addresses are all unique in your LAN.

  7. Boot to Linux, check that the kernel makes use of the MAC PHY you have assigned to your kit:
  8. root@imx8mmcube:~# ifconfig eth0 eth0 Link encap:Ethernet HWaddr 3C:FB:96:DC:59:7F inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::d41d:22ff:fe5d:d6b6/64 Scope:Link ...