---
title: "RE> W5500_TCP_Server"
url: "https://maker.wiznet.io/josephsr/projects/re-w5500-tcp-server/"
markdown_url: "https://maker.wiznet.io/josephsr/projects/re-w5500-tcp-server/md"
type: "UCC: User Created Content"
author: "流年_cth"
author_url: "http://maker.wiznet.io/chen/projects/04%2Dw5500%2Dtcp%2Dserver/?page=4&serob=rt&serterm=all"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "流年_cth"
original_url: "http://maker.wiznet.io/chen/projects/04%2Dw5500%2Dtcp%2Dserver/?page=4&serob=rt&serterm=all"
published: "2024-07-30"
language: "en"
hardware: ["STMicroelectronics STM32F103RCT6", "WIZnet W5500"]
likes: 0
views: 1465
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# RE> W5500_TCP_Server

> The blog post on CSDN provides a comprehensive guide on integrating STM32 microcontrollers with the W5500 Ethernet controller. This integration enables seamless

Original author: 流年_cth (source: http://maker.wiznet.io/chen/projects/04%2Dw5500%2Dtcp%2Dserver/?page=4&serob=rt&serterm=all)

## Components

- **STMicroelectronics STM32F103RCT6** x 1 ([docs](https://estore.st.com/en/stm32f103rct6-cpn.html))
- **WIZnet W5500** x 1 ([docs](https://docs.wiznet.io/Product/Chip/Ethernet/W5500))

WIZnet parts: W5500 ([Datasheet](https://docs.wiznet.io/Product/Chip/Ethernet/W5500/datasheet?utm_source=maker&utm_medium=project&utm_campaign=w5500), [product hub](https://maker.wiznet.io/products/w5500/))

## Article

## Comprehensive Guide to STM32 Ethernet Integration with W5500

### Overview

This guide provides detailed instructions for integrating STM32 microcontrollers with the W5500 Ethernet controller, including hardware connections, software configuration, and example code to facilitate network communication.

### Hardware Setup

1. **Connections**:
  - Connect the W5500 module to the STM32 microcontroller using SPI pins.
  - Ensure connections are made as per the specified pin layout in the guide.

### Software Configuration

**Library Integration**:

- Download the necessary libraries from the provided sources.

- Integrate the libraries into your STM32 project.

**Network Initialization**:

- Configure network settings in the code.

- Initialize the W5500 module using provided functions.

### Example Code

Below is an example of initializing the W5500 and setting up the network:

c

#include "w5500.h"
#include "stm32f1xx_hal.h"

// Define SPI handle
SPI_HandleTypeDef hspi1;

// Function to initialize W5500
void W5500_Init(void) {
// Initialize SPI
MX_SPI1_Init();

// Reset W5500
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, GPIO_PIN_RESET);
HAL_Delay(1);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, GPIO_PIN_SET);
HAL_Delay(200);

// Configure network settings
uint8_t mac[6] = {0x00, 0x08, 0xDC, 0x01, 0x02, 0x03};
uint8_t ip[4] = {192, 168, 0, 100};
uint8_t gateway[4] = {192, 168, 0, 1};
uint8_t subnet[4] = {255, 255, 255, 0};

wizchip_init(mac, ip, gateway, subnet);

// Check PHY status
if (getPHYStatus() == PHY_LINK_ON) {
printf("Ethernet cable connected.\n");
} else {
printf("Ethernet cable not connected.\n");
}
}

int main(void) {
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
MX_SPI1_Init();

// Initialize W5500
W5500_Init();

while (1) {
// Main loop
}
}

### Conclusion

Integrating STM32 with the W5500 Ethernet controller is straightforward with the right guidance. This tutorial covers the essential steps for both hardware and software setup, providing a strong foundation for adding network capabilities to embedded projects.

For more detailed information, visit the original blog post on CSDN.

---

Source: https://maker.wiznet.io/josephsr/projects/re-w5500-tcp-server/
