← Back to list

W5500 DTS overlay and iperf test(Using Raspberry pi 3)

다음 글에서 이어지는 내용이다.

Rena Kim · 2020-12-10 01:10 · 0 claps · 14.7 min read
#w5500 #device-tree #dts-overlay #raspberry-pi #iperf
Open on Medium ↗
Wiki topics: 📟 · Gadgets & IoT

W5500 DTS overlay and Iperf test(Using Raspberry pi 3)

Raspberry Pi 3 기반에서 W5500 dts 파일을 수정 및 적용해보고 Iperf를 사용해 통신 속도를 측정해 보았다.

아래 글에서 이어지는 내용이다.

dts overlay 작성

다음 링크를 참조하여 dts overlay 파일을 작성 및 수정한다.

wget 명령으로 파일을 받아온 뒤 spi-max-frequency와 local-mac-address를 수정해 주었다.

wget 명령을 사용할 때 repository 주소를 사용하면 html 파일이 다운로드되므로, Raw 버튼을 눌렀을 때의 원본 파일 주소를 사용해야 한다.

pi@raspberrypi:~ $ wget https://raw.githubusercontent.com/raspberrypi/linux/rpi-5.4.y/arch/arm/boot/dts/overlays/w5500-overlay.dts
--2020-10-13 07:43:46--  https://raw.githubusercontent.com/raspberrypi/linux/rpi-5.4.y/arch/arm/boot/dts/overlays/w5500-overlay.dts
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.108.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1128 (1.1K) [text/plain]
Saving to: ‘w5500-overlay.dts’
w5500-overlay.dts       100%[============================>]   1.10K  --.-KB/s    in 0s
2020-10-13 07:43:47 (2.92 MB/s) - ‘w5500-overlay.dts’ saved [1128/1128]

w5500 설정 수정

다음과 같이 overlay 설정을 수정했다.

  • spi-max-frequency 수정
  • local-mac-address 적용 (test를 위한 임의의 mac address)
...
eth1: w5500@0{
        compatible = "wiznet,w5500";
        reg = <0>; /* CE0 */
        pinctrl-names = "default";
        pinctrl-0 = <&eth1_pins>;
        interrupt-parent = <&gpio>;
        interrupts = <25 0x8>;
        spi-max-frequency = <40000000>;
        local-mac-address = [00 08 dc a1 b1 c1];
        status = "okay";
};
...

dt overlay 컴파일

dtc 명령을 사용해 dts 파일을 컴파일한다.

기존에 포함된 w5500.dtbo와 구분되도록 파일명을 w5500-mac.dtbo로 설정했다.

warning 메시지는 무시한다.

dtc -I dts -O dtb -o w5500-mac.dtbo w5500-overlay.dts

pi@raspberrypi:~ $ dtc -I dts -O dtb -o w5500-mac.dtbo w5500-overlay.dts
w5500-mac.dtbo: Warning (unit_address_vs_reg): /fragment@1: node has a unit name, but no reg property

dt overlay 적용

컴파일한 dtbo 파일을 복사하고 config.txt에서 설정을 적용한다.

dtbo 파일 복사

pi@raspberrypi:~ $ sudo cp w5500-mac.dtbo /boot/overlays/

config.txt 수정

기존 설정을 주석처리하고, dtoverlay=w5500-mac 설정을 추가한다.

$ sudo vi /boot/config.txt
# W5500
#dtoverlay=w5500
dtoverlay=w5500-mac

설정을 적용하기 위해 reboot 한다.

sudo reboot

Static IP 설정

원활한 테스트를 위해 고정 IP를 설정해 준다.

이전에는 /etc/network/interfaces 파일에 설정을 추가했었는데 최근 /etc/dhcpcd.conf 파일을 사용하는 것으로 변경된 것 같다.

Previous versions of Raspberry Pi OS used the file /etc/network/interfaces for network interface configuration: if an interface is listed in this file, any settings there will take precedence over what is in /etc/dhcpcd.conf.

아래 링크 참조:

인터페이스 설정

  • /etc/network/interfaces 파일에 설정했던 내용이 있다면, 제거
  • /etc/dhcpcd.conf 설정

다음과 같이 IPv4 ip, router (gateway), dns 서버 주소를 설정했다.

$ sudo vi /etc/dhcpcd.conf
// 아래 라인 추가
...
interface eth1
static ip_address=192.168.50.91/24
static routers=192.168.50.1
static domain_name_servers=168.126.63.1 168.126.63.2

