Notes about the ethernet interface

This article collects some notes regarding the use of the ethernet port on the various Acme Systems cards

If you are usign a Linux Debian or a Buildroot distribution the ethernet port if configurable starting from this directory /etc/network/interfaces.d.

Here usualy are available files for eth0, wlan0 and usb0 gadget port configuration.

Set a static IP address for eth0 port

Inside the eth0 save these lines:

allow-hotplug eth0
iface eth0 inet static
    address 192.168.1.90
    netmask 255.255.255.0
    gateway 192.168.1.1

Set a dynamic IP address for eth0 port

Inside the eth0 save these lines:

allow-hotplug eth0
iface eth0 inet dhcp

Set the MAC address

If your card does not have a dedicated MAC chip (available only on Acqua SOM) you can fix the MAC address saving it inside the eth0 file using a line like this:

hwaddress ca:d1:e0:35:fd:ef

If you don't have a your own MAC address but prefere to use a random MAC address you can use these lines instead:

pre-up if [ ! -f /etc/eth0.macaddress ]; then ifconfig eth0 | perl -ne'/^ +ether (.*?) / && print "$1\n"' > /etc/eth0.macaddress; fi
hwaddress $(cat /etc/eth0.macaddress)
up udhcpc -n -q -F `hostname`

At first boot Linux will generate a random MAC address. This script will save this MAC address on the file /etc/eth0.macaddress and will use the same value at any boot.

Device tree configuration on RoadRunner SOM

macb0: ethernet@f8008000 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_macb0_default &pinctrl_macb0_phy_irq>;
    phy-mode = "rmii";
    status = "okay";

    ethernet-phy@1 {
        reg = <0x1>;
        interrupt-parent = <&pioA>;
        interrupts = <73 IRQ_TYPE_LEVEL_LOW>;
    };
};

...

pinctrl_macb0_default: macb0_default {
    pinmux = <PIN_PB14__GTXCK>,
         <PIN_PB15__GTXEN>,
         <PIN_PB16__GRXDV>,
         <PIN_PB17__GRXER>,
         <PIN_PB18__GRX0>,
         <PIN_PB19__GRX1>,
         <PIN_PB20__GTX0>,
         <PIN_PB21__GTX1>,
         <PIN_PB22__GMDC>,
         <PIN_PB23__GMDIO>;
    bias-disable;
};

Sergio Tanzilli
Systems designer, webmaster of www.acmesystems.it and founder of Acme Systems srl

Personal email: tanzilli@acmesystems.it
Web pages: https://www.acmesystems.it --- https://www.acmestudio.it
Github repositories: https://github.com/tanzilli --- https://github.com/acmesystems
Telegram group dedicated to the Acme Systems boards: https://t.me/acmesystemssrl