Wiznet makers

ronpang

Published June 15, 2026 ©

193 UCC

98 WCC

35 VAR

0 Contests

1 Followers

0 Following

W55RP20-EVB-MKR Module MicroPython Practice (2) - 10 Minutes to Ethernet DHCP Automatic Networking

This article is the 2nd part of the WIZnet W55RP20 chip MicroPython tutorial, written based on the latest official firmware.

COMPONENTS
PROJECT DESCRIPTION

W55RP20-EVB-MKR Module MicroPython Practice (2) - 10 Minutes to Ethernet DHCP Automatic Networking

This article is the 2nd part of the WIZnet W55RP20 chip MicroPython tutorial, written based on the latest official firmware. All code has been verified in practice and can be directly flashed and run. Copyright Notice: This article is an original technical article from WIZnet. Please indicate the source when reprinting.


Preface

In the previous article, we completed W55RP20 Chip Static IP Configuration and Network Basics, and understood the meanings of basic network parameters such as IP address, subnet mask, gateway, and DNS.

This article continues to focus on the Ethernet networking methods of the W55RP20 chip, with emphasis on DHCP automatic IP address acquisition.

In practical projects, manually configuring static IP addresses each time can easily lead to issues such as inconsistent network segments, IP address conflicts, and incorrect gateway entries. DHCP allows the development board to automatically obtain network parameters from the router, reducing configuration difficulty and making it more suitable for quick verification of the development board's Ethernet functionality.

The W55RP20-EVB-MKR Development Board already has an onboard Ethernet interface. Combined with the MicroPython example project, you only need to run a simple DHCP example code to enable the development board to automatically obtain an IP address.

After reading this article, you will master:

The difference between static IP and DHCP

The basic flow of DHCP automatic networking

How to view MAC address and IP address information

How to determine whether DHCP acquisition was successful

Troubleshooting methods for common networking failure issues


Series Tutorial Learning Path

This series consists of 16 articles, progressively covering the full process from basic networking to industrial-grade applications:

Part 1: Static IP Configuration and Network Basics

Part 2: DHCP Automatic Networking and Network Diagnostics (This Article)

Part 3: TCP Client Communication

Part 4: TCP Server Communication

Part 5: UDP Unicast Data Communication

Part 6: UDP Multicast/Broadcast Data Communication

Part 7: DNS Domain Name Resolution

Part 8: NTP - Getting Time from the Network

Part 9: HTTP Client Requests

Part 10: HTTP Server Setup

Part 11: HTTP Protocol and OneNET Platform Data Cloud Upload

Part 12: MQTT Protocol Basic Communication Verification

Part 13: MQTT Protocol and Alibaba Cloud Platform Integration

Part 14: MQTT Protocol and OneNET Platform Integration

Part 15: MQTT Protocol and ThingSpeak Platform Integration

Part 16: Modbus Industrial Protocol Communication

It is recommended to bookmark this series and follow the tutorials step by step. All code will be synced and updated to the official Gitee repository.


Table of Contents

1 Preparation

1.1 Software Preparation

1.2 Hardware Preparation

2 Flashing W55RP20 Exclusive MicroPython Firmware

3 Hardware Connection and Development Environment Configuration

3.1 Hardware Connection

3.2 Thonny Development Environment Configuration

4 DHCP Automatic Networking Principles

4.1 DHCP Protocol Introduction

4.2 DHCP Workflow

5 Core Code Analysis

5.1 Complete Code

5.2 Extension: Static IP Configuration

6 Running Results and Network Verification

6.1 Serial Output Result Screenshots

6.2 DHCP Automatic Networking GIF Demonstration

7 Common Issues One-Stop Troubleshooting Guide

7.1 Flashing-Related Issues

7.2 Port Identification Issues

7.3 Network Connection Issues

8 W55RP20 Core Advantages Comparison

9 Typical Application Scenarios

Article Summary

10 Series Preview and Resource Access

10.1 Series Preview

10.2 Resource Access


1. Preparation

1.1 Software Preparation

Software NameVersion RequirementDownload URLDescription
Thonny4.0 and aboveThonny Official DownloadLightweight MicroPython IDE, supports code editing, running, and serial debugging
W55RP20 MicroPython FirmwareLatest stable versionWIZnet Official Firmware DownloadMicroPython firmware specifically written for W55RP20

1.2 Hardware Preparation

As shown in the figure, the W55RP20-EVB-MKR development board physical photo.