dt overlay에 설정한 대로 eth1이 생성되었는지 확인한다.

pi@raspberrypi:~$ ifconfig
eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether b8:27:eb:98:f7:1e  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.50.91  netmask 255.255.255.0  broadcast 192.168.50.255
        inet6 fe80::706:b70:603a:5f59  prefixlen 64  scopeid 0x20<link>
        ether 00:08:dc:a1:b1:c1  txqueuelen 1000  (Ethernet)
        RX packets 1312  bytes 186033 (181.6 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 915  bytes 66810 (65.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

RPI에서 현재 적용된 device tree 확인

다음 명령을 사용해 현재 RPI에서 적용된 device tree 내용을 확인해볼 수 있다. 파라미터는 hex로 표시된다.

$ dtc -I fs /proc/device-tree

...
...
spi@7e204000 {
        compatible = "brcm,bcm2835-spi";
        clocks = < 0x07 0x14 >;
        status = "okay";
        #address-cells = < 0x01 >;
        interrupts = < 0x02 0x16 >;
        cs-gpios = < 0x10 0x08 0x01 0x10 0x07 0x01 >;
        #size-cells = < 0x00 >;
        dma-names = "tx\0rx";
        phandle = < 0x28 >;
        reg = < 0x7e204000 0x200 >;
        pinctrl-0 = < 0x0e 0x0f >;
        dmas = < 0x0b 0x06 0x0b 0x07 >;
        pinctrl-names = "default";
        w5500@0 {
                compatible = "wiznet,w5500";
                local-mac-address = [ 00 08 dc a1 b1 c1 ];
                status = "okay";
                interrupt-parent = < 0x10 >;
                interrupts = < 0x19 0x08 >;
                phandle = < 0x87 >;
                reg = < 0x00 >;
                pinctrl-0 = < 0x86 >;
                spi-max-frequency = < 0x2625a00 >;
                pinctrl-names = "default";
        };
        spidev@1 {
                compatible = "spidev";
                #address-cells = < 0x01 >;
                #size-cells = < 0x00 >;
                phandle = < 0x68 >;
                reg = < 0x01 >;
                spi-max-frequency = < 0x7735940 >;
        };
        spidev@0 {
                compatible = "spidev";
                status = "disabled";
                #address-cells = < 0x01 >;
                #size-cells = < 0x00 >;
                phandle = < 0x67 >;
                reg = < 0x00 >;
                spi-max-frequency = < 0x7735940 >;
        };
};
...
...

iperf를 사용하여 통신속도 테스트

Iperf Test

  • Test command
  • Server: iperf3 -s
  • Client: iperf3 -c 192.168.50.80 -w 300k -t 600 -i 30

Test 1

  • Server: Raspberry Pi 3
  • Client: Windows PC

Client-side(Windows PC) log

D:\>iperf3 -c 192.168.50.91 -w 300k -t 600 -i 30
Connecting to host 192.168.50.91, port 5201
[  4] local 192.168.50.80 port 8175 connected to 192.168.50.91 port 5201
[ ID] Interval           Transfer     Bandwidth
[  4]   0.00-30.00  sec  30.1 MBytes  8.42 Mbits/sec
[  4]  30.00-60.00  sec  29.8 MBytes  8.32 Mbits/sec
[  4]  60.00-90.00  sec  29.6 MBytes  8.28 Mbits/sec
[  4]  90.00-120.00 sec  28.9 MBytes  8.07 Mbits/sec
[  4] 120.00-150.00 sec  29.8 MBytes  8.32 Mbits/sec
[  4] 150.00-180.00 sec  28.9 MBytes  8.07 Mbits/sec
[  4] 180.00-210.00 sec  29.5 MBytes  8.25 Mbits/sec
[  4] 210.00-240.00 sec  29.0 MBytes  8.11 Mbits/sec
[  4] 240.00-270.00 sec  29.8 MBytes  8.32 Mbits/sec
[  4] 270.00-300.00 sec  29.8 MBytes  8.32 Mbits/sec
[  4] 300.00-330.00 sec  29.8 MBytes  8.32 Mbits/sec
[  4] 330.00-360.00 sec  29.8 MBytes  8.32 Mbits/sec
[  4] 360.00-390.00 sec  28.9 MBytes  8.07 Mbits/sec
[  4] 390.00-420.00 sec  29.4 MBytes  8.21 Mbits/sec
[  4] 420.00-450.00 sec  29.8 MBytes  8.32 Mbits/sec
[  4] 450.00-480.00 sec  28.9 MBytes  8.07 Mbits/sec
[  4] 480.00-510.00 sec  28.9 MBytes  8.07 Mbits/sec
[  4] 510.00-540.00 sec  28.5 MBytes  7.97 Mbits/sec
[  4] 540.00-570.00 sec  28.5 MBytes  7.97 Mbits/sec
[  4] 570.00-600.00 sec  29.6 MBytes  8.28 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth
[  4]   0.00-600.00 sec   587 MBytes  8.21 Mbits/sec                  sender
[  4]   0.00-600.00 sec   587 MBytes  8.20 Mbits/sec                  receiver
iperf Done.

Test 2

  • Server: Windows PC
  • Client: Raspberry Pi 3

Client-side(RPI3) log

pi@raspberrypi:~ $ iperf3 -c 192.168.50.80 -w 300k -t 600 -i 30
Connecting to host 192.168.50.80, port 5201
[  5] local 192.168.50.91 port 33162 connected to 192.168.50.80 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-30.00  sec  29.2 MBytes  8.16 Mbits/sec    0   48.5 KBytes
[  5]  30.00-60.00  sec  28.8 MBytes  8.05 Mbits/sec    0   48.5 KBytes
[  5]  60.00-90.00  sec  28.8 MBytes  8.05 Mbits/sec    0   48.5 KBytes
[  5]  90.00-120.00 sec  28.8 MBytes  8.05 Mbits/sec    0   48.5 KBytes
[  5] 120.00-150.00 sec  28.8 MBytes  8.05 Mbits/sec    0   48.5 KBytes
[  5] 150.00-180.00 sec  28.2 MBytes  7.88 Mbits/sec    0   48.5 KBytes
[  5] 180.00-210.00 sec  28.1 MBytes  7.85 Mbits/sec    0   48.5 KBytes
[  5] 210.00-240.00 sec  28.1 MBytes  7.85 Mbits/sec    0   48.5 KBytes
[  5] 240.00-270.00 sec  28.1 MBytes  7.85 Mbits/sec    0   48.5 KBytes
[  5] 270.00-300.00 sec  28.2 MBytes  7.88 Mbits/sec    0   48.5 KBytes
[  5] 300.00-330.00 sec  28.2 MBytes  7.88 Mbits/sec    0   48.5 KBytes
[  5] 330.00-360.00 sec  28.5 MBytes  7.98 Mbits/sec    0   48.5 KBytes
[  5] 360.00-390.00 sec  28.5 MBytes  7.98 Mbits/sec    0   48.5 KBytes
[  5] 390.00-420.00 sec  28.5 MBytes  7.98 Mbits/sec    0   48.5 KBytes
[  5] 420.00-450.00 sec  28.4 MBytes  7.95 Mbits/sec    0   48.5 KBytes
[  5] 450.00-480.00 sec  28.5 MBytes  7.98 Mbits/sec    0   48.5 KBytes
[  5] 480.00-510.00 sec  28.3 MBytes  7.91 Mbits/sec    0   48.5 KBytes
[  5] 510.00-540.00 sec  28.1 MBytes  7.85 Mbits/sec    0   48.5 KBytes
[  5] 540.00-570.00 sec  28.1 MBytes  7.85 Mbits/sec    0   48.5 KBytes
[  5] 570.00-600.00 sec  28.2 MBytes  7.88 Mbits/sec    0   48.5 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-600.00 sec   568 MBytes  7.95 Mbits/sec    0             sender
[  5]   0.00-600.00 sec   568 MBytes  7.94 Mbits/sec                  receiver
iperf Done.


메타데이터
post_id
d47a1861cefb
slug
w5500-dts-overlay-and-iperf-test-using-raspberry-pi-3-d47a1861cefb
url
https://medium.com/@rena0725/w5500-dts-overlay-and-iperf-test-using-raspberry-pi-3-d47a1861cefb
canonical_url
https://medium.com/@rena0725/w5500-dts-overlay-and-iperf-test-using-raspberry-pi-3-d47a1861cefb
author_url
https://medium.com/@rena0725
status
ok
fetched_at
2026-07-28 16:25:28