0008 MPS2.5G(SSD and 2.5G ETH):修订间差异

来自Mcuzone Wiki
第247行: 第247行:
http://www.mcuzone.com/wiki/0008_MPS2_5G/0008_MPS2_5G_26.jpg
http://www.mcuzone.com/wiki/0008_MPS2_5G/0008_MPS2_5G_26.jpg


=== 6.5 Use the Raspberry Pi's built-in WiFi as a Client ===
=== 6.5 Use WiFi as a Client ===
This section mainly describes how to use the Raspberry Pi's built-in WiFi as a client, meaning the Raspberry Pi connects to an upstream router via WiFi.
This section mainly describes how to use the Raspberry Pi's built-in WiFi as a client, meaning the Raspberry Pi connects to an upstream router via WiFi.



2024年11月6日 (三) 08:11的版本

切换语言为中文

Keywords

Raspberry Pi 5, PCIe Expansion, 2.5G, NVMe, M.2, SSD, X1 Gen2

I. Introduction

The Raspberry Pi 5 is equipped with a 16-pin PCIe interface, through which we can attach various PCIe devices. This expansion board is specifically designed for the Raspberry Pi 5, offering 2.5G networking and NVMe SSD storage. The expansion board is plug-and-play in the Raspberry Pi system, but the 2.5G network adapter requires driver installation in Ubuntu system.

Note:

1. The latest firmware for the Raspberry Pi now supports booting from an SSD connected to the rear of the PCIe Switch. The SSD can be used for storage expansion and system booting.

2. Since the PCIe Switch is x1 Gen2, changing the mode to Gen3 in config.txt will not increase the interface speed; therefore, the SSD interface speed test will be limited to around 400MB/s, which is slightly faster than CM4.

II. Hardware Spec

1. Based on the PCIe interface of the Raspberry Pi 5, a PCIe Switch is used to expand one port into two, providing one NVMe SSD port and one 2.5G Ethernet port.

2. 2.5Gbps Ethernet based on the RTL8125 chip (if the workload on the 2.5G Ethernet port is high, it is recommended to add a heatsink to the onboard chip).

3. Supports NVMe SSD of 2230/2242/2280 sizes (default comes with welded 2280 copper pillars); does not support SATA and NGFF SSD. The SSD can be used for expanded storage and also supports booting from the SSD (requires the Raspberry Pi official firmware to be at least updated to 2024.5.13). Note: After firmware updates, do not modify the settings, as doing so will automatically revert the firmware to the previous version.

4. The RTL8125 2.5G Ethernet adapter is driver-free in the official Raspberry Pi OS and OpenWrt systems, but requires driver installation in Ubuntu systems.

5. Gold immersion PCB process, lead-free production, certified by UL, compliant with ROHS standards, and has a fire rating of 94V-0.

6. The board has four M2.5 mounting holes, with a recessed design on the top of the board to facilitate the use of the 40-Pin GPIO.

7.size:85*56mm.

0008_MPS2_5G_38.jpg

III. Software Spec

3.1 Overview

This document uses the Raspberry Pi OS, Ubuntu system and OpenWrt system for testing.

1)The version of the Raspberry Pi OS is: 2024-07-04-raspios-bookworm-arm64.img.xz

You can download the Raspberry Pi OS in:

https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-64-bit

2)The version of the Ubuntu system is: ubuntu-24.04-preinstalled-desktop-arm64+raspi.img.xz

You can download the Ubuntu system in:

https://ubuntu.com/download/raspberry-pi

3)The version of the OpenWrt system is: openwrt-bcm27xx-bcm2712-rpi-5-squashfs-sysupgrade-linux-6.1.100-20240805.img.gz

3.2 System flashed onto the SD (TF) card

Click here to read the instructions for System flashing

3.3 System flashed onto the SSD

Click here to read the instructions for System flashing

IV. Work with Raspberry Pi OS

4.1 2.5G Ethernet test

The 2.5G Ethernet port on the MPS2.5G expansion board is plug-and-play under Raspberry Pi OS and can obtain an IP address once the system is up and running:

0008_MPS2_5G_02.jpg

You can also enter ifconfig -a in the terminal to view the network status:

0008_MPS2_5G_03.jpg

Install the network speed testing tool iperf3:

sudo apt install iperf3

0008_MPS2_5G_04.jpg

Use iperf3 to perform a speed test between the Raspberry Pi OS and the PC.

When Raspberry Pi OS acts as a client, the speed is about 2.25 Gbps:

0008_MPS2_5G_05.jpg

When Raspberry Pi OS acts as a server, the speed is about 1.68 Gbps:

0008_MPS2_5G_06.jpg

Note: Network speed tests are affected by network conditions and testing methods. The actual speed may vary; this test is for reference only.

4.2 Set MAC address

The 2.5G Ethernet port uses the RTL8125 network card, and during use, the MAC address is not fixed. Each time the device is powered on again, the MAC address changes randomly. The following explains how to set a fixed MAC address for the RTL8125 network card.