在这里插入图片描述

The following hardware needs to be prepared:

W55RP20-EVB-MKR development board × 1;

USB data cable × 1;

Standard Ethernet cable × 1;

Router or switch with DHCP function enabled × 1.

Tip: The W55RP20-EVB-MKR already has an onboard Ethernet interface, no additional soldering or flying wires to other components required, plug and play. This significantly reduces the probability of wiring errors and hardware failures.


2. Flashing W55RP20 Exclusive MicroPython Firmware

The W55RP20-EVB-MKR development board is compatible with the Raspberry Pi Pico UF2 firmware flashing method. The operation steps are as follows:

Use a USB data cable to connect the development board and the computer;

Press and hold the BOOTSEL button on the development board;

Press the RUN button once;

Release the buttons after the computer recognizes the RPI-RP2 disk;

Drag the .uf2 firmware file into the RPI-RP2 disk;

The development board automatically restarts, and firmware flashing is complete.

Note: If the computer does not recognize the RPI-RP2 USB drive, please try replacing the USB data cable, re-plugging the development board, or changing the computer USB port

3. Hardware Connection and Development Environment Configuration

3.1 Hardware Connection

 

The connection of W55RP20-EVB-MKR is extremely simple, requiring only two steps:

Use a USB data cable to connect the development board to the computer (for power supply, code flashing, and serial debugging)

Use an Ethernet cable to connect the development board's Ethernet interface to the router's LAN port

As shown in the figure, this is the hardware connection diagram.

在这里插入图片描述

3.2 Thonny Development Environment Configuration

Open Thonny software, click the top menu bar "Run" → "Configure Interpreter"

Switch to the "Interpreter" tab

Select MicroPython (generic) from the "Interpreter" dropdown list

Select the serial port corresponding to W55RP20 from the "Port" dropdown list (usually displayed as Board CDC @ COMx)

Check "Restart interpreter before running code" and "Synchronize device's real-time clock"

Click "OK" to complete configuration

The interface after configuration is complete is shown in the following figure: 

If the development board does not appear in the port list, please try:

Re-plug the USB data cable

Replace with a USB data cable that supports data transmission

Close other software occupying the serial port (such as serial assistants, Arduino IDE, etc.)

Re-flash the MicroPython firmware

4. DHCP Automatic Networking Principles

4.1 DHCP Protocol Introduction

DHCP, fully known as Dynamic Host Configuration Protocol, is commonly referred to as the Dynamic Host Configuration Protocol in Chinese.

Its role is to allow devices to automatically obtain network parameters from a DHCP server after connecting to the network. In home or office networks, the router typically acts as the DHCP server.

After the development board successfully connects to the network through DHCP, the following parameters can usually be obtained:

ParameterDescription
IP AddressThe address of the development board in the local network
Subnet MaskUsed to determine the network segment of the current device
GatewayUsually the router address
DNSUsed for domain name resolution

Simply put, DHCP allows the development board to automatically request an available IP address from the router.

4.2 DHCP Workflow

The DHCP operation flow of W55RP20-EVB-MKR can be understood as:

Development board powers on

Initialize Ethernet hardware

Send DHCP request

Router assigns IP address

Development board obtains IP, gateway, DNS and other parameters

Application reads and prints network information

5. Core Code Analysis

The W55RP20 MicroPython library has encapsulated all underlying details. Implementing DHCP automatic networking requires only X lines of core code.

5.1 Complete Code

Open the DHCP example file, or enter the following code in Thonny:

from wiznet_init import wiznet  # Import WIZnet network initialization function

# Initialize W55RP20-EVB-MKR network
# dhcp=True means enable DHCP, let the router automatically assign IP address, gateway, DNS and other network parameters
nic = wiznet("W55RP20-EVB-MKR", dhcp=True)

5.2 Extension: Static IP Configuration (Optional)

If you need to use a static IP address, you can change dhcp=True to dhcp=False and manually pass in the IP, subnet mask, gateway, and DNS parameters.

from wiznet_init import wiznet  # Import WIZnet network initialization function

# Initialize network with static IP
nic = wiznet(
   "W55RP20-EVB-MKR",
   dhcp=False,              # Disable DHCP, enable static IP
   ip="192.168.1.129",      # Development board fixed IP address
   sn="255.255.255.0",      # Subnet mask
   gw="192.168.1.1",        # Gateway address, usually the router address
   dns="8.8.8.8"            # DNS server address
)

