---
title: "W5500 driver based on RT -Thread Studio"
url: "https://maker.wiznet.io/mark/projects/w5500-driver-based-on-rt-thread-studio/"
markdown_url: "https://maker.wiznet.io/mark/projects/w5500-driver-based-on-rt-thread-studio/md"
type: "UCC: User Created Content"
author: "love潇潇熊"
author_url: "https://blog.csdn.net/qq_25186745/article/details/112647919?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522166910935016782390578105%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=166910935016782390578105&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-22-112647919-null-null.nonecase&utm_term=W5500&spm=1018.2226.3001.4450"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "love潇潇熊"
original_url: "https://blog.csdn.net/qq_25186745/article/details/112647919?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522166910935016782390578105%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=166910935016782390578105&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-22-112647919-null-null.nonecase&utm_term=W5500&spm=1018.2226.3001.4450"
published: "2023-02-28"
language: "en"
likes: 3
views: 172
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# W5500 driver based on RT -Thread Studio

> W5500 driver based on RT -Thread Studio

Original author: love潇潇熊 (source: https://blog.csdn.net/qq_25186745/article/details/112647919?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522166910935016782390578105%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=166910935016782390578105&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-22-112647919-null-null.nonecase&utm_term=W5500&spm=1018.2226.3001.4450)

## Article

Software: RT -Thread Studio V2.0.0

HW connection : STM32F407VGT6 + W5500

![](https://maker.wiznet.io/upload/ckeditor5/691904766%5F1677603057%2Epng)

Step 1:Open the SPI device driver framework

Double-click RT-Thread Settings

![](https://maker.wiznet.io/upload/ckeditor5/691904766%5F1677603083%2Epng)

![](https://maker.wiznet.io/upload/ckeditor5/691904766%5F1677603093%2Epng)

Then open the board.h file under the devices file, open the definition of #define BSP_USING_SPI2, It is using SPI2 here

![](https://maker.wiznet.io/upload/ckeditor5/691904766%5F1677603111%2Epng)

Then open the support for SPI in the stm32f4xx_hal_conf.h file, that is, cancel the comment of the macro definition of HAL_SPI_MODULE_ENABLED

![](https://maker.wiznet.io/upload/ckeditor5/691904766%5F1677603131%2Epng)

The SPI configuration required by the W5500 chip is as below

![](https://maker.wiznet.io/upload/ckeditor5/691904766%5F1677603161%2Epng)

Copy the void HAL_SPI_MspInit(SPI_HandleTypeDef* spiHandle) function generated by CubeMx to the board.c file

![](https://maker.wiznet.io/upload/ckeditor5/691904766%5F1677603178%2Epng)

Then compile it, there will be a wiznet-latest folder under the packages folder, and then open the wiz.c file under src

Find the int wiz_init(void) function at the end of the wiz.c file

Add rt_hw_spi_device_attach("spi2", WIZ_SPI_DEVICE, GPIOD, GPIO_PIN_11) in the wiz_init function;

PD11 is connected to CS pin of W5500

![](https://maker.wiznet.io/upload/ckeditor5/691904766%5F1677603197%2Epng)

Download the program after compiling without error

![](https://maker.wiznet.io/upload/ckeditor5/691904766%5F1677603219%2Epng)

Found that W5500 initialization has been successful

Use the ifconfig command to view the currently obtained IP address

![](https://maker.wiznet.io/upload/ckeditor5/691904766%5F1677603237%2Epng)

You can also use the ping command to test the network situation

![](https://maker.wiznet.io/upload/ckeditor5/691904766%5F1677603263%2Epng)

---

Source: https://maker.wiznet.io/mark/projects/w5500-driver-based-on-rt-thread-studio/