This explanation also applies to the Ubuntu system.

First, check the identification information of the RTL8125 network card in terminal:

ipconfig -a

0015_MP2_5G_28.jpg

Here, the RTL8125 network card is identified as eth1, but in practice, the name recognized by the system might be different.

Then input:

sudo mousepad /etc/systemd/system/macspoof@eth1.service

Or:

sudo nano /etc/systemd/system/macspoof@eth1.service

eth1 is the name recognized by the system for the network card shown above.

Executing the above command will create a new document, then enter the following text:

[Unit]

Description=MAC Address Change %I

Wants=network-pre.target

Before=network-pre.target

BindsTo=sys-subsystem-net-devices-%i.device

After=sys-subsystem-net-devices-%i.device

[Service]

Type=oneshot

ExecStart=/usr/bin/ip link set dev %i address xx:xx:xx:xx:xx:xx

ExecStart=/usr/bin/ip link set dev %i up

[Install]

WantedBy=multi-user.target

Here, "xx:xx:xx:xx:xx:xx" represents the MAC address you wish to assign. You can determine it according to the MAC address format (make sure it does not duplicate the MAC address of other network devices). After setting it, save and exit.

Then execute the following command to enable the service:

sudo systemctl enable macspoof@eth1.service

This completes the fixation of the MAC address for eth1.

After completing all operations, restart the system. Once the system has finished rebooting, execute ipconfig -a to see that the MAC address has been successfully changed.

0015_MP2_5G_29.jpg

4.3 SSD test

For basic operations on the SSD drive, we can refer to the following link:

1. Use the SSD for storage expansion(Raspberry Pi OS)

2. Perform partitioning and other operations on the SSD

3. Adjust the boot devices order

4. Install the SSD speed testing software hdparm

Since the MPS2.5G cannot operate in PCIe Gen3 mode, we do not need to change the PCIe mode and can directly use the hdparm to test the speed.

Run df in the Raspberry Pi terminal to check the partition name of the SSD, which is nvme0n1p1:

0008_MPS2_5G_07.jpg

Excute the command; it can be executed multiple times to test the disk speed repeatedly:

sudo hdparm -t /dev/nvme0n1p1

0008_MPS2_5G_08.jpg

The test shows that the operating speed of this disk is about 395 MBps.

Note: The disk operation speed is affected by various factors including the quality of the disk and the file storage situation on the disk. The above test results are for reference only and do not represent the final parameters of the actual product.

V. Work with Ubuntu OS

5.1 2.5G Ethernet test

In Ubuntu system, the 2.5G network card driver needs to be installed to use the device.

First, you need to update the system:

sudo apt-get update

0008_MPS2_5G_09.jpg

Next, prepare the compilation environment:

sudo apt-get install --reinstall linux-headers-$(uname -r) linux-headers-generic build-essential dkms

0008_MPS2_5G_10.jpg

Then install the driver:

sudo apt-get install r8125-dkms

0008_MPS2_5G_11.jpg

After installation is complete, excute:

sudo modprobe r8125

0008_MPS2_5G_12.jpg

The ifconfig tool is not installed by default in Ubuntu system, so it needs to be installed manually:

sudo apt install net-tools

0008_MPS2_5G_13.jpg

Enter ifconfig -a to see the network interface called enxxx, which indicates that the 2.5G network card driver has been successfully installed:

0008_MPS2_5G_14.jpg

Use iperf3 to perform a speed test between the Ubuntu system and the PC.

When Ubuntu system acts as a client, the speed is about 2.26 Gbps:

0008_MPS2_5G_15.jpg

When Ubuntu system acts as a server, the speed is about 1.70 Gbps:

0008_MPS2_5G_16.jpg

Note: Network speed tests are affected by network conditions and testing methods. The actual speed may vary; this test is for reference only.

5.2 SSD test

For basic operations on the SSD drive, we can refer to the following link. Only the SSD being used as storage expansion having slightly different operations under the Raspberry Pi OS, the rest of the processes are largely the same.

1. Use the SSD for storage expansion(Ubuntu system)

2. Perform partitioning and other operations on the SSD

3. Adjust the boot devices order

4. Install the SSD speed testing software hdparm

Since the MPS2.5G cannot operate in PCIe Gen3 mode, we do not need to change the PCIe mode and can directly use the hdparm to test the speed.

Run df in the terminal to check the partitions' name of the SSD, which are nvme0n1p1 and nvme0n1p2:

0008_MPS2_5G_17.jpg

We select one to perform a speed test:

sudo hdparm -t /dev/nvme0n1p1

Excute the command; it can be executed multiple times to test the disk speed repeatedly:

0008_MPS2_5G_18.jpg

The test shows that the operating speed of this disk is about 430 MBps.

Note: The disk operation speed is affected by various factors including the quality of the disk and the file storage situation on the disk. The above test results are for reference only and do not represent the final parameters of the actual product.

VI. Work with OpenWrt

6.1 Overview

