STM32duino的Ethernet_STM的Readme文件

W5x00 ethernet library for STM32F103 micro-controllers

That library has been ported from the WIZnet WIZ_Ethernet_Library , to STM32F103 microcontrollers.

The library supports W5100 and W5500 Ethernet controllers. The source code has been modified to support the W5200 too, but has not been tested (yet) on a real W5200 controller.

Ported to STM32F103 on 23 Aug 2015 by Vassilis Serasidis

Library installation

Install the library globally

  • Unzip the file Ethernet_STM-master.zip into your Arduino IDE directory

arduino\libraries

and rename the folder Ethernet_STM-master to Ethernet_STM

In this case the library can be used from the 8-bit and 32-bit Arduino boards (UNO, Nano, DUE etc) and from STM32F1 microcontroller series (for example STM32F103).

Install the library for using it only with STM32F1 series

  • Unzip the file Ethernet_STM-master.zip into your Arduino IDE directory

...arduino\hardware\Arduino_STM32\STM32F1\libraries

and rename the folder Ethernet_STM-master to Ethernet_STM

Selecting the Ethernet type controller (W5100, W5200 or W5500)

For selecting among those tree chips edit the file:
Ethernet_STM\src\utility\w5100.h

and comment-out only the line with the chip you want to use.

By default the W5500 ethernet controller is selected.

复制代码
//#define W5100_ETHERNET_SHIELD // Arduino Ethenret Shield and Compatibles ...
//#define W5200_ETHERNET_SHIELD // WIZ820io, W5200 Ethernet Shield 
#define W5500_ETHERNET_SHIELD   // WIZ550io, ioShield series of WIZnet

If you edit the w5100.h file, save it and re-compile your sketch.

Selecting W5500 Sockets number and RAM buffer amount

For selecting the Sockets number (1-8) and the RAM buffer amount (1-16 kBytes) for each Socket, edit the file:
Ethernet_STM\src\utility\w5500.h

and change the values you want.

复制代码
Total RAM buffer is 16 kBytes for Transmitter and 16 kBytes for receiver for 1 Socket.
The Total W5500 RAM buffer is 32 kBytes (16 + 16).
If you use more Sockets then the RAM buffer must be split.
For example: if you use 2 Sockets then all socket must use upto 16 kBytes in total RAM.
So, we have: 
 
   #define MAX_SOCK_NUM 2   // Select two Sockets.
   #define RXBUF_SIZE   8   // The Receiver buffer size will be 8 kBytes
   #define TXBUF_SIZE   8   // The Transmitter buffer size will be 8 kBytes
 
In total we use (2 Sockets)*(8 kBytes) for transmitter + (2 Sockets)*(8 kBytes) for receiver = 32 kBytes.
  
I would prefer to use only 1 Socket with 16 kBytes RAM buffer for transmitter and 16 kByte for receiver buffer.
 
   #define MAX_SOCK_NUM 1   // Select only one Socket
   #define RXBUF_SIZE   16  // Select 16 kBytes Receiver RAM buffer
   #define TXBUF_SIZE   16  // Select 16 kBytes Transmitter RAM buffer

Default settings:

复制代码
#define MAX_SOCK_NUM 8   // Select the number of Sockets (1-8)
#define RXBUF_SIZE   2   // Select the Receiver buffer size (1 - 16 kBytes)
#define TXBUF_SIZE   2   // Select the Transmitter buffer size (1 - 16 kBytes)

If you edit the w5500.h file, save it and re-compile your sketch.

Using the Ethernet_STM library

  1. Choose the desired ethernet chip you want to use (W5100, W5200 or W5500) from the w5100.h file
  2. include this library in your sketch

#include <Ethernet_STM.h>

All functions / commands have the same syntax with the stock Arduino Ethernet library.

PIN Connections

W5x00 STM32F103
SS PA4
SCK PA5
MISO PA6
MOSI PA7

DO NOT FORGET TO ADD A RESISTOR 4k7 BETWEEN RESET AND 3.3V (OR RESET AND 5V) PINS ON ETHERNET SHIELD

用W5500板子在Arduino下编程可以轻松实现以太网。

相关推荐
张怀民3166 分钟前
PFC_CCM_NCP1654详讲
单片机·嵌入式硬件·硬件工程·pfc
linweidong27 分钟前
RTC 走偏、时间跳变?嵌入式时间管理的工程避坑
嵌入式硬件·面试·实时音视频·rtc·嵌入式面经·嵌入式ntp·嵌入式对时
Yiran_G1 小时前
ZigBee单播、广播与组播详解:从寻址机制到批量控制设计
嵌入式硬件·物联网·智能家居
youcans_1 小时前
【STM32C5教程】(9)DAC 模拟量信号输出实验
stm32·单片机·嵌入式硬件·stm32c5·cubemx2
智购科技自动售货机工厂1 小时前
省电40%的底层逻辑:冷热双温售货机基于SaaS的智能温控算法~YH
单片机·嵌入式硬件·百度·架构·emacs
深圳市恒锐丰科技杨生2 小时前
SS6203D 200V 单路半桥栅极驱动芯片|LeadPower 率能半导体
嵌入式硬件·硬件工程
深圳老胡2 小时前
STM32C5 系列 MCU 的 FreeRTOS 软件架构搭建指南:外设配置与应用实践
笔记·stm32·单片机·代码规范
霖霖7142 小时前
【ESP32笔记】I2S的音频录制与播放
笔记·单片机·mcu·音视频
深圳市恒锐丰科技杨生2 小时前
SS6200 半桥栅极驱动芯片|LeadPower 率能半导体
嵌入式硬件·硬件工程
HQB20262 小时前
EG11732|屹晶微电子 30V 内置 80A 功率管大电流同步降压 DC‑DC
嵌入式硬件·硬件工程