---
title: "make loopback server with STM32f103vc and w5100s"
url: "https://maker.wiznet.io/scarlet/projects/make-loopback-server-with-stm32f103vc-and-w5100s/"
markdown_url: "https://maker.wiznet.io/scarlet/projects/make-loopback-server-with-stm32f103vc-and-w5100s/md"
type: "UCC: User Created Content"
author: "scarlet"
author_url: "https://maker.wiznet.io/scarlet/"
original_author: "scarlet"
original_url: "https://www.hackster.io/wizscarlet5986/make-loopback-server-with-stm32f103vc-and-w5100s-7d4180"
published: "2022-12-14"
language: "en"
tags: ["Internet of Things"]
hardware: ["WIZnet W5100S", "WIZnet W5100S-EVB"]
likes: 7
views: 746
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# make loopback server with STM32f103vc and w5100s

> make loopback server using STM32CubeMX with W5100S-EVB,

Original author: scarlet (source: https://www.hackster.io/wizscarlet5986/make-loopback-server-with-stm32f103vc-and-w5100s-7d4180)

## Components

- **WIZnet W5100S** x 1 ([docs](https://docs.wiznet.io/Product/Chip/Ethernet/W5100S))
- **WIZnet W5100S-EVB** x 1 ([docs](https://docs.wiznet.io/Product/iEthernet/W5100S/w5100s-evb))

## Article

### **Step 1: Prepare software**

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

- [**ST Flash loader demonstrator**](https://www.st.com/en/development-tools/flasher-stm32.html)

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

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

### **Step 2: Prepare hardware**

- Connect ethernet cable to W5100S-EVB ethernet port.

- Connect W5100S-EVB to desktop or laptop using 5 pin micro USB cable.

### **Step 3: Setup Loopback Example**

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

- If you want to test with the Loopback example using SPI, Set Mode switch [0 0]

![](https://hackster.imgix.net/uploads/attachments/1536410/w5100s-evb-mode-sw-spi.png?auto=compress%2Cformat&w=740&h=555&fit=max)

- If you want to test with the Loopback example using B, Set Mode switch [0 1]

![](https://hackster.imgix.net/uploads/attachments/1536402/w5100s-evb-mode-sw-bus.png?auto=compress%2Cformat&w=740&h=555&fit=max)

And if you want to using DMA, defined comment in main.h

```plaintext
/* Use BUS DMA */
//#define USE_DMA
```

- Setup network configuration such as IP in 'main.c' which is the Loopback example in 'Core/Src/' directory.

```plaintext
/* Network */
static wiz_NetInfo g_net_info =
    {
        .mac ={0x00, 0x08, 0xDC, 0x12, 0x34, 0x56}, // MAC address
        .ip = {192, 168, 11, 2},                     // IP address
        .sn = {255, 255, 255, 0},                    // Subnet Mask
        .gw = {192, 168, 11, 1},                     // Gateway
        .dns = {8, 8, 8, 8},                         // DNS server
        .dhcp = NETINFO_STATIC                       // DHCP enable/disable
};
```

- Setup loopback configuration in 'main.c' in 'Core/Src/' directory.

```plaintext
/* Port */
#define PORT_LOOP   5000
```

### **Step 4: Build**

- After completing the Loopback example configuration, mouse right click to Project name and selsect 'Build Project'

![](https://hackster.imgix.net/uploads/attachments/1536403/build-project.png?auto=compress%2Cformat&w=740&h=555&fit=max)

- When the build is completed, 'xxx.hex' is generated in '\Debug' or \Release' directory.

### **Step 5: Upload and Run**

### **Flash programming via UART**

STMicroelectronics Flash loader demonstrator is a program to perform in-system - programming (ISP) of the MCU flash via its UART.Press the 'Boot0' push button

Switch on board until turn on the board after reset or power supply.

Set the settings on main window of Flash loader demonstrator program. The figure below shows the default configuration for W5100S-EVB

![](https://hackster.imgix.net/uploads/attachments/1536404/flash_down.png?auto=compress%2Cformat&w=740&h=555&fit=max)

- refer to below pictures If you do not go to the next page in flash loader demonstrator, users try again this action. 'Press the 'Boot0' push button switch on board until turn on the board after reset or power supply.'

![](https://hackster.imgix.net/uploads/attachments/1536405/flash_down2.png?auto=compress%2Cformat&w=740&h=555&fit=max)

- After finish to flash programming and board reset, The MCU do running the program When the running to loopback program, as below picture serial debug message print out.

![](https://hackster.imgix.net/uploads/attachments/1536406/w5100s-evb-terminal-start.png?auto=compress%2Cformat&w=740&h=555&fit=max)

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

![](https://hackster.imgix.net/uploads/attachments/1536407/connect_to_loopback_server_using_hercules_tcp_client_1.png?auto=compress%2Cformat&w=740&h=555&fit=max)

![](https://hackster.imgix.net/uploads/attachments/1536408/connect_to_loopback_server_using_hercules_tcp_client_2.png?auto=compress%2Cformat&w=740&h=555&fit=max)

- Once connected if you send data to the loopback server, you should be able to receive back the sent message.

![](https://hackster.imgix.net/uploads/attachments/1536409/receive_back_sent_message.png?auto=compress%2Cformat&w=740&h=555&fit=max)

---

Source: https://maker.wiznet.io/scarlet/projects/make-loopback-server-with-stm32f103vc-and-w5100s/