The MPS2.5G expansion board can be configured as a two-in-two-out switch mode under the OpenWrt system. The 2.5G Ethernet port on the expansion board can be used as the WAN port (connected to the Internet), or the built-in WiFi on the Raspberry Pi 5 can be used as the WAN port (connected to the Internet). The Ethernet port on the Raspberry Pi 5 is configured as a LAN port for connecting to a PC, or the built-in WiFi on the Raspberry Pi 5 can be used as a wireless AP to connect devices such as smartphones.

6.2 Preparation

After flashing the OpenWrt system and powering it up, we connect an Ethernet cable from the Raspberry Pi 5's built-in Ethernet port to the PC's Ethernet port, connect the Ethernet cable from the router to the 2.5G Ethernet port on the expansion board.Once the connection between the PC's network card and the Raspberry Pi's Ethernet port is successful, we find Network and Internet settings in Windows, then open the connected network under Ethernet to view the default gateway IP address. This address is the backend configuration page address for the OpenWrt system. As shown in the figure, the address for this test is 192.168.198.1:

2001_CM4_Ultra_53.jpg

Then open a web browser and enter 192.168.198.1 to access the OpenWrt system. The default username is root, and the default password is password:

2001_CM4_Ultra_54.jpg

6.3 PC accesses the internet through the 2.5G Ethernet port.

Open "Network - Interfaces", and click "Add new interface":

0008_MPS2_5G_19.jpg

Set "Name of the new interface" as WAN, choose "DHCP client" for "Protocol of the new interface," select "eth1" for "Cover the following interface," and then click the "SUBMIT" button:

0008_MPS2_5G_20.jpg

In the "Firewall Settings", select the WAN and then click the "SAVE & APPLY" button:

0008_MPS2_5G_21.jpg

Go back to "Network - Interfaces", wait a moment, and you will see the newly created WAN interface has obtained an IP address. This way, the PC can access the internet through the MPS2.5G expansion board:

0008_MPS2_5G_22.jpg

Open https://www.speedtest.cn/ on the PC to test speed. The test results are as follows:

0008_MPS2_5G_39.jpg

Note: The speed test can be affected by the network environment and the testing method. Speeds should be considered based on actual results; this test is for reference only.

6.4 Use WiFi as a wireless AP (in master mode)

By default, the wireless module included with the Raspberry Pi 5 is already configured as a wireless AP, which we can see under "Network - Wireless":

0008_MPS2_5G_24.jpg

Click "Edit", and under "Interface Configuration - Basic Settings", you can see the SSID of this AP:

0008_MPS2_5G_25.jpg

We can use a smartphone to search for this AP, and after connecting to it, we can access the internet (the smartphone connects to the AP created by the Raspberry Pi 5's native wireless network card, the 2.5G Ethernet port acts as the WAN port connected to the upstream router, and the native Gigabit Ethernet port acts as the LAN port connected to the PC):

0008_MPS2_5G_26.jpg

6.5 Use WiFi as a Client

This section mainly describes how to use the Raspberry Pi's built-in WiFi as a client, meaning the Raspberry Pi connects to an upstream router via WiFi.

View the wireless profile under "Network - Wireless":

0008_MPS2_5G_27.jpg

Click the "Scan" button to scan for nearby wireless APs:

0008_MPS2_5G_28.jpg

Select one to connect, and choose WAN for the firewall:

0008_MPS2_5G_29.jpg

Then click "SUBMIT", and after submitting, click "SAVE & APPLY":

0008_MPS2_5G_30.jpg

After succeeding, go back to "Wireless Overview", and you will see that the wireless connection has been established successfully:0008_MPS2_5G_31.jpg

Go back to "Network - Interfaces", and you can see that the newly created WAN interface has obtained an IP address. The PC can connect to the internet through the wireless module and the upstream router:

0008_MPS2_5G_32.jpg

Open https://www.speedtest.cn/ on the PC to test speed. The test results are as follows:

0008_MPS2_5G_40.jpg

Note: The speed test can be affected by the network environment and the testing method. Speeds should be considered based on actual results; this test is for reference only.

6.6 SSD test

Under the OpenWrt system, the MPS2.5G expansion board defaults to the native Gigabit Ethernet port on the Raspberry Pi as the LAN port. We can set the 2.5G Ethernet port on the expansion board as LAN port and use the native Ethernet port on the Raspberry Pi 5 as the WAN port. So we can leverage the 2.5G port for high-speed file transfer within the local network.

Switch the LAN port, and then proceed with the SSD disk testing. Please refer to the following document:

Configuration and Application of the 2.5G Ethernet Port on the MP2.5G

双SSD硬盘存储测试

Contact Us

0001_x.jpg 0002_fb.jpg 0004_ytb.jpg 0003_bb.jpg 0005_qq.jpg QQ:8204136

Email: mcuzone@vip.qq.com

Tel: +86(0)13957118045

If there are any omissions, errors, or infringements on this page, please contact us through the above methods. Thank you!

Copyright 2004-2024 Wildchip