Wiznet makers

Benjamin

Published January 16, 2026 ©

83 UCC

11 WCC

8 VAR

0 Contests

0 Followers

1 Following

Original Link

STM32F401xx-W5500 IoT

Programming Ethernet Connection using STM32F401

COMPONENTS
PROJECT DESCRIPTION

STM32F401xx-W5500 IoT

Programming Ethernet Connection using STM32F401


📋 Overview

Project ini adalah tutorial untuk menghubungkan STM32F401 Development Board dengan W5500 Ethernet Module untuk komunikasi jaringan Ethernet. W5500 adalah hardwired TCP/IP chip yang memudahkan implementasi koneksi internet pada embedded systems.

Key Features:

  • ✅ Hardware Ethernet Controller (W5500)
  • ✅ SPI Communication Interface
  • ✅ Support TCP/IP Protocol Stack
  • ✅ DHCP Client Support
  • ✅ Up to 8 Independent Sockets
  • ✅ UART Debug Interface

📦 Required Devices

Hardware Components

ComponentSpecificationQuantity
STM32F401 Development BoardSTM32F401CCU6 or STM32F401RET61 pc
W5500 Ethernet ModuleWIZnet W5500 Chip1 pc
Ethernet CableCat5e/Cat6 RJ451 pc
USB to Serial/TTLFor debugging (FT232)1 pc
Jumper WiresMale-to-Female & Male-to-Male20+ pcs
STM32 UploaderUploader USB Power1 pc

Device Specifications

STM32F401

  • Processor: ARM Cortex-M4 with FPU
  • Clock Speed: Up to 84 MHz
  • Flash Memory: 256 KB
  • SRAM: 64 KB
  • Operating Voltage: 1.8V to 3.6V
  • I/O Voltage: 3.3V compatible

W5500 Module

  • Protocol Stack: Hardwired TCP/IP (TCP, UDP, ICMP, IPv4, ARP, IGMP, PPPoE)
  • Number of Sockets: 8 independent hardware sockets
  • Internal Buffer: 32KB (16KB TX + 16KB RX)
  • Communication Interface: SPI (Mode 0/3, up to 80MHz)
  • Operating Voltage: 3.3V (Important!)
  • Network Speed: 10/100 Mbps Auto-negotiation

🔌 Hardware Connection Schematic

Pin Mapping Table

SPI Communication

STM32F401 PinPin FunctionW5500 Module PinDescription
PA5SPI1_SCKSCKSerial Clock
PA6SPI1_MISOSO (MISO)Master In Slave Out
PA7SPI1_MOSISI (MOSI)Master Out Slave In
PA1GPIO OutputCS (SCS)Chip Select - Active Low
PA0GPIO OutputRESET (RST)Hardware Reset - Active Low
Not Connected-INTInterrupt (Optional)

UART Debug Interface

STM32F401 PinPin FunctionConnect toPurpose
PA2USART2_TXUSB-TTL RX PinTransmit debug data to PC
PA3USART2_RXUSB-TTL TX PinReceive data from PC

Power Supply

STM32F401W5500 ModuleNotes
3.3VVCCPower supply 3.3V only
GNDGNDCommon ground

Connection Diagram

Refer to the wiring schematic diagram below for visual reference:

Wiring Schematic

Important Notes:

⚠️ Critical Warnings:

  1. W5500 MUST use 3.3V power supply - Never connect to 5V!
  2. Ensure common ground between STM32 and W5500
  3. CS (Chip Select) must be controlled by GPIO, not hardware SPI NSS
  4. Keep SPI wires as short as possible for signal integrity
  5. If using long wires, add 100nF decoupling capacitor near W5500 VCC pin

💡 Tips:

  • Use breadboard jumper wires < 15cm for best results
  • Connect W5500 module close to STM32 board
  • INT pin is optional - can be left disconnected for polling mode
  • For production, add 10kΩ pull-up resistor on RESET line

Physical Assembly Steps:

Mount Components

  • Place STM32F401 board on breadboard
  • Place W5500 module on breadboard (leave space between modules)

Power Connections First (Important!)

  • Connect STM32 GND to breadboard ground rail
  • Connect STM32 3.3V to breadboard power rail
  • Connect W5500 GND to ground rail
  • Connect W5500 VCC to 3.3V power rail
  • Verify voltage with multimeter before proceeding

