Wiznet makers

ronpang

Published September 01, 2025 © Apache License 2.0 (Apache-2.0)

132 UCC

77 WCC

32 VAR

0 Contests

1 Followers

0 Following

Hardwired TCP/IP Chapter 28: W55MH32 Ethernet_Rate_Test Example

Hardwired TCP/IP Chapter 28: W55MH32 Ethernet_Rate_Test Example

COMPONENTS
PROJECT DESCRIPTION

Hardwired TCP/IP Chapter 28: W55MH32 Ethernet_Rate_Test Example

In this article, we will provide a detailed explanation on how to implement the network speed measurement function on the W55MH32 chip. Through practical examples, we will also explain to you how to perform speed measurement using the Jperf tool.

Other network protocols used in this example, such as DHCP, please refer to the relevant sections. Regarding the initialization process of the W55MH32 chip, please refer to the "Network Installation" chapter. We will not elaborate on this here.

1 Jperf Introduction

JPerf is a Java-based graphical network performance testing tool. It is the graphical user interface (GUI) version of Iperf (a commonly used network performance testing tool). Iperf is a popular open-source tool widely used for testing performance indicators such as network bandwidth, latency, and packet loss. JPerf, on the other hand, enables users to conduct these tests more conveniently through a graphical interface, without the need for command-line operations.

2 Jperf Features

  • Graphical interface: JPerf provides an intuitive user interface, simplifying the configuration and operation of Iperf, enabling users to conduct network performance tests more easily.
  • Support for multiple protocols: JPerf supports TCP and UDP protocols, allowing users to select different protocols during the test to simulate different types of network loads.
  • Real-time performance monitoring: JPerf can display real-time network performance data (such as bandwidth, packet loss rate, latency, etc.), helping users analyze network conditions.
  • Easy configuration: Users can easily configure test parameters through the graphical interface, such as test duration, data transmission volume, data packet size, etc.
  • Cross-platform: As a Java application, JPerf can run on multiple operating system platforms, including Windows, Linux, and macOS.

3 Several reasons affecting the rate

  • MCU main frequency
  • Socket cache size
  • Single transmission data length
  • Ethernet differential line wiring

4 Ethernet speed testing process

  1. Install Jperf

Download location

https://nchc.dl.sourceforge.net/project/iperf/jperf/jperf%202.0.0/jperf-2.0.0.zip?viasf=1

  1. Install Jre

Download locationJava Archive Downloads - Java SE 8u211 and later | Oracle 

  1. Open the graphical interface of jperf

Note: The graphical interface can only be opened with the installation of Jre.

The jperf.bat file is located in the installation directory of Jperf:

  1. Configure the working mode and unit range:

  1. Start measuring the speed of the data sent by the opposite end.

5 The implementation process

Next, we implement the Ethernet speed testing function on the W55MH32.

Note: The test instance requires that the PC and the W55MH32 be in the same network segment.

Step 1: Fill in the test data

 1. for (uint16_t i = 0; i < ETHERNET_BUF_MAX_SIZE; i++)
 2.     {
 3.         ethernet_buf[i] = 65 + i % 26;
 4.     }

Step 2: Initialize socket cache

1. uint8_t  tx_size[_WIZCHIP_SOCK_NUM_]         = {2, 0, 0, 0, 0, 0, 0, 0};
2. uint8_t  rx_size[_WIZCHIP_SOCK_NUM_]         = {2, 0, 0, 0, 0, 0, 0, 0};
3.     /* Set socket0 send and receive cache to 16KB */
4.     wizchip_init(tx_size, rx_size);

Step 3: The main loop calls the do_jperf() function to conduct the speed test.

The do_jperf() function is as follows:

 1. void do_jperf(uint8_t sn, uint8_t *buffer_txst, uint8_t *des_ip, uint16_t des_port)
 2. {
 3.     uint32_t len;
 4.     uint16_t port = 50000;
 5.     switch (getSn_SR(sn))
 6.     {
 7.     case SOCK_INIT:
 8.         connect(sn, des_ip, des_port);
 9.         printf("%d:Try to connect to the %d.%d.%d.%d : %d\r\n", sn, des_ip[0], des_ip[1], des_ip[2], des_ip[3], des_port);
10.         break;
11.     case SOCK_ESTABLISHED:
12.         if (getSn_IR(sn) & Sn_IR_CON) //// Socket n interrupt register mask; TCP CON interrupt = connection with peer is successful
13.         {
14.             setSn_IR(sn, Sn_IR_CON);  // this interrupt should be write the bit cleared to '1'
15.             printf("%d:Connected to - %d.%d.%d.%d : %d\r\n", sn, des_ip[0], des_ip[1], des_ip[2], des_ip[3], des_port);
16.         }
17.         send(sn, buffer_txst, strlen((char *)buffer_txst)); // Data send process (User's buffer -> Destination through H/W Tx socket buffer)
18.         len = getSn_RX_RSR(sn);
19.  
20.         if (len >= sizeof(buffer_txst)) // Sn_RX_RSR: Socket n Received Size Register, Receiving data length
21.         {
22.             recv(sn, buffer_txst, len); // Data Receive process (H/W Rx socket buffer -> User's buffer)
23.             send(0, buffer_txst, len);
24.         }
25.         else if (len > 0)
26.         {
27.             len = recv(sn, buffer_txst, len);
28.             send(sn, buffer_txst, len);
29.         }
30.  
31.         break;
32.     case SOCK_CLOSE_WAIT:
33.         disconnect(sn);
34.         break;
35.     case SOCK_CLOSED:
36.         socket(sn, Sn_MR_TCP, port++, Sn_MR_ND);
37.         if (port > 60000)
38.         {
39.             port = 50000;
40.         }
41.         break;
42.     }
43. }

The do_jperf() function creates a TCP client with no latency mode. Once it successfully connects to the server, it continuously sends data.

6 Run results

After the burning routine was executed, it first conducted a PHY link detection, then printed the network address information, and finally, when not connected to the server, continuously printed prompt messages until it was connected to the server set up:

Next, let's examine the impact of different clock frequencies, socket cache sizes, and single transmission data volume on the rate:

Clock frequency: 216 MHz

Socket receive and transmit cache: 16 KB

Single data volume: 2048 Byte

Test rate: 6.55 Mbits/s

Clock frequency: 216 MHz

Socket receive and transmit cache: 2 KB

Single data transfer: 2048 Byte

Test rate: 5.44 Mbits/s

Clock frequency: 216 MHz

Socket receive and transmit cache: 16 KB

Single data size: 512 Byte

Test rate: 6.03 Mbits/s

Clock frequency: 72 MHz

Socket receive and transmit cache: 16 KB

Single data transfer: 2048 Byte

Test rate: 4.34 Mbits/s

 

7 Summary

This article explains how to implement the Ethernet speed measurement function on the W55MH32 chip. Through practical examples, it demonstrates the specific process of measuring speed using the Jperf tool, including filling the measurement data, initializing the socket cache, and calling functions in the main loop for testing, etc. The article details the concept and characteristics of Jperf, as well as the factors affecting the Ethernet rate and the measurement process, helping readers understand its practical application value in network performance testing.

The next article will focus on implementing the Modbus TCP protocol on the W55MH32 chip, analyzing the core principles of the Modbus TCP protocol and its application in industrial communication. At the same time, it will explain through practical examples how to build a Modbus TCP server on the W55MH32 chip and achieve communication with the client. Stay tuned! 

 

WIZnet is a non-fabrication semiconductor company founded in 1998. Its products include the Internet processor iMCU™, which adopts TOE (TCP/IP Offloading Engine) technology and is based on a unique patented fully hardwired TCP/IP. iMCU™ is designed for embedded Internet devices in various applications.

WIZnet has over 70 distributors worldwide, with offices in Hong Kong, South Korea, and the United States, providing technical support and product marketing.

The region managed by the Hong Kong office includes: Australia, India, Turkey, and Asia (excluding South Korea and Japan).

Documents
Comments Write