---
title: "W5300-TOE Arduino UDP Loopback server"
url: "https://maker.wiznet.io/scarlet/projects/w5300-toe-arduino-udp-loopback-server/"
markdown_url: "https://maker.wiznet.io/scarlet/projects/w5300-toe-arduino-udp-loopback-server/md"
type: "UCC: User Created Content"
author: "scarlet"
author_url: "https://maker.wiznet.io/scarlet/"
original_author: "scarlet"
original_url: "https://github.com/Wiznet/W5300-TOE-Arduino/tree/main/Ethernet/examples"
published: "2023-04-03"
language: "en"
tags: ["toe-design-contest-ref"]
hardware: ["WIZnet W5300-TOE-Shield"]
likes: 1
views: 4739
comments: 7
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# W5300-TOE Arduino UDP Loopback server

> This program sets up a UDP communication on an STM32 Nucleo-144 board. The program listens for incoming UDP packets and sends a reply to the

Original author: scarlet (source: https://github.com/Wiznet/W5300-TOE-Arduino/tree/main/Ethernet/examples)

## Components

- **WIZnet W5300-TOE-Shield** x 1 ([docs](https://wiznetshop.io/))
- Software: **Arduino IDE** ([docs](https://www.arduino.cc/en/software))

## Documents and links

- [official_git](https://github.com/Wiznet/W5300-TOE-Arduino/tree/main/Ethernet/examples/UDP_Loopback) (code)

## Article

**PROJECT DESCRIPTION**

## How to UDP Loopback Example

This program sets up a UDP communication on an STM32 Nucleo-144 board. The program listens for incoming UDP packets and sends a reply to the sender.

## Step 1: Prepare software

The following serial terminal programs are required for AdvancedChatServer example test, download and install from below links.

- [**Tera Term**](https://osdn.net/projects/ttssh2/releases/)

- [**Hercules**](https://www.hw-group.com/software/hercules-setup-utility)

## Step 2: Prepare hardware

Combine W5300-TOE Shield with STM32 Nucleo-144 board.

Connect ethernet cable to W5300 TOE Shield ethernet port.

Connect STM32 Nucleo-144 board to desktop or laptop using 5 pin micro USB cable.

## Step 3: Setup UDP_Loopback Example

* Please refer to the following **[Getting Start]** page for instructions on configuring the Arduino IDE

<https://github.com/Wiznet/W5300-TOE-Arduino/blob/main/Static/documents/getting_started.md>

To test the UDP_Loopback example, minor settings shall be done in code.

1. Setup network configuration.

Setup **network configuration** such as IP and UDP Port in '**UDP_Loopback.ino**' in '**Ethernet/examples/UDP_Loopback**' directory.

```
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(192, 168, 11, 111);

unsigned int localPort = 8888;
```

## Step 4: Build and Download

After completing the UDP_Loopback example configuration, build in the IDE you are using.

When the build is completed, download the firmware to the STM32 Nucleo-144 board.

## Step 5: Run

1. Connect to the serial COM port of STM32 Nucleo-144 board with Tera Term.

[![](https://github.com/Wiznet/W5300-TOE-Arduino/raw/main/Static/images/examples/teraterm_setting.png)](https://github.com/Wiznet/W5300-TOE-Arduino/blob/main/Static/images/examples/teraterm_setting.png)

2. If the UDP_Loopback example works normally on STM32 Nucleo-144 board, you can see the network information of STM32 Nucleo-144 board and the LoopServer is open.

[![](https://github.com/Wiznet/W5300-TOE-Arduino/raw/main/Static/images/examples/udp_setting_up.png)](https://github.com/Wiznet/W5300-TOE-Arduino/blob/main/Static/images/examples/udp_setting_up.png)

3. Connect to the open UDP client using Hercules UDP. When connecting to the UDP server, you need to enter is the IP that was configured in Step 3, the port is 8888 by default.

[![](https://github.com/Wiznet/W5300-TOE-Arduino/raw/main/Static/images/examples/udp_hercules_setting_up.png)](https://github.com/Wiznet/W5300-TOE-Arduino/blob/main/Static/images/examples/udp_hercules_setting_up.png)

4. The program listens for incoming UDP packets on port 8888. When a packet is received, the program prints the sender's IP address and port, and sends a reply to the sender with the same message.

[![](https://github.com/Wiznet/W5300-TOE-Arduino/raw/main/Static/images/examples/udp_teraterm_log.png)](https://github.com/Wiznet/W5300-TOE-Arduino/blob/main/Static/images/examples/udp_teraterm_log.png)[![](https://github.com/Wiznet/W5300-TOE-Arduino/raw/main/Static/images/examples/udp_hercules_log.png)](https://github.com/Wiznet/W5300-TOE-Arduino/blob/main/Static/images/examples/udp_hercules_log.png)

---

Source: https://maker.wiznet.io/scarlet/projects/w5300-toe-arduino-udp-loopback-server/