SPI Signal Connections

  • PA5 (SCK) → W5500 SCK
  • PA6 (MISO) → W5500 SO
  • PA7 (MOSI) → W5500 SI

Control Signal Connections

  • PA1 → W5500 CS
  • PA0 → W5500 RESET

Debug UART (Optional but recommended)

  • PA2 → USB-TTL RX
  • PA3 → USB-TTL TX
  • USB-TTL GND → Common ground

Network Connection

  • Connect Ethernet cable to W5500 RJ45 port
  • Connect other end to router/switch

🛠️ Software Installation

Step 1: Install Development Environment

STM32CubeIDE

  1. Download from official STMicroelectronics website:
  2. Choose version for your OS:
    • Windows: .exe installer
    • Linux: .sh installer
    • macOS: .dmg installer
  3. Install with default settings
  4. Recommended version: STM32CubeIDE 1.13.0 or newer

Serial Terminal Software

Choose one for debugging:

Step 2: Download W5500 Library

WIZnet ioLibrary_Driver

Download Options:

Option A: Git Clone (Recommended)

git clone https://github.com/Wiznet/ioLibrary_Driver.git

Option B: Direct Download

⚙️ STM32CubeIDE Project Configuration

📌 Part 1: Create New Project

Launch STM32CubeIDE

  • File → New → STM32 Project

Select Target

  • Click "Board Selector" tab or "MCU/MPU Selector" tab
  • For Board Selector:
    • Type: NUCLEO-F401RE (if using Nucleo board)
  • For MCU Selector:
    • Search: STM32F401CCU6 or STM32F401RET6
    • Select your exact MCU part number

Project Settings

  • Project Name: STM32F401_W5500_Ethernet
  • Targeted Language: C
  • Targeted Binary Type: Executable
  • Targeted Project Type: STM32Cube

Click Finish


📌 Part 2: Pinout Configuration

Based on screenshots: gpio_set, io, spi, uart

🔧 Configure SPI1

Configuration Screenshot:

SPI Configuration


🔧 Configure USART2 (Debug)

Configuration Screenshot:

UART Configuration


🔧 Configure GPIO Pins

Configuration Screenshots:

GPIO Settings IO Configuration


Peripheral Clock Mapping:

  • SPI1 runs on APB2 → 84 MHz
  • USART2 runs on APB1 → 42 MHz
  • GPIO runs on AHB → 84 MHz

Configuration Screenshots:

Clock Configuration 1 Clock Configuration 2 RCC Configuration System View


🧪 Initial Testing

Test 1: Hardware Power Test

Visual Inspection:

  • Check all wire connections
  • Verify no short circuits
  • Ensure proper orientation of modules

Power On:

  • Connect USB to STM32 board
  • W5500 power LED should turn on
  • STM32 power LED should turn on

Measure Voltages:

  • W5500 VCC pin: 3.3V (±0.1V)
  • STM32 3.3V pin: 3.3V (±0.1V)
  • Ground continuity verified

Test 2: Serial Communication Test

Connect USB-TTL:

  • Connect to PC USB port
  • Drivers should install automatically

Open Serial Terminal:

  • Port: Select correct COM port
  • Baud rate: 115200
  • Data bits: 8
  • Parity: None
  • Stop bits: 1
  • Flow control: None

Expected Result:

  • Terminal should open without errors
  • Ready for debug messages

Test 3: Project Build Test

In STM32CubeIDE:

  • Project → Build All
  • Or press Ctrl + B

Expected Output:

Building target: STM32F401_W5500_Ethernet.elf
Finished building target: STM32F401_W5500_Ethernet.elf

arm-none-eabi-size  STM32F401_W5500_Ethernet.elf
   text    data     bss     dec     hex filename
   1234     100     500    1834     72a STM32F401_W5500_Ethernet.elf

Build Finished. 0 errors, 0 warnings.

Test 4: Network Testing (After Implementation)

Reference screenshots showing successful testing results:

DHCP Configuration Test:

DHCP Test

Packet Sender Communication Test:

Packet Sender

Test Results:

Result 1 Result 2 Result 3


📚 Additional Resources

Official Documentation

W5500 Resources:

STM32F401 Resources:

STM32CubeIDE:

Community & Support

Development Tools

Network Testing:

Serial Terminal:


This documentation focuses on hardware setup and STM32CubeIDE configuration. For code implementation examples, please refer to separate implementation guides.

Documents
Comments Write