Note that the static IP address needs to be in the same network segment as the computer and router.

For example, if the router address is 192.168.1.1, the development board IP can be set to 192.168.1.xxx, such as 192.168.1.129. The xxx part is recommended to choose an address not occupied by other devices in the local network.


6. Running Results and Network Verification

After completing the hardware connection and Thonny development environment configuration, you can run the DHCP example program and check whether the W55RP20-EVB-MKR has successfully obtained an IP address.

This section mainly demonstrates the DHCP automatic networking process through running result screenshots and video demonstration.


6.1 Serial Output Result Screenshots

In Thonny, click the run button, or press F5 to run the program.

After running, the Shell window will output something similar to the following:

MPY: soft reboot
Waiting for the network to connect...
Waiting for the network to connect...
Waiting for the network to connect...
Waiting for the network to connect...
MAC Address: 02:90:86:88:4d:56
IP Address: ('192.168.1.129', '255.255.255.0', '192.168.1.1', '202.96.134.33')

Note: The Waiting for the network to connect... printed in the early stage of program execution is a normal phenomenon. This is the W55RP20 waiting for the router to assign an IP address. It is usually printed 1-3 times, depending on the network environment.

The actual running result is shown in the following figure: 

From the running results, it can be seen that the program eventually printed out the MAC address and IP address information.

Among them:

MAC Address: 02:90:86:88:4d:56

Represents the MAC address of the current development board.

IP Address: ('192.168.1.129', '255.255.255.0', '192.168.1.1', '202.96.134.33')

Represents the network parameters obtained by the development board through DHCP.

The field descriptions are as follows:

FieldActual ValueDescription
IP Address192.168.1.129The local network IP address obtained by W55RP20-EVB-MKR
Subnet Mask255.255.255.0The subnet mask of the current local network
Gateway192.168.1.1Router address
DNS202.96.134.33DNS server address

If the first field is not 0.0.0.0, but a valid local network IP like 192.168.x.x, it means DHCP acquisition was successful.


6.2 DHCP Automatic Networking Video Demonstration

The video below shows the process of the development board automatically obtaining an IP address through DHCP after running dhcp.py.

The program eventually prints out MAC Address and IP Address, where IP Address is a valid local network address, indicating that the W55RP20-EVB-MKR has successfully connected to the network.

The video demonstration is as follows: 在这里插入图片描述 From the screenshots and video, it can be seen that the W55RP20-EVB-MKR has successfully obtained an IP address through DHCP, indicating that the development board has properly connected to the local network. Subsequent TCP, UDP, MQTT, HTTP and other network communication tests can be performed.


7. Common Issues One-Stop Troubleshooting Guide

7.1 Flashing-Related Issues

Problem SymptomTroubleshooting Steps
Computer cannot recognize RPI-RP2 disk1. Confirm pressing and holding BOOTSEL button before connecting USB 2. Replace with a USB data cable that supports data transmission 3. Change computer USB port 4. Try using another computer
No response from development board after firmware drag-and-drop1. Confirm firmware matches W55RP20-EVB-MKR 2. Re-flash firmware 3. Check if USB power supply is stable

7.2 Port Identification Issues

Problem SymptomTroubleshooting Steps
Cannot find development board port in Thonny1. Re-plug USB data cable 2. Close other software occupying the serial port 3. Check if there is a new serial port device in Device Manager 4. Re-flash MicroPython firmware 5. Install Raspberry Pi Pico USB driver

7.3 Network Connection Issues

Problem SymptomTroubleshooting Steps
Continuously displays Waiting for the network to connect...1. Check if the Ethernet cable is firmly plugged in 2. Confirm the Ethernet cable is connected to the router LAN port 3. Confirm router DHCP function is enabled 4. Replace router LAN port or Ethernet cable 5. Restart router and development board
IP address displays as 0.0.0.01. Perform the above network connection troubleshooting steps 2. Confirm the development board model is correctly filled in the code 3. Confirm using matching MicroPython firmware 4. Try running the program again
Computer cannot ping the development board1. Confirm computer and development board are connected to the same router 2. Check if the development board IP address is correct 3. Temporarily disable computer firewall for testing 4. Restart development board and computer

8. W55RP20 Core Advantages Comparison

 

To help you more intuitively understand the value of W55RP20, we compared the three mainstream embedded Ethernet solutions currently available:

