DESK-MP1-L/Peripherals/Ethernet

From DAVE Developer's Wiki
Jump to: navigation, search
History
Issue Date Notes
2023/08/02 DESK-MP1-L-1.0.0 release


Peripheral Ethernet[edit | edit source]

Device tree configuration[edit | edit source]

Here below an example of device tree configuration used on Kernel Linux:

From stm32mp157a-dcsb5000dd1r.dts:

&ethernet0{
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&eth1_pins_mx>;
	pinctrl-1 = <&eth1_sleep_pins_mx>;
	status = "okay";

	/* USER CODE BEGIN ethernet0 */
	phy-mode = "rmii";
	max-speed = <100>;
	phy-handle = <&phy0>;
	nvmem-cells = <&ethernet_mac_address>;
	nvmem-cell-names = "mac-address";

	mdio0 {
		#address-cells = <1>;
		#size-cells = <0>;
		compatible = "snps,dwmac-mdio";
		phy0: ethernet-phy@0 {
			compatible = "ethernet-phy-ieee802.3-c22";
			reg = <0>;
		};
	};
	/* USER CODE END ethernet0 */
};
...
...
&pinctrl {
...
...
	eth1_pins_mx: eth1_mx-0 {
		pins1 {
			pinmux = <STM32_PINMUX('A', 1, AF11)>, /* ETH1_REF_CLK */
					 <STM32_PINMUX('B', 12, AF11)>, /* ETH1_TXD0 */
					 <STM32_PINMUX('C', 1, AF11)>, /* ETH1_MDC */
					 <STM32_PINMUX('G', 14, AF11)>; /* ETH1_TXD1 */
			bias-disable;
			drive-push-pull;
			slew-rate = <1>;
		};
		pins2 {
			pinmux = <STM32_PINMUX('A', 2, AF11)>; /* ETH1_MDIO */
			bias-disable;
			drive-push-pull;
			slew-rate = <0>;
		};
		pins3 {
			pinmux = <STM32_PINMUX('A', 7, AF11)>, /* ETH1_CRS_DV */
					 <STM32_PINMUX('C', 4, AF11)>, /* ETH1_RXD0 */
					 <STM32_PINMUX('C', 5, AF11)>, /* ETH1_RXD1 */
					 <STM32_PINMUX('G', 12, AF11)>; /* ETH1_PHY_INTN */
			bias-disable;
		};
		pins4 {
			pinmux = <STM32_PINMUX('B', 11, AF11)>; /* ETH1_TX_EN */
		};
	};

	eth1_sleep_pins_mx: eth1_sleep_mx-0 {
		pins {
			pinmux = <STM32_PINMUX('A', 1, ANALOG)>, /* ETH1_REF_CLK */
					 <STM32_PINMUX('A', 2, ANALOG)>, /* ETH1_MDIO */
					 <STM32_PINMUX('A', 7, ANALOG)>, /* ETH1_CRS_DV */
					 <STM32_PINMUX('B', 11, ANALOG)>, /* ETH1_TX_EN */
					 <STM32_PINMUX('B', 12, ANALOG)>, /* ETH1_TXD0 */
					 <STM32_PINMUX('C', 1, ANALOG)>, /* ETH1_MDC */
					 <STM32_PINMUX('C', 4, ANALOG)>, /* ETH1_RXD0 */
					 <STM32_PINMUX('C', 5, ANALOG)>, /* ETH1_RXD1 */
					 <STM32_PINMUX('G', 12, ANALOG)>, /* ETH1_PHY_INTN */
					 <STM32_PINMUX('G', 14, ANALOG)>; /* ETH1_TXD1 */
		};
	};

...
...
};

Accessing the peripheral[edit | edit source]

ETRA SOM provides the primary network interface mapped at eth0.

Linux messages at boot time[edit | edit source]

root@desk-mp1:~# dmesg | grep eth
[    1.922023] stm32-dwmac 5800a000.ethernet: IRQ eth_lpi not found
[    1.927733] stm32-dwmac 5800a000.ethernet: User ID: 0x40, Synopsys ID: 0x42
[    1.933692] stm32-dwmac 5800a000.ethernet:   DWMAC4/5
[    1.938567] stm32-dwmac 5800a000.ethernet: DMA HW capability register supported
[    1.945994] stm32-dwmac 5800a000.ethernet: RX Checksum Offload Engine supported
[    1.953305] stm32-dwmac 5800a000.ethernet: TX Checksum insertion supported
[    1.960108] stm32-dwmac 5800a000.ethernet: Wake-Up On Lan supported
[    1.966518] stm32-dwmac 5800a000.ethernet: TSO supported
[    1.971729] stm32-dwmac 5800a000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[    1.979598] stm32-dwmac 5800a000.ethernet: device MAC address 9a:47:f7:21:89:34
[    1.986895] stm32-dwmac 5800a000.ethernet: Enabled L3L4 Flow TC (entries=2)
[    1.993922] stm32-dwmac 5800a000.ethernet: Enabled RFS Flow TC (entries=8)
[    2.000739] stm32-dwmac 5800a000.ethernet: TSO feature enabled
[    2.006616] stm32-dwmac 5800a000.ethernet: Using 32 bits DMA width
[   14.927490] using random self ethernet address
[   14.939533] using random host ethernet address
[   19.442843] stm32-dwmac 5800a000.ethernet eth0: PHY [stmmac-0:00] driver [Micrel KSZ8081 or KSZ8091] (irq=POLL)
[   19.443849] stm32-dwmac 5800a000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0
[   19.453202] stm32-dwmac 5800a000.ethernet eth0: No Safety Features support found
[   19.453248] stm32-dwmac 5800a000.ethernet eth0: IEEE 1588-2008 Advanced Timestamp supported
[   19.455133] stm32-dwmac 5800a000.ethernet eth0: registered PTP clock
[   19.468213] stm32-dwmac 5800a000.ethernet eth0: configuring for phy/rmii link mode
[   22.561014] stm32-dwmac 5800a000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
[   22.561100] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

Cable connection:

...
...
[  222.241453] stm32-dwmac 5800a000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
...
...

Check the interface with ifconfig[edit | edit source]

root@desk-mp1:~# ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.89  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::10c2:6bff:febc:378a  prefixlen 64  scopeid 0x20<link>
        ether 12:c2:6b:bc:37:8a  txqueuelen 1000  (Ethernet)
        RX packets 4409  bytes 489414 (477.9 KiB)
        RX errors 0  dropped 123  overruns 0  frame 0
        TX packets 147  bytes 20171 (19.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 44  base 0xa000

Test with iperf[edit | edit source]

root@desk-mp1:~# iperf3 -t 5 -c 192.168.0.168
Connecting to host 192.168.0.168, port 5201
[  5] local 192.168.0.89 port 47054 connected to 192.168.0.168 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  11.3 MBytes  95.1 Mbits/sec    0    153 KBytes
[  5]   1.00-2.00   sec  11.1 MBytes  92.8 Mbits/sec    0    168 KBytes
[  5]   2.00-3.00   sec  11.3 MBytes  94.9 Mbits/sec    0    239 KBytes
[  5]   3.00-4.00   sec  10.9 MBytes  91.7 Mbits/sec    0    252 KBytes
[  5]   4.00-5.00   sec  11.2 MBytes  94.4 Mbits/sec    0    279 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-5.00   sec  55.9 MBytes  93.8 Mbits/sec    0             sender
[  5]   0.00-5.05   sec  55.2 MBytes  91.8 Mbits/sec                  receiver

iperf Done.