0001 MPRG4(Designed based on Raspberry Pi 5 PCIe):修订间差异

来自Mcuzone Wiki
(没有差异)

2024年8月28日 (三) 08:50的版本

切换语言为中文

Keywords:

Raspberry Pi 5  MPRG4 Quad-Gigabit Ethernet Expansion Board  Pi OS  Ubuntu  OpenWrt  software router  switch

Ⅰ、Introduction

The MPRG4 (also known as MPG4) is a Quad-Gigabit Ethernet expansion board designed specifically for the Raspberry Pi 5, utilizing the PCIe interface. This expansion board connects the RTL8111H PCIe Ethernet controller via the PCIe interface, and then extends into four Gigabit Ethernet ports through a switch chip. It can be used in the following scenarios:

1. In Raspberry Pi or Ubuntu system, one network port connected to the upstream router, and the remaining three network ports providing network access to other nearby devices (all four network ports should be in the same subnet), it can save an additional external switch and power supply.

2. In OpenWrt software router system, configure the native gigabit port as the WAN port, and the four extended ports as LAN ports, providing network access for up to four devices.

Note1: Four gigabit ports are located on the same subnet, with the upstream router assigning the address pool. If the upstream router is not connected, Raspberry Pi or Ubuntu system will be unable to obtain a valid IP address (they will receive an IP address in the range of 169.254.xx.xx, indicating that there is only a physical connection but no valid IP address).

Note2: In the Raspberry Pi or Ubuntu system, if the network cable is not plugged in at startup, the system will obtain an IP address like 169.254.xx.xx after a while. At this time, even if you plug in a network cable from an upstream router, the system will not obtain a valid IP address. You need to press the reset button on the expansion board's switch to acquire a valid IP address again.

Ⅱ、Hardware Resources

1. It connected via a 16-pin 0.5mm FPC to Raspberry Pi 5.

2. Onboard RTL8111H chip, enabling PCIe to Gigabit Ethernet.

3. Onboard switch chip, it extends the RTL8111H network port to four ports, each one with a unique IP address, but all of them in the same subnet.

4. A power indicator light.

5. A switch reset button (Switch RST), suitable for Raspberry Pi or Ubuntu system, if the system not obtaining a valid IP address after plugging in the network cable some time after booting, you can press this button to reset.

6. Optional 3D-printed base to protect your desk from scratches.

7. Optional metal housing, aesthetically pleasing and reliable.

8. Optional extension power button for Raspberry Pi 5 (Raspberry Pi 5 cotians a power button, with additional reserved pinholes for extension power buttons).

9. Board size: about 86mm*75mm.

MPRG4_31.jpg

A 4G module can be installed on top of the Raspberry Pi 5 to set up a 4G router. The 4G module is an optional module.

Note: Four network ports cannot be used to connect to upstream routing devices in different network segments, it can not achieve such as multi-carrier aggregation with connections both from China Telecom and China Unicom. It also can not achieve to prevents bridge applications with one port connects to the Internet and another to an internal network.

Ⅲ、Demonstration of Using the Raspberry Pi System

1. Please connect the FPC cable first. The driver is already integrated in the Raspberry Pi system and can be used directly.

Note: If using a dedicatedPCIe cable, the side marked 'Raspberry Pi 5' should be facing up.

2. Please flash the Raspberry Pi system as needed, supporting both 32-bit and 64-bit systems. Since the PCIe interface is occupied, it can be booted from a TF card.

3. After the system starts, execute ifconfig -a, and you will see an eth1 device, which is the extended RTL8111H network card.

MPRG4_02.jpg

4. Connect the PC to any of the four network ports. Run iperf3 on both the Raspberry Pi and the PC to measure the speed. It can run the full speed.

Download iperf3(Windows version):

http://www.mcuzone.com/down/Software.asp?ID=10000634

Install iperf3 on Linux:

sudo apt-get install iperf3


MPRG4_03.jpg


The iperf3 test between the four network ports can also run at full speed.

Note1: The four-port switch is a physical layer device, and is not visible in the system.

Note2:If there is no network cable plugged into the upstream router before booting up, even if you plug the cable later, you won't be able to access the network (IP address will be obtained an IP address as 169.254.xx.xx). You need to press the reset button on the switch (marked as Switch RST).

Ⅳ、Demonstration of Using the Ubuntu System

Note: On the Ubuntu systems, installing the RTL8111H driver is necessary. It's crucial to match the driver version with the system version. If there are issues compiling the driver, you can contact us for a pre-configured driver image.

The driver compilation process is as follows:

Download driver package on the official website:

https://www.realtek.com/Download/List?cate_id=584  Find the driver package and download to you computer.


MPRG4_04.jpg


Official website's latest driver package is not compatible with Ubuntu 23.10 system. If installation fails, please use our current driver package:

http://www.mcuzone.com/wiki/0001_MPRG4/r8168-8.052.01.tar.bz2

Load and validate driver (on Ubuntu23.10):

After downloading the driver, use tools such as SSH to transfer the compressed package to the Ubuntu system. Then you can follow these steps to install the driver:

1. Update system and header files:

sudo apt-get update

sudo apt-get upgrade

Theoretically, there's no need to update the header files separately. Unlike Pi OS, on Ubuntu, the header files are updated together during an upgrade.

If there are issues with header files later, use the following command to check the header files:

sudo apt-get install linux-headers-$(uname -r)

2. Preparing the build environment:

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

3. Extract the corresponding source code to /usr/src:

sudo tar xvf r8168-8.052.01.tar.bz2 -C /usr/src

4.Add a file named dkms.conf:

Add a file "dkms.conf" to /usr/src/r8168-8.052.01/dkms.conf, the content is as follows:

PACKAGE_NAME=Realtek_r8168

PACKAGE_VERSION=8.052.01

DEST_MODULE_LOCATION=/updates/dkms

BUILT_MODULE_NAME=r8168

BUILT_MODULE_LOCATION=src/

MAKE="'make' -C src/ all"

CLEAN="'make' -C src/ clean"

AUTOINSTALL="yes"

Note:Please create this file on the Ubuntu system. If the file is created on Windows and directly copied to the Ubuntu system, there will be character format issues, which may cause compilation to fail.

5. Compile DKMS:

sudo dkms add -m r8168 -v 8.052.01

sudo dkms build -m r8168 -v 8.052.01

sudo dkms install -m r8168 -v 8.052.01

sudo depmod -a

sudo modprobe r8168

If there is a character format issue in dkms.conf, it will result in a compilation error when executing add. Even after correcting dkms.conf, if execute the add command still reports Error! DKMS tree already contains, please execute the following commands, and then retry add command:

sudo rm -r /var/lib/dkms/8812au

If display binary update-secureboot-policy not found error during build, please execute the following command, and then retry the build:

apt-get install shim-signed

Load and validate driver (on Ubuntu24.04):

On Ubuntu 24.04, you can directly download driver source code and compile it. The steps are as follows:

Preparing the build environment:

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

Download and compile driver:

sudo apt install r8168-dkms

sudo modprobe r8168

Note: If you follow the steps for Ubuntu 23.10 as above, it will display ERROR (dkms apport) during the build process, and the compiling will be failed.

6. Verify the installation result:

Run the following command to view the wired network interface which is named enxxx:

ifconfig -a

MPRG4_05.png

Using iperf3 for speed testing, it can be run on gigabit speed.

MPRG4_06.png

Note: On an Ubuntu system, the RTL8111H network card is recognized with a name like enxxxx, while the same switch used as a physical layer chip does not appear in the network card list.

Ⅴ、Demonstration of operating the MPRG4 expansion board on the OpenWrt system

Overview:

The MPRG4 expansion board can be configured in OpenWrt system as a switch with one input and four outputs. The network port of the Raspberry Pi is configured as the WAN port, and the four ports on the expansion board can be used by other devices to obtain IP addresses in the same subnet.

Preparation:

System version: openwrt-bcm27xx-bcm2712-rpi-5-squashfs-sysupgrade-linux-6.1.92-20240530a.img.gz

After flashing the OpenWrt system and powering it on, connect the Raspberry Pi's built-in network port to the PC's network port with an Ethernet cable. Then open a web browser and enter 192.168.198.1 to access the OpenWrt system.

Default username isroot, Default password ispassword.

MPRG4_17.png

You can view the IP address of the connected network by opening the network in the "Network & Internet - Ethernet" settings in Windows.

MPRG4_18.png

Using terminal software (such as SecureCRT) on the computer to connect to the development board, you can see the device being recognized:

MPRG4_21.png

MPRG4_22.png

SecureCRT can be configured as follows:

MPRG4_19.png

MPRG4_20.png

Configure the OpenWrt system:

After the device is properly recognized, we open the "network - interface".

MPRG4_23.png

Then we click to add a new interface, set the name and interface protocol, and set the WAN port to eth0.

MPRG4_24.png

Click "Submit" and then select "WAN" in the firewall settings.

MPRG4_25.png

After setting it complete, click "Save". Be careful, do not click "Save & Apply", or you will not be able to enter the system.

Click "Back" to return to the overview, then click on LAN port modification.

MPRG4_26.png

Set the interface to eth1 in the "Physical Settings".

MPRG4_27.png

After setting up, we click "Save & Apply". Please note that since the network settings are being changed, it will continuously display "Applying changes". This is not a malfunction, and after waiting for a while, we can proceed to the next step.

MPRG4_28.png

Network test:

Connect the WAN port to the upstream router. The four LAN ports on the expansion board can then connect to other network devices to access the network. We'll connect two of the LAN ports to two PCs to simply test the network bandwidth.

Using iperf3 to test between two computers shows that the test results are normal.

MPRG4_29.png

MPRG4_30.png

Ⅵ、Radxa Rock 5C (RK3588S2) with Quad-Gigabit Ethernet Expansion Board MPRG4 Operation Demonstration

Overview:

The Radxa Rock 5C is designed based on the RK3588S2, it have one gigabit ethernet port and four USB ports, along with a PCIe interface compatible with the Raspberry Pi 5. This interface allows us to expand with various PCIe extension boards originally designed for the Raspberry Pi 5. In this demonstration, we are using a four-network-port expansion board.

The software and hardware platform used in this demonstration:

System version: debian bullseye kde b3, you can download it on github:

https://github.com/radxa-build/rock-5c/releases/

Expansion Board: MPRG4 Expansion Board with four ethernet ports.

MPRG4_09.png

MPRG4_10.png

Preparation

1. Connect the Rock 5C and the MPRG4.

2. Flashing the system to the TF card and inserting the card to boot, the default account login password is radxa.

2. Entering the system, find Konsole in the menu to access the terminal.

3. Execute lspci to ensure that the device information for RTL8111 is visible (if visible, it indicates that the expansion board hardware is functioning correctly; if not visible, check the reliability of the FPC connection. Note that the FPC cable has an orientation, and one side marked with RPi5 should be connected to Rock 5C).

MPRG4_15.png

4. Connect the network cable to the native gigabit port, then execute:

sudo apt-get update

sudo apt-get upgrade

sudo apt-get install net-tools

You can use the ifconfig after installing net-tools. Of course, you can also use other tools to operate the network.

MPRG4_11.png

Install drivers

1. Using DKMS to install the drivers.

sudo apt-get install r8168-dkms

sudo modprobe r8168

2. After installing the drivers, execute sudo ifconfig -a to check for network cards starting with 'enp', which indicates the RTL8111 network card. Note that the switch is a physical layer device and cannot be seen with ifconfig.

MPRG4_16.png

3. Confirm network connectivity by using ping packets:

MPRG4_13.png

Now, the network card drivers has been successfully installed and is functioning normally.

4. Using iperf3 for speed testing, it can be run on gigabit speed.

MPRG4_14.png

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