Comparison DimensionW55RP20 Integrated SolutionExternal PHY Chip SolutionExternal Serial-to-Ethernet Module Solution
BOM CostLow (Single chip)Medium-High (MCU + Module + Peripheral components)High
PCB AreaSmall (Only Ethernet port circuitry required)Large (Need to reserve chip and routing space)High
Development DifficultyLow (One line of code for networking)Medium-High (Debug protocol stack, write drivers)Low
Network StabilityExtremely High (WIZnet has focused on hardware TCP/IP protocol stack for 25 years)Variable (Requires high R&D personnel capability, familiarity with protocol stack and network development to debug stably)Variable (Depends on R&D company's capability level)
CPU Resource Usage0% (Protocol stack network processing entirely handled by hardware)50% or above (Protocol stack runs entirely on MCU, occupying related resources)0%
Hardware Socket Count8 independent hardware socketsDepends on MCU capability, theoretically supports multi-channel expansionGenerally single-channel transparent transmission
Network ThroughputUp to 15MbpsDepends on MCU capabilityApproximately 3-5Mbps
Interface Ease of UseSingle chip integrationMCU needs MII/RMII or similar interfacesTTL interface
Deployment DifficultyLow (Mature MicroPython firmware, most application layer protocols have library files, flexible to add and deploy)High (Application layer protocols require manual porting of open-source libraries for adaptation)Depends on module integration, non-integrated features require self-encapsulation and parsing

The W55RP20-EVB-MKR already has an onboard Ethernet interface, making it very suitable for beginners to quickly complete Ethernet function verification.


9. Typical Application Scenarios

The W55RP20 chip integrates Ethernet functionality, suitable for the following application scenarios:

Industrial data acquisition gateway;

Remote monitoring terminal;

Serial-to-Ethernet device;

Smart building control node;

Industrial PLC expansion module;

Sensor data acquisition and upload;


Article Summary

This article started from the static IP configuration of the previous article and systematically introduced how to implement DHCP automatic networking based on the W55RP20-EVB-MKR development board. With the support of the WIZnet hardware TCP/IP protocol stack, only two lines of MicroPython code are needed to complete network initialization and automatic IP address acquisition, laying a solid foundation for subsequent TCP/UDP communication, MQTT cloud connectivity, and other advanced applications.

Reviewing the core points of this article:

DHCP Protocol Principles: Understood the core role of DHCP as a "Dynamic Host Configuration Protocol" — allowing the development board to automatically request IP address, subnet mask, gateway, and DNS parameters from the router without manual configuration, reducing risks such as inconsistent network segments, IP conflicts, and incorrect gateway entries

Development Environment Setup: Completed W55RP20 exclusive MicroPython firmware flashing and Thonny IDE configuration, became familiar with the UF2 drag-and-drop flashing method and serial connection process

DHCP Code Implementation: Used the wiznet_init module, enabled automatic acquisition with dhcp=True, only two lines of code needed for the development board to automatically connect to the network; also mastered the method of switching to static IP with dhcp=False, improving code deployment flexibility

Running Result Verification: Confirmed MAC address and IP address information through serial output, mastered the method of determining whether DHCP acquisition was successful — as long as the IP address is not 0.0.0.0, it is a valid local network address

Troubleshooting: Summarized troubleshooting methods for three major categories of common issues: flashing, port identification, and network connection, covering key steps such as Ethernet cable checking, router DHCP function confirmation, and firewall disabling

Solution Comparison: Compared the W55RP20 integrated solution, external PHY chip solution, and external serial-to-Ethernet module solution; W55RP20's single-chip integration, 0% CPU usage, and one-line code networking stand out in rapid verification scenarios

After mastering the DHCP automatic networking technology in this article, your embedded device has the core capability of automatically connecting to local networks. The next article will move on to learning TCP Client communication, enabling data transmission between the development board and remote servers.


10. Series Preview and Resource Access

10.1 Series Preview

The next tutorial will continue to explain the TCP Client implementation under W55RP20 MicroPython development, including connection establishment, data sending, data receiving, exception reconnection, and other content.

10.2 Resource Access

Complete code for this article: WIZnet Pico MicroPython Example Project

W55RP20 Chip Manual: WIZnet Official Resources Page

If this article was helpful, please like, bookmark, and follow. Your support is the driving force for our continuous updates! If you have any questions, please leave a comment in the comment section, and we will reply as soon as possible.

Documents
Comments Write