Wiznet makers

viktor

Published December 21, 2023 ©

92 UCC

17 WCC

39 VAR

0 Contests

0 Followers

0 Following

Running IPerf with FreeRTOS and LWIP on WIZnet Pico board

The ultimate guide how to run FreeRTOS, LWIP and Iperf

COMPONENTS Hardware components

WIZnet - W5100S-EVB-Pico

x 1


PROJECT DESCRIPTION

Introduction

This project aims to guide how to run IPerf on WIZnet W5100S-EVB-Pico board using FreeRTOS and LWIP.

How-to

Step 0. Clone repositories

Clone the pico-sdk, pico-examples OR clone my example repository.

Step 1. Porting FreeRTOS

Since there is already a RP2040 port in FreeRTOS kernel, let's use that.

Define FREERTOS_KERNEL_PATH in your environment, then add below line to CMakeLists.txt

include(${FREERTOS_KERNEL_PATH}/portable/ThirdParty/GCC/RP2040/FreeRTOS_Kernel_import.cmake)

Then simply add FreeRTOS-Kernel-Heap4 into target_link_libraries.

Step 2. Porting LWIP and IPERF

Since LWIP is already ported to pico-sdk, to use we just simply add following libraries to target_link_libraries in CMakeLists.txt

pico_lwip_nosys
pico_lwip_iperf

Step 3. Porting WIZnet ioLibrary

Clone the ioLibrary driver into your project.

In my project there are w5x00_lwip.c and its header file which provide several functions to use WIZnet with LWIP.

There is important code tweak that needs to be done. As W5100S will be used in MACRAW mode, we need to allocate the memory to socket 0 as below.

void wizchip_initialize(void)
{
...
   /* W5x00 initialize */
    uint8_t temp;
#if (_WIZCHIP_ == W5100S)
    uint8_t memsize[2][4] = {{8, 0, 0, 0}, {8, 0, 0, 0}}; // For LWIP
    //uint8_t memsize[2][4] = {{2, 2, 2, 2}, {2, 2, 2, 2}};
    ....

The port folder can be found in various WIZnet RP2040 SDKs on Github. It basically provides a communication layer for RP2040 and WIZnet chips.

Step 4. Let's write the code

The example code is pretty straight forward.

In Main we create a iperf_task and start Scheduler.

In iperf_task we initialize the WIZnet chip, LWIP stack and launch IPERF server.

 

The results.

After building the project, copy generated uf2 file to your board and run.

Via serial terminal we can verify that code is running.

Let's check the actual iperf performance

 

Next plan

Using this setup (FreeRTOS and LWIP) we can implement various industrial protocols using the WIZnet W5100S-EVB-Pico board.

Stay tuned for next projects!

Documents
Comments Write