Measuring MicroPython W5300 Network Performance Using iPerf3
Measuring MicroPython W5300 Network Performance Using iPerf3. we will measure the network speed changes according to the MCU clock speed.
How to Use uiperf3 Example
This project is designed to measure network performance using uiperf3 client with Wiznet W5300 Ethernet Controller. It runs the uiperf3 client to measure the network performance.
Step 0: Getting start
Please refer to the 'Getting Started' guide for the basic settings
https://github.com/Wiznet/W5300-TOE-MicroPython/blob/main/static/GettingStart.md
Step 1: Prepare Software
The following serial terminal program is required for uIPerf3 test, download and install from below links.
✔ Thonny
✔ iPerf3
Step 2: Prepare hardware
- Combine WIZnet W5300-TOE Ethernet Shield and NUCLEO STM Board
- Connect ethernet cable to W5300-TOE ethernet port.
- Connect NUCLEO STM Board to desktop or laptop using 5 pin micro USB cable.
Step 3: Setup uIPerf3 Example
To test the uIPerf3 example, minor settings shall be done in code.
download basic code here: https://github.com/Wiznet/W5300-TOE-MicroPython/tree/main/example/uiperf3
- Check COMport in [‘Configure interpreter …] and then open Thonny Python IDE.
- Create a new file by pressing the New File button. Copy the uiperf3.py library code into it. You can access the uiperf3 library code in the following link.
https://github.com/micropython/micropython-lib/blob/master/python-ecosys/iperf3/iperf3.py
If [uiperf3.py], which is officially open on MicroPython, does not work, use the code in lib direcroty.
https://github.com/Wiznet/W5300-TOE-MicroPython/blob/main/example/lib/uiperf3.py
- Import the required packages:
import uiperf3
from wiznet_conf import wiznet5k_w5300
- Initialize the W5300 controller: Set the IP address, subnet mask, gateway, and DNS server:
w5300 = wiznet5k_w5300()
w5300.w5300_set_ip('192.168.11.104','255.255.255.0','192.168.11.1','8.8.8.8')
- Run the uiperf3 client: Set the Server IP address. and Get the results.
uiperf3.client('192.168.11.100')
result = client.run()
Step 4: Upload and Run
- First, run the iperf 3 server. Open a command prompt and enter the following command.
iperf3.exe -s
- Afterwards, run the iPerf3 Client from the NUCLEO STM Board with W5300-TOE.
Performance Measurement Test
This project will conduct a simple test for performance measurement.
##Performance Improvement Options There are several methods that can be considered for performance improvement, including:
- Increasing MCU clock speed
- Improving communication speed
- Using DMA (which may not apply in some cases)
- Improving communication logic
- Please choose the appropriate method depending on the situation and implement it.
##Network Speed Test with Varying MCU Clock Speed In this test, we will measure the network speed changes according to the MCU clock speed.
This project performs performance testing using the Nucleo429ZI board. Note: The MAX main clock is 180. The communication speed is measured by adjusting the main clock, not the SPI.
Configuration To adjust the communication speed, modify the following code in the board/NUCLEO_XXXX/mpconfigboard.h file:
#define MICROPY_HW_CLK_PLLM (8)
#define MICROPY_HW_CLK_PLLN (336)
#define MICROPY_HW_CLK_PLLP (RCC_PLLP_DIV2)
#define MICROPY_HW_CLK_PLLQ (7)
To check if the configured function is applied correctly, add the following code to the port/stm32/main.c file:
printf("\r\n hello f429, sys clock is %d \r\n", HAL_RCC_GetSysClockFreq());
Performance Measurement Now measure the speed by adjusting the MCU clock as follows:
At too low of a clock speed, the speed will not be measured, and there is about a two-fold difference between 90MHz and 180 MHz.
45MHz: Not available
90MHz: 11.5 Mbit/sec
180MHz: 20.6 Mbit/sec
Note: Even if the MCU clock is high, 100% efficiency may not be achieved if it does not match the processing speed of the W5X00 chip.
Below are the specifications of the Nucleo board supported by W5300. Adjust according to the situation.