- Important Note for STM32F boards using built-in LAN8742A Ethernet
- Important Note for STM32F boards using built-in LAN8720 Ethernet
- Currently Supported Boards by AsyncWebServer_STM32
- Why do we need the new Async AsyncWebServer_STM32 library
- Why do we need this EthernetWebServer_STM32 library
- Changelog
- Prerequisites
- Installation
- Packages' Patches
- Libraries' Patches
- Configuration Notes
- Usage
- HOWTO use STM32F4 with LAN8720
- Examples
- Original Examples
- HTTP and WebSocket Client New Examples
- LAN8720 Examples
- 1. AdvancedWebServer_LAN8720
- 2. HelloServer_LAN8720
- 3. HelloServer2_LAN8720
- 4. HttpBasicAuth_LAN8720
- 5. MQTTClient_Auth_LAN8720
- 6. MQTTClient_Basic_LAN8720
- 7. MQTT_ThingStream_LAN8720
- 8. PostServer_LAN8720
- 9. SimpleAuthentication_LAN8720
- 10. UdpNTPClient_LAN8720
- 11. UdpSendReceive_LAN8720
- 12. WebClient_LAN8720
- 13. WebClientRepeating_LAN8720
- 14. WebServer_LAN8720
- LAN8720 HTTP and WebSocket Client New Examples
- 1. BasicAuthGet_LAN8720
- 2. CustomHeader_LAN8720
- 3. DweetGet_LAN8720
- 4. DweetPost_LAN8720
- 5. HueBlink_LAN8720
- 6. node_test_server
- 7. PostWithHeaders_LAN8720
- 8. SimpleDelete_LAN8720
- 9. SimpleGet_LAN8720
- 10. SimpleHTTPExample_LAN8720
- 11. SimplePost_LAN8720
- 12. SimplePut_LAN8720
- 13. SimpleWebSocket_LAN8720
- Example AdvancedWebServer
- Debug Terminal Output Samples
- 1. AdvancedWebServer on NUCLEO_F767ZI using Built-in LAN8742A Ethernet and STM32Ethernet Library
- 2. WebClientRepeating on NUCLEO_F767ZI using ENC28J60 and new EthernetENC Library
- 3. UdpNTPClient on NUCLEO_F767ZI using W5500 and Ethernet_Generic Library
- 4. SimpleWebSocket on NUCLEO_F767ZI using Built-in LAN8742A Ethernet and STM32Ethernet Library
- 5. SimpleWebSocket on NUCLEO_F767ZI using W5x00 and Ethernet_Generic Library
- 6. SimpleHTTPExample on NUCLEO_F767ZI using Built-in LAN8742A Ethernet and STM32Ethernet Library
- 7. MQTTClient_Auth on NUCLEO_F767ZI using Built-in LAN8742A Ethernet and STM32Ethernet Library
- 8. MQTTClient_Auth on NUCLEO_F767ZI using ENC28J60 and EthernetENC Library
- 9. MQTTClient_Auth on NUCLEO_F767ZI using W5x00 and Ethernet_Generic Library
- 10. SimpleWebSocket_LAN8720 on BLACK_F407VE using LAN8720 Ethernet and STM32Ethernet Library
- 11. WebClient_LAN8720 on BLACK_F407VE using LAN8720 Ethernet and STM32Ethernet Library
- 12. AdvancedWebServer_LAN8720 on BLACK_F407VE using LAN8720 Ethernet and STM32Ethernet Library
- 13. AdvancedWebServer on NUCLEO_L552ZE_Q with W5x00 using Ethernet_Generic Library and custom SPI
- Debug
- Troubleshooting
- Not supported boards
- Issues
- TO DO
- DONE
- Contributions and Thanks
- Contributing
- License
- Copyright
This EthernetWebServer_STM32 Library, by design, is working synchronously. The Client requests must be handled by continuously checking in loop() using :
void loop()
{
server.handleClient();
}
The new AsyncWebServer_STM32 Library, in contrast, is designed to work asynchronously. The Client requests are handled on demand, without continuously checking in loop(). The loop() now can be as simple as :
void loop()
{
}
The support to LAN8720
for STM32F4, F7 (ARDUINO_BLACK_F407VE, ARDUINO_NUCLEO_H743ZI, etc.), has been broken by new STM32 core v2.3.0.
You have to use STM32 core v2.2.0 or v2.1.0, if it's necessary to use LAN8720 Ethernet
Currently Supported Boards by AsyncWebServer_STM32
- Nucleo-144 (F429ZI, F746ZG, F756ZG, F767ZI)
- Discovery STM32F746G-DISCOVERY
- Any STM32 boards with enough flash/memory and already configured to run LAN8742A Ethernet.
Why do we need the new Async AsyncWebServer_STM32 library
- Using asynchronous network means that you can handle more than one connection at the same time
- You are called once the request is ready and parsed
- When you send the response, you are immediately ready to handle other connections while the server is taking care of sending the response in the background
- Speed is OMG
- Easy to use API, HTTP Basic and Digest MD5 Authentication (default), ChunkedResponse
- Easily extensible to handle any type of content
- Supports Continue 100
- Async WebSocket plugin offering different locations without extra servers or ports
- Async EventSource (Server-Sent Events) plugin to send events to the browser
- URL Rewrite plugin for conditional and permanent url rewrites
- ServeStatic plugin that supports cache, Last-Modified, default index and more
- Simple template processing engine to handle templates
Why do we need this EthernetWebServer_STM32 library
This EthernetWebServer_STM32 library is a simple yet complete WebServer library for STM32F/L/H/G/WB/MP1 boards using built-in Ethernet (Nucleo-144, Discovery), W5x00 or ENC28J60 Ethernet shields.
The functions are similar and compatible to those of ESP32 WebServer
and ESP8266WebServer
libraries to make life much easier to port sketches from ESP8266/ESP32.
This EthernetWebServer_STM32 library, from v1.1.0, also provides high-level HTTP and WebSocket Client with the functions are similar and compatible to those of ArduinoHttpClient Library
The EthernetWebServer_STM32 library supports:
- TCP Server and Client
- UDP Server and Client
- HTTP Server and Client
- HTTP GET and POST requests, provides argument parsing, handles one client at a time.
- High-level HTTP (GET, POST, PUT, PATCH, DELETE) and WebSocket Client. From v1.1.0.
Library is based on and modified from:
The EthernetWebServer class
found in EthernetWebServer_STM32.h
header, is a simple web server that knows how to handle HTTP requests such as GET and POST and can only support one simultaneous client.
Check EthernetWebServer Library Issue: Support for STM32F Series
for reason to create this separate library from EthernetWebServer library
- STM32 boards with built-in Ethernet LAN8742A such as :
- Nucleo-144 (F429ZI, F767ZI)
- Discovery (STM32F746G-DISCOVERY)
- All STM32 boards (STM32F/L/H/G/WB/MP1) with 32K+ Flash, with Built-in Ethernet
- See EthernetWebServer_STM32 Support and Test Results
- STM32F/L/H/G/WB/MP1 boards (with 32+K Flash) running W5x00 or ENC28J60 shields)
- Nucleo-144
- Nucleo-64
- Discovery
- Generic STM32F0, STM32F1, STM32F2, STM32F3, STM32F4, STM32F7 (with 64+K Flash): x8 and up
- STM32L0, STM32L1, STM32L4, STM32L5
- STM32G0, STM32G4
- STM32H7
- STM32WB
- STM32MP1
- LoRa boards
- 3-D printer boards
- Generic Flight Controllers
- Midatronics boards
- STM32 boards using Ethernet LAN8720 such as :
- Nucleo-144 (F429ZI, NUCLEO_F746NG, NUCLEO_F746ZG, NUCLEO_F756ZG)
- Discovery (DISCO_F746NG)
- STM32F4 boards (BLACK_F407VE, BLACK_F407VG, BLACK_F407ZE, BLACK_F407ZG, BLACK_F407VE_Mini, DIYMORE_F407VGT, FK407M1)
-
W5x00 using
Ethernet_Generic
library -
W5x00 using
Ethernet
,EthernetLarge
,Ethernet2
orEthernet3
library -
ENC28J60 using new
EthernetENC
orUIPEthernet
library -
LAN8720 using new
STM32Ethernet
andLwIP
libraries.
Arduino IDE 1.8.19+
for Arduino.Arduino Core for STM32 v2.3.0+
for STM32 boards. . Check Important Note for STM32F boards using built-in LAN8720 EthernetFunctional-Vlpp library v1.0.2+
to use server's lambda function. To install. check- For built-in LAN8742A or LAN8720 Ethernet:
STM32Ethernet library v1.3.0+
for built-in LAN8742A Ethernet on (Nucleo-144, Discovery).LwIP library v2.1.2+
for built-in LAN8742A Ethernet on (Nucleo-144, Discovery).
- For W5x00 Ethernet:
Ethernet_Generic library v2.7.1+
for W5100, W5200 and W5500/WIZ550io/WIZ850io/USR-ES1 with Wiznet W5500 chip.
- For ENC28J60 Ethernet:
EthernetENC library v2.0.3+
for ENC28J60. . New and BetterUIPEthernet library v2.0.12+
for ENC28J60.
The best way is to use Arduino Library Manager
. Search for EthernetWebServer_STM32
, then select / install the latest version.
You can also use this link for more detailed instructions.
- Navigate to EthernetWebServer_STM32 page.
- Download the latest release
EthernetWebServer_STM32-master.zip
. - Extract the zip file to
EthernetWebServer_STM32-master
directory - Copy whole
EthernetWebServer_STM32-master
folder to Arduino libraries' directory such as~/Arduino/libraries/
.
- Install VS Code
- Install PlatformIO
- Install EthernetWebServer_STM32 library by using Library Manager. Search for EthernetWebServer_STM32 in Platform.io Author's Libraries
- Use included platformio.ini file from examples to ensure that all dependent libraries will installed automatically. Please visit documentation for the other options and examples at Project Configuration File
To use LAN8720 on some STM32 boards
- Nucleo-144 (F429ZI, NUCLEO_F746NG, NUCLEO_F746ZG, NUCLEO_F756ZG)
- Discovery (DISCO_F746NG)
- STM32F4 boards (BLACK_F407VE, BLACK_F407VG, BLACK_F407ZE, BLACK_F407ZG, BLACK_F407VE_Mini, DIYMORE_F407VGT, FK407M1)
you have to copy the files stm32f4xx_hal_conf_default.h and stm32f7xx_hal_conf_default.h into STM32 stm32 directory (~/.arduino15/packages/STM32/hardware/stm32/2.3.0/system) to overwrite the old files.
Supposing the STM32 stm32 core version is 2.3.0. These files must be copied into the directory:
~/.arduino15/packages/STM32/hardware/stm32/2.3.0/system/STM32F4xx/stm32f4xx_hal_conf_default.h
for STM32F4.~/.arduino15/packages/STM32/hardware/stm32/2.3.0/system/STM32F7xx/stm32f7xx_hal_conf_default.h
for Nucleo-144 STM32F7.
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz, these files must be copied into the corresponding directory:
~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/system/STM32F4xx/stm32f4xx_hal_conf_default.h
- `~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/system/STM32F7xx/stm32f7xx_hal_conf_default.h
To use Serial1 on some STM32 boards without Serial1 definition (Nucleo-144 NUCLEO_F767ZI, Nucleo-64 NUCLEO_L053R8, etc.) boards, you have to copy the files STM32 variant.h into STM32 stm32 directory (~/.arduino15/packages/STM32/hardware/stm32/2.3.0). You have to modify the files corresponding to your boards, this is just an illustration how to do.
Supposing the STM32 stm32 core version is 2.3.0. These files must be copied into the directory:
~/.arduino15/packages/STM32/hardware/stm32/2.3.0/variants/STM32F7xx/F765Z(G-I)T_F767Z(G-I)T_F777ZIT/NUCLEO_F767ZI/variant.h
for Nucleo-144 NUCLEO_F767ZI.~/.arduino15/packages/STM32/hardware/stm32/2.3.0/variants/STM32L0xx/L052R(6-8)T_L053R(6-8)T_L063R8T/NUCLEO_L053R8/variant.h
for Nucleo-64 NUCLEO_L053R8.
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz, these files must be copied into the corresponding directory:
~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/variants/STM32F7xx/F765Z(G-I)T_F767Z(G-I)T_F777ZIT/NUCLEO_F767ZI/variant.h
~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/variants/STM32L0xx/L052R(6-8)T_L053R(6-8)T_L063R8T/NUCLEO_L053R8/variant.h
If your application requires 2K+ HTML page, the current Ethernet library
must be modified if you are using W5200/W5500 Ethernet shields. W5100 is not supported for 2K+ buffer. If you use boards requiring different CS/SS pin for W5x00 Ethernet shield, for example ESP32, ESP8266, nRF52, etc., you also have to modify the following libraries to be able to specify the CS/SS pin correctly.
To fix Ethernet library
, just copy these following files into the Ethernet library
directory to overwrite the old files:
You can also use the forked and modified library at Patched Ethernet
To fix EthernetLarge library
, just copy these following files into the EthernetLarge library
directory to overwrite the old files:
You can also use the forked and modified library at Patched EthernetLarge
To fix Ethernet2 library
, just copy these following files into the Ethernet2 library
directory to overwrite the old files:
To add UDP Multicast support, necessary for the UPnP_Generic library:
You can also use the forked and modified library at Patched Ethernet2
- To fix
Ethernet3 library
, just copy these following files into theEthernet3 library
directory to overwrite the old files:
You can also use the forked and modified library at Patched Ethernet3
To be able to compile and run on nRF52 boards with ENC28J60 using UIPEthernet library, you have to copy these following files into the UIPEthernet utility
directory to overwrite the old files:
Check if you need to install the UIPthernet patch new STM32 core F3/F4 compatibility to avoid errors #include HardwareSPI.h
on some STM32 boards (Nucleo-32 F303K8, etc.)
- Standard W5x00 Ethernet_Generic library
Standard W5x00 is using Ethernet_Generic
library by default, in the sketch, just be sure to comment out or leave these #defines to be false :
#define USE_BUILTIN_ETHERNET false
#define USE_UIP_ETHERNET false
#if !(USE_BUILTIN_ETHERNET || USE_UIP_ETHERNET)
// Only one of the following to be true
#define USE_ETHERNET_GENERIC true
#define USE_ETHERNET_ESP8266 false
#define USE_ETHERNET_ENC false
#define USE_CUSTOM_ETHERNET false
#endif
#define USE_BUILTIN_ETHERNET true
#define USE_UIP_ETHERNET false
#if !(USE_BUILTIN_ETHERNET || USE_UIP_ETHERNET)
// Only one of the following to be true
#define USE_ETHERNET_GENERIC false
#define USE_ETHERNET_ESP8266 false
#define USE_ETHERNET_ENC false
#define USE_CUSTOM_ETHERNET false
#endif
#define USING_LAN8720 true
#define USE_BUILTIN_ETHERNET true
#define USE_UIP_ETHERNET false
#if !(USE_BUILTIN_ETHERNET || USE_UIP_ETHERNET)
// Only one of the following to be true
#define USE_ETHERNET_GENERIC false
#define USE_ETHERNET_ESP8266 false
#define USE_ETHERNET_ENC false
#define USE_CUSTOM_ETHERNET false
#endif
#define USE_BUILTIN_ETHERNET false
#define USE_UIP_ETHERNET false
#if !(USE_BUILTIN_ETHERNET || USE_UIP_ETHERNET)
// Only one of the following to be true
#define USE_ETHERNET_GENERIC true
#define USE_ETHERNET_ESP8266 false
#define USE_ETHERNET_ENC false
#define USE_CUSTOM_ETHERNET false
#endif
#define USE_BUILTIN_ETHERNET false
#define USE_UIP_ETHERNET false
#if !(USE_BUILTIN_ETHERNET || USE_UIP_ETHERNET)
// Only one of the following to be true
#define USE_ETHERNET_GENERIC false
#define USE_ETHERNET_ESP8266 false
#define USE_ETHERNET_ENC true
#define USE_CUSTOM_ETHERNET false
#endif
#define USE_BUILTIN_ETHERNET false
#define USE_UIP_ETHERNET true
#if !(USE_BUILTIN_ETHERNET || USE_UIP_ETHERNET)
// Only one of the following to be true
#define USE_ETHERNET_GENERIC false
#define USE_ETHERNET_ESP8266 false
#define USE_ETHERNET_ENC false
#define USE_CUSTOM_ETHERNET false
#endif
- To use another Ethernet library For example, EthernetLarge library
#define USE_BUILTIN_ETHERNET false
#define USE_UIP_ETHERNET false
#if !(USE_BUILTIN_ETHERNET || USE_UIP_ETHERNET)
// Only one of the following to be true
#define USE_ETHERNET_GENERIC false
#define USE_ETHERNET_ESP8266 false
#define USE_ETHERNET_ENC false
#define USE_CUSTOM_ETHERNET true
#endif
....
#elif USE_CUSTOM_ETHERNET
//#include "Ethernet_XYZ.h"
#include "EthernetLarge.h"
#warning Using Custom Ethernet library. You must include a library and initialize.
#define SHIELD_TYPE "Custom Ethernet & Ethernet_XYZ Library"
#else
#define USE_ETHERNET_GENERIC true
#include "Ethernet_Generic.h"
#warning Using default Ethernet_Generic lib
#define SHIELD_TYPE "W5x00 using default Ethernet_Generic Library"
#endif
...
#include <EthernetWebServer.h>
To use standard SPI, check if
#define USING_CUSTOM_SPI false
#define USING_SPI2 false
To use SPI2 or any custom SPI
// Be sure to use true only if necessary for your board, or compile error
#define USING_CUSTOM_SPI true
#if ( USING_CUSTOM_SPI )
// Currently test OK for F767ZI and L552ZE_Q
#define USING_SPI2 true
#if (USING_SPI2)
//#include <SPI.h>
// For L552ZE-Q, F767ZI, but you can change the pins for any other boards
// SCK: 23, MOSI: 22, MISO: 25, SS/CS: 24 for SPI1
#define CUR_PIN_MISO 25
#define CUR_PIN_MOSI 22
#define CUR_PIN_SCK 23
#define CUR_PIN_SS 24
#define SPI_NEW_INITIALIZED true
// Don't create the instance with CUR_PIN_SS, or Ethernet not working
// To change for other boards' SPI libraries
SPIClass SPI_New(CUR_PIN_MOSI, CUR_PIN_MISO, CUR_PIN_SCK);
//#warning Using USE_THIS_SS_PIN = CUR_PIN_SS = 24
#if defined(USE_THIS_SS_PIN)
#undef USE_THIS_SS_PIN
#endif
#define USE_THIS_SS_PIN CUR_PIN_SS //24
#endif
#endif
- The Ethernet_Shield_W5200, EtherCard, EtherSia libraries are not supported. Don't use unless you know how to modify those libraries.
- Requests to support for any future custom Ethernet library will be ignored. Use at your own risk.
The default CS/SS pin is 10 for all boards, and is configurable in code.
If the default pin is not correct, select another CS/SS pin (e.e. D22) to use as follows:
// To override the default CS/SS pin. Don't use unless you know exactly which pin to use
// You can define here or customize for each board at same place with BOARD_TYPE
#define USE_THIS_SS_PIN 22 //21 //5 //4 //2 //15
// Default pin 10 to SS/CS. To change according to your board, if necessary
//#define USE_THIS_SS_PIN 10
The current SPI pin usage can be displayed by turn on the debug option. For example:
Increase debug level to 2 in defines.h
of any example:
#define DEBUG_ETHERNET_WEBSERVER_PORT Serial
// Debug Level from 0 to 4
#define _ETHERNET_WEBSERVER_LOGLEVEL_ 2
The Debug Terminal will then show that the current SPI pin usage of NUCLEO_F767ZI ==> SS/CS: D10, MOSI: D11, MISO: D12 and SCK: D13 when using W5x00
Start AdvancedWebServer on NUCLEO_F767ZI, using W5x00 using Ethernet_Generic Library
EthernetWebServer_STM32 v1.5.0
[EWS] Board : NUCLEO_F767ZI , setCsPin: 10
[EWS] Default SPI pinout:
[EWS] MOSI: 11
[EWS] MISO: 12
[EWS] SCK: 13
[EWS] SS: 10
[EWS] =========================
Connected! IP address: 192.168.2.89
Connect the wires according to the displayed information.
- For Ethernet_Generic library only, simply use as follows to have large buffer similar to EthernetLarge library
#define ETHERNET_LARGE_BUFFERS
- For Ethernet3 library only, use as follows
// Use MAX_SOCK_NUM = 4 for 4K, 2 for 8K, 1 for 16K RX/TX buffer
#ifndef ETHERNET3_MAX_SOCK_NUM
#define ETHERNET3_MAX_SOCK_NUM 4
#endif
Ethernet.setCsPin (USE_THIS_SS_PIN);
Ethernet.init (ETHERNET3_MAX_SOCK_NUM);
sendContent_P() and send_P() buffer size is set default at 4 Kbytes, and minimum is 512 bytes. If you need to change, just add a definition, e.g.:
#define SENDCONTENT_P_BUFFER_SZ 2048
Note that the buffer size must be larger than 512 bytes. See Sending GZIP HTML ~ 120kb+ (suggested enhancement).
EthernetWebServer server(80);
Creates the EthernetWebServer class object.
Parameters:
host port number: int port
(default is the standard HTTP port 80)
Starting the server
void begin();
Handling incoming client requests
void handleClient();
Disabling the server
void close();
void stop();
Both methods function the same
Client request handlers
void on();
void addHandler();
void onNotFound();
void onFileUpload();
Example:
server.on("/", handlerFunction);
server.onNotFound(handlerFunction); // called when handler is not assigned
server.onFileUpload(handlerFunction); // handle file uploads
Sending responses to the client
void send();
void send_P();
void sendContent_P();
Parameters:
code
- HTTP response code, can be 200
or 404
, etc.
content_type
- HTTP content type, like "text/plain"
or "image/png"
, etc.
content
- actual content body
Getting information about request arguments
const String & arg();
const String & argName();
int args();
bool hasArg();
Function usage:
arg
- get request argument value, use arg("plain")
to get POST body
argName
- get request argument name
args
- get arguments count
hasArg
- check if argument exist
Getting information about request headers
const String & header();
const String & headerName();
const String & hostHeader();
int headers();
bool hasHeader();
Function usage:
header
- get request header value
headerName
- get request header name
hostHeader
- get request host header if available, else empty string
headers
- get header count
hasHeader
- check if header exist
Authentication
bool authenticate();
void requestAuthentication();
Function usage:
authenticate
- server authentication, returns true if client is authenticated else false
requestAuthentication
- sends authentication failure response to the client
Example Usage:
if(!server.authenticate(username, password))
{
server.requestAuthentication();
}
const String & uri(); // get the current uri
HTTPMethod method(); // get the current method
WiFiClient client(); // get the current client
HTTPUpload & upload(); // get the current upload
void setContentLength(); // set content length
void sendHeader(); // send HTTP header
void sendContent(); // send content
void sendContent_P(); // send content in PROGMEM
void collectHeaders(); // set the request headers to collect
void serveStatic();
size_t streamFile();
This is the Wiring for STM32F4 (BLACK_F407VE, etc.) using LAN8720
LAN8720 PHY | <---> | STM32F4 |
---|---|---|
TX1 | <---> | PB_13 |
TX_EN | <---> | PB_11 |
TX0 | <---> | PB_12 |
RX0 | <---> | PC_4 |
RX1 | <---> | PC_5 |
nINT/RETCLK | <---> | PA_1 |
CRS | <---> | PA_7 |
MDIO | <---> | PA_2 |
MDC | <---> | PC_1 |
GND | <---> | GND |
VCC | <---> | +3.3V |
Connect as follows. To program, use STM32CubeProgrammer or Arduino IDE with
- U(S)ART Support: "Enabled (generic Serial)"
- Upload Method : "STM32CubeProgrammer (SWD)"
STLink | <---> | STM32F4 |
---|---|---|
SWCLK | <---> | SWCLK |
SWDIO | <---> | SWDIO |
RST | <---> | NRST |
GND | <---> | GND |
5v | <---> | 5V |
Connect FDTI (USB to Serial) as follows:
FDTI | <---> | STM32F4 |
---|---|---|
RX | <---> | TX=PA_9 |
TX | <---> | RX=PA_10 |
GND | <---> | GND |
- AdvancedWebServer
- HelloServer
- HelloServer2
- HttpBasicAuth
- MQTTClient_Auth
- MQTTClient_Basic
- MQTT_ThingStream
- PostServer
- SimpleAuthentication
- UdpNTPClient
- UdpSendReceive
- WebClient
- WebClientRepeating
- WebServer
- multiFileProject New
- BasicAuthGet
- CustomHeader
- DweetGet
- DweetPost
- HueBlink
- node_test_server
- PostWithHeaders
- SimpleDelete
- SimpleGet
- SimpleHTTPExample
- SimplePost
- SimplePut
- SimpleWebSocket
- AdvancedWebServer_LAN8720
- HelloServer_LAN8720
- HelloServer2_LAN8720
- HttpBasicAuth_LAN8720
- MQTTClient_Auth_LAN8720
- MQTTClient_Basic_LAN8720
- MQTT_ThingStream_LAN8720
- PostServer_LAN8720
- SimpleAuthentication_LAN8720
- UdpNTPClient_LAN8720
- UdpSendReceive_LAN8720
- WebClient_LAN8720
- WebClientRepeating_LAN8720
- WebServer_LAN8720
- BasicAuthGet_LAN8720
- CustomHeader_LAN8720
- DweetGet_LAN8720
- DweetPost_LAN8720
- HueBlink_LAN8720
- node_test_server
- PostWithHeaders_LAN8720
- SimpleDelete_LAN8720
- SimpleGet_LAN8720
- SimpleHTTPExample_LAN8720
- SimplePost_LAN8720
- SimplePut_LAN8720
- SimpleWebSocket_LAN8720
Example AdvancedWebServer
1. File AdvancedWebServer.ino
EthernetWebServer_STM32/examples/AdvancedWebServer/AdvancedWebServer.ino
Lines 40 to 269 in 7b79d4d
2. File defines.h
EthernetWebServer_STM32/examples/AdvancedWebServer/defines.h
Lines 13 to 224 in 7b79d4d
Following is debug terminal output and screen shot when running example AdvancedWebServer on STM32F7 Nucleo-144 NUCLEO_F767ZI using Built-in LAN8742A Ethernet and STM32Ethernet Library
Start AdvancedWebServer on NUCLEO_F767ZI, using LAN8742A Ethernet & STM32Ethernet Library
EthernetWebServer_STM32 v1.5.0
HTTP EthernetWebServer is @ IP : 192.168.2.117
EthernetWebServer::handleClient: New Client
method: GET
url: /
search:
headerName: Host
headerValue: 192.168.2.150
headerName: Connection
headerValue: keep-alive
headerName: Cache-Control
headerValue: max-age=0
headerName: DNT
headerValue: 1
headerName: Upgrade-Insecure-Requests
headerValue: 1
headerName: User-Agent
headerValue: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36
headerName: Accept
headerValue: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
headerName: Accept-Encoding
headerValue: gzip, deflate
headerName: Accept-Language
headerValue: en-GB,en-US;q=0.9,en;q=0.8
args:
args count: 0
args:
args count: 0
Request: /
Arguments:
Final list of key/value pairs:
EthernetWebServer::_handleRequest handle
EthernetWebServer::send1: len = 341
content = <html><head><meta http-equiv='refresh' content='5'/><title>AdvancedWebServer NUCLEO_F767ZI</title><style>body { background-color: #cccccc; font-family: Arial, Helvetica, Sans-Serif; Color: #000088; }</style></head><body><h2>Hi from EthernetWebServer!</h2><h3>on NUCLEO_F767ZI</h3><p>Uptime: 0 d 00:00:31</p><img src="/test.svg" /></body></html>
EthernetWebServer::_prepareHeader sendHeader Conn close
EthernetWebServer::send1: write header = HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 341
Connection: close
EthernetWebServer::sendContent: Client.write content: <html><head><meta http-equiv='refresh' content='5'/><title>AdvancedWebServer NUCLEO_F767ZI</title><style>body { background-color: #cccccc; font-family: Arial, Helvetica, Sans-Serif; Color: #000088; }</style></head><body><h2>Hi from EthernetWebServer!</h2><h3>on NUCLEO_F767ZI</h3><p>Uptime: 0 d 00:00:31</p><img src="/test.svg" /></body></html>
EthernetWebServer::_handleRequest OK
EthernetWebServer::handleClient: Don't keepCurrentClient
EthernetWebServer::handleClient: Client disconnected
EthernetWebServer::handleClient: New Client
method: GET
url: /test.svg
search:
headerName: Host
headerValue: 192.168.2.150
headerName: Connection
headerValue: keep-alive
headerName: User-Agent
headerValue: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36
headerName: DNT
headerValue: 1
headerName: Accept
headerValue: image/webp,image/apng,image/*,*/*;q=0.8
headerName: Referer
headerValue: http://192.168.2.150/
headerName: Accept-Encoding
headerValue: gzip, deflate
headerName: Accept-Language
headerValue: en-GB,en-US;q=0.9,en;q=0.8
args:
args count: 0
args:
args count: 0
Request: /test.svg
Arguments:
Final list of key/value pairs:
EthernetWebServer::_handleRequest handle
EthernetWebServer::send1: len = 1949
content = <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="310" height="150">
<rect width="310" height="150" fill="rgb(250, 230, 210)" stroke-width="1" stroke="rgb(0, 0, 0)" />
<g stroke="black">
<line x1="10" y1="90" x2="20" y2="22" stroke-width="1" />
<line x1="20" y1="22" x2="30" y2="98" stroke-width="1" />
<line x1="30" y1="98" x2="40" y2="64" stroke-width="1" />
<line x1="40" y1="64" x2="50" y2="104" stroke-width="1" />
<line x1="50" y1="104" x2="60" y2="31" stroke-width="1" />
<line x1="60" y1="31" x2="70" y2="59" stroke-width="1" />
<line x1="70" y1="59" x2="80" y2="139" stroke-width="1" />
<line x1="80" y1="139" x2="90" y2="117" stroke-width="1" />
<line x1="90" y1="117" x2="100" y2="75" stroke-width="1" />
<line x1="100" y1="75" x2="110" y2="72" stroke-width="1" />
<line x1="110" y1="72" x2="120" y2="137" stroke-width="1" />
<line x1="120" y1="137" x2="130" y2="20" stroke-width="1" />
<line x1="130" y1="20" x2="140" y2="94" stroke-width="1" />
<line x1="140" y1="94" x2="150" y2="81" stroke-width="1" />
<line x1="150" y1="81" x2="160" y2="38" stroke-width="1" />
<line x1="160" y1="38" x2="170" y2="33" stroke-width="1" />
<line x1="170" y1="33" x2="180" y2="53" stroke-width="1" />
<line x1="180" y1="53" x2="190" y2="88" stroke-width="1" />
<line x1="190" y1="88" x2="200" y2="32" stroke-width="1" />
<line x1="200" y1="32" x2="210" y2="110" stroke-width="1" />
<line x1="210" y1="110" x2="220" y2="87" stroke-width="1" />
<line x1="220" y1="87" x2="230" y2="11" stroke-width="1" />
<line x1="230" y1="11" x2="240" y2="98" stroke-width="1" />
<line x1="240" y1="98" x2="250" y2="76" stroke-width="1" />
<line x1="250" y1="76" x2="260" y2="121" stroke-width="1" />
<line x1="260" y1="121" x2="270" y2="139" stroke-width="1" />
<line x1="270" y1="139" x2="280" y2="103" stroke-width="1" />
<line x1="280" y1="103" x2="290" y2="60" stroke-width="1" />
<line x1="290" y1="60" x2="300" y2="36" stroke-width="1" />
</g>
</svg>
EthernetWebServer::_prepareHeader sendHeader Conn close
EthernetWebServer::send1: write header = HTTP/1.1 200 OK
Content-Type: image/svg+xml
Content-Length: 1949
Connection: close
The following is debug terminal output when running example WebClientRepeating on STM32F7 Nucleo-144 NUCLEO_F767ZI using ENC28J60 and new EthernetENC Library
Start WebClientRepeating on NUCLEO_F767ZI, using ENC28J60 & EthernetENC Library
EthernetWebServer_STM32 v1.5.0
[EWS] Board : NUCLEO_F767ZI , setCsPin: 10
[EWS] Default SPI pinout:
[EWS] MOSI: 11
[EWS] MISO: 12
[EWS] SCK: 13
[EWS] SS: 10
[EWS] =========================
You're connected to the network, IP = 192.168.2.123
Connecting...
HTTP/1.1 200 OK
Date: Wed, 27 Apr 2022 17:12:43 GMT
Content-Type: text/plain
Content-Length: 2263
Connection: close
x-amz-id-2: Y0KDwqmE5CUvFMSLnxWUV4XoqEDCUL1h9GN+vWHRz7vpjDK77h8fqAbuEqBXVEZRm3Ybv7bCZtE=
x-amz-request-id: EFJSRB21CQFZQDRX
Last-Modified: Wed, 23 Feb 2022 14:56:42 GMT
ETag: "667cf48afcc12c38c8c1637947a04224"
CF-Cache-Status: DYNAMIC
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=T2F7koaxDm8y3draFWHzKSKtqF3brIseyVbvIpy%2FDp4RGAh7d6Lc%2F7rw%2B96w7hYckhvRgN1l9sMJJuNuQCxG8JZeCIelNLNXDBKH5BJajxjC7kMiQ3PwdUm8jFr%2B0aA%3D"}],"group":"cf-nel","max_age":604800}
NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Server: cloudflare
CF-RAY: 70292f44ceb3a253-YYZ
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
`:;;;,` .:;;:.
.;;;;;;;;;;;` :;;;;;;;;;;: TM
`;;;;;;;;;;;;;;;` :;;;;;;;;;;;;;;;
:;;;;;;;;;;;;;;;;;; `;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;; .;;;;;;;;;;;;;;;;;;;;
;;;;;;;;:` `;;;;;;;;; ,;;;;;;;;.` .;;;;;;;;
.;;;;;;, :;;;;;;; .;;;;;;; ;;;;;;;
;;;;;; ;;;;;;; ;;;;;;, ;;;;;;.
,;;;;; ;;;;;;.;;;;;;` ;;;;;;
;;;;;. ;;;;;;;;;;;` ``` ;;;;;`
;;;;; ;;;;;;;;;, ;;; .;;;;;
`;;;;: `;;;;;;;; ;;; ;;;;;
,;;;;` `,,,,,,,, ;;;;;;; .,,;;;,,, ;;;;;
:;;;;` .;;;;;;;; ;;;;;, :;;;;;;;; ;;;;;
:;;;;` .;;;;;;;; `;;;;;; :;;;;;;;; ;;;;;
.;;;;. ;;;;;;;. ;;; ;;;;;
;;;;; ;;;;;;;;; ;;; ;;;;;
;;;;; .;;;;;;;;;; ;;; ;;;;;,
;;;;;; `;;;;;;;;;;;; ;;;;;
`;;;;;, .;;;;;; ;;;;;;; ;;;;;;
;;;;;;: :;;;;;;. ;;;;;;; ;;;;;;
;;;;;;;` .;;;;;;;, ;;;;;;;; ;;;;;;;:
;;;;;;;;;:,:;;;;;;;;;: ;;;;;;;;;;:,;;;;;;;;;;
`;;;;;;;;;;;;;;;;;;;. ;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;; :;;;;;;;;;;;;;;;;:
,;;;;;;;;;;;;;, ;;;;;;;;;;;;;;
.;;;;;;;;;` ,;;;;;;;;:
;;; ;;;;;` ;;;;: .;; ;; ,;;;;;, ;;. `;, ;;;;
;;; ;;:;;; ;;;;;; .;; ;; ,;;;;;: ;;; `;, ;;;:;;
,;:; ;; ;; ;; ;; .;; ;; ,;, ;;;,`;, ;; ;;
;; ;: ;; ;; ;; ;; .;; ;; ,;, ;;;;`;, ;; ;;.
;: ;; ;;;;;: ;; ;; .;; ;; ,;, ;;`;;;, ;; ;;`
,;;;;; ;;`;; ;; ;; .;; ;; ,;, ;; ;;;, ;; ;;
;; ,;, ;; .;; ;;;;;: ;;;;;: ,;;;;;: ;; ;;, ;;;;;;
;; ;; ;; ;;` ;;;;. `;;;: ,;;;;;, ;; ;;, ;;;;
Disconnecting from server...
The following is debug terminal output when running example UdpNTPClient on STM32F7 Nucleo-144 NUCLEO_F767ZI using W5500 and Ethernet_Generic Library
Start UdpNTPClient on NUCLEO_F767ZI, using W5x00 & Ethernet_Generic Library
Ethernet_Generic v2.7.1
EthernetWebServer_STM32 v1.5.0
[EWS] Board : NUCLEO_F767ZI , setCsPin: 10
[EWS] Default SPI pinout:
[EWS] MOSI: 11
[EWS] MISO: 12
[EWS] SCK: 13
[EWS] SS: 10
[EWS] =========================
You're connected to the network, IP = 192.168.2.123
UDP Packet received, size 48
From 132.163.97.1, port 123
Seconds since Jan 1 1900 = 3809283621
Unix time = 1600294821
The UTC time is 22:20:21
The terminal output of STM32F7 Nucleo-144 NUCLEO_F767ZI with LAN8742A Ethernet & STM32Ethernet Library running SimpleWebSocket example to demonstrate newly-added WebSocket Client feature.
Starting SimpleWebSocket on NUCLEO_F767ZI with LAN8742A Ethernet & STM32Ethernet Library
EthernetWebServer_STM32 v1.5.0
Using mac index = 10
Connected! IP address: 192.168.2.139
starting WebSocket client
Sending Hello 0
Sending Hello 1
Received a message:
0 => Hello from SimpleWebSocket on NUCLEO_F767ZI, millis = 7297
Sending Hello 2
Received a message:
1 => Hello from SimpleWebSocket on NUCLEO_F767ZI, millis = 12297
Sending Hello 3
Received a message:
2 => Hello from SimpleWebSocket on NUCLEO_F767ZI, millis = 17300
Sending Hello 4
Received a message:
3 => Hello from SimpleWebSocket on NUCLEO_F767ZI, millis = 22303
Sending Hello 5
Received a message:
4 => Hello from SimpleWebSocket on NUCLEO_F767ZI, millis = 27306
The terminal output of STM32F7 Nucleo-144 NUCLEO_F767ZI with W5x00 & Ethernet_Generic Library running SimpleWebSocket example to demonstrate newly-added WebSocket Client feature.
Starting SimpleWebSocket on NUCLEO_F767ZI with W5x00 & Ethernet_Generic Library
Ethernet_Generic v2.7.1
EthernetWebServer_STM32 v1.5.0
[EWS] =========== USE_Ethernet_Generic ===========
[EWS] Default SPI pinout:
[EWS] MOSI: 11
[EWS] MISO: 12
[EWS] SCK: 13
[EWS] SS: 10
[EWS] =========================
Connected! IP address: 192.168.2.139
starting WebSocket client
Sending Hello 0
Sending Hello 1
Received a message:
0 => Hello from SimpleWebSocket on NUCLEO_F767ZI, millis = 2390
Sending Hello 2
Received a message:
1 => Hello from SimpleWebSocket on NUCLEO_F767ZI, millis = 7391
Sending Hello 3
Received a message:
2 => Hello from SimpleWebSocket on NUCLEO_F767ZI, millis = 12399
Sending Hello 4
Received a message:
3 => Hello from SimpleWebSocket on NUCLEO_F767ZI, millis = 17407
Sending Hello 5
Received a message:
4 => Hello from SimpleWebSocket on NUCLEO_F767ZI, millis = 22416
Sending Hello 6
Received a message:
5 => Hello from SimpleWebSocket on NUCLEO_F767ZI, millis = 27425
The terminal output of STM32F7 Nucleo-144 NUCLEO_F767ZI with LAN8742A Ethernet & STM32Ethernet Library running SimpleHTTPExample example to demonstrate newly-added HTTP Client feature.
Starting SimpleHTTPExample on NUCLEO_F767ZI with LAN8742A Ethernet & STM32Ethernet Library
EthernetWebServer_STM32 v1.5.0
Connected! IP address: 192.168.2.139
startedRequest ok
Got status code: 200
Content length is: 2263
Body returned follows:
`:;;;,` .:;;:.
.;;;;;;;;;;;` :;;;;;;;;;;: TM
`;;;;;;;;;;;;;;;` :;;;;;;;;;;;;;;;
:;;;;;;;;;;;;;;;;;; `;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;; .;;;;;;;;;;;;;;;;;;;;
;;;;;;;;:` `;;;;;;;;; ,;;;;;;;;.` .;;;;;;;;
.;;;;;;, :;;;;;;; .;;;;;;; ;;;;;;;
;;;;;; ;;;;;;; ;;;;;;, ;;;;;;.
,;;;;; ;;;;;;.;;;;;;` ;;;;;;
;;;;;. ;;;;;;;;;;;` ``` ;;;;;`
;;;;; ;;;;;;;;;, ;;; .;;;;;
`;;;;: `;;;;;;;; ;;; ;;;;;
,;;;;` `,,,,,,,, ;;;;;;; .,,;;;,,, ;;;;;
:;;;;` .;;;;;;;; ;;;;;, :;;;;;;;; ;;;;;
:;;;;` .;;;;;;;; `;;;;;; :;;;;;;;; ;;;;;
.;;;;. ;;;;;;;. ;;; ;;;;;
;;;;; ;;;;;;;;; ;;; ;;;;;
;;;;; .;;;;;;;;;; ;;; ;;;;;,
;;;;;; `;;;;;;;;;;;; ;;;;;
`;;;;;, .;;;;;; ;;;;;;; ;;;;;;
;;;;;;: :;;;;;;. ;;;;;;; ;;;;;;
;;;;;;;` .;;;;;;;, ;;;;;;;; ;;;;;;;:
;;;;;;;;;:,:;;;;;;;;;: ;;;;;;;;;;:,;;;;;;;;;;
`;;;;;;;;;;;;;;;;;;;. ;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;; :;;;;;;;;;;;;;;;;:
,;;;;;;;;;;;;;, ;;;;;;;;;;;;;;
.;;;;;;;;;` ,;;;;;;;;:
;;; ;;;;;` ;;;;: .;; ;; ,;;;;;, ;;. `;, ;;;;
;;; ;;:;;; ;;;;;; .;; ;; ,;;;;;: ;;; `;, ;;;:;;
,;:; ;; ;; ;; ;; .;; ;; ,;, ;;;,`;, ;; ;;
;; ;: ;; ;; ;; ;; .;; ;; ,;, ;;;;`;, ;; ;;.
;: ;; ;;;;;: ;; ;; .;; ;; ,;, ;;`;;;, ;; ;;`
,;;;;; ;;`;; ;; ;; .;; ;; ,;, ;; ;;;, ;; ;;
;; ,;, ;; .;; ;;;;;: ;;;;;: ,;;;;;: ;; ;;, ;;;;;;
;; ;; ;; ;;` ;;;;. `;;;: ,;;;;;, ;; ;;, ;;;;
The terminal output of STM32F7 Nucleo-144 NUCLEO_F767ZI with LAN8742A Ethernet & STM32Ethernet Library running MQTTClient_Auth example to demonstrate newly-added HTTP Client feature.
Start MQTTClient_Auth on NUCLEO_F767ZI with LAN8742A Ethernet & STM32Ethernet Library
EthernetWebServer_STM32 v1.5.0
Connected! IP address: 192.168.2.152
Attempting MQTT connection to broker.emqx.io...connected
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on NUCLEO_F767ZI with LAN8742A Ethernet & STM32Ethernet Library
Message arrived [MQTT_Pub] Hello from MQTTClient_Auth on NUCLEO_F767ZI with LAN8742A Ethernet & STM32Ethernet Library
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on NUCLEO_F767ZI with LAN8742A Ethernet & STM32Ethernet Library
Message arrived [MQTT_Pub] Hello from MQTTClient_Auth on NUCLEO_F767ZI with LAN8742A Ethernet & STM32Ethernet Library
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on NUCLEO_F767ZI with LAN8742A Ethernet & STM32Ethernet Library
Message arrived [MQTT_Pub] Hello from MQTTClient_Auth on NUCLEO_F767ZI with LAN8742A Ethernet & STM32Ethernet Library
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on NUCLEO_F767ZI with LAN8742A Ethernet & STM32Ethernet Library
Message arrived [MQTT_Pub] Hello from MQTTClient_Auth on NUCLEO_F767ZI with LAN8742A Ethernet & STM32Ethernet Library
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on NUCLEO_F767ZI with LAN8742A Ethernet & STM32Ethernet Library
Message arrived [MQTT_Pub] Hello from MQTTClient_Auth on NUCLEO_F767ZI with LAN8742A Ethernet & STM32Ethernet Library
The terminal output of STM32F7 Nucleo-144 NUCLEO_F767ZI with ENC28J60 & EthernetENC Library running MQTTClient_Auth example to demonstrate newly-added HTTP Client feature.
Start MQTTClient_Auth on NUCLEO_F767ZI with ENC28J60 & EthernetENC Library
EthernetWebServer_STM32 v1.5.0
[EWS] =========== USE_ETHERNET_ENC ===========
[EWS] Default SPI pinout:
[EWS] MOSI: 11
[EWS] MISO: 12
[EWS] SCK: 13
[EWS] SS: 10
[EWS] =========================
[EWS] Board : NUCLEO_F767ZI , setCsPin: 10
C=========================
Currently Used SPI pinout:
MOSI:11
MISO:12
SCK:13
SS:10
=========================
Using mac index = 13
Connected! IP address: 192.168.2.152
Attempting MQTT connection to broker.emqx.io...connected
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on NUCLEO_F767ZI with ENC28J60 & EthernetENC Library
Message arrived [MQTT_Pub] Hello from MQTTClient_Auth on NUCLEO_F767ZI with ENC28J60 & EthernetENC Library
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on NUCLEO_F767ZI with ENC28J60 & EthernetENC Library
Message arrived [MQTT_Pub] Hello from MQTTClient_Auth on NUCLEO_F767ZI with ENC28J60 & EthernetENC Library
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on NUCLEO_F767ZI with ENC28J60 & EthernetENC Library
Message arrived [MQTT_Pub] Hello from MQTTClient_Auth on NUCLEO_F767ZI with ENC28J60 & EthernetENC Library
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on NUCLEO_F767ZI with ENC28J60 & EthernetENC Library
Message arrived [MQTT_Pub] Hello from MQTTClient_Auth on NUCLEO_F767ZI with ENC28J60 & EthernetENC Library
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on NUCLEO_F767ZI with ENC28J60 & EthernetENC Library
Message arrived [MQTT_Pub] Hello from MQTTClient_Auth on NUCLEO_F767ZI with ENC28J60 & EthernetENC Library
The terminal output of STM32F7 Nucleo-144 NUCLEO_F767ZI with W5x00 & Ethernet_Generic Library running MQTTClient_Auth example to demonstrate newly-added HTTP Client feature.
Start MQTTClient_Auth on NUCLEO_F767ZI with W5x00 & Ethernet_Generic Library
Ethernet_Generic v2.7.1
EthernetWebServer_STM32 v1.5.0
[EWS] =========== USE_Ethernet_Generic ===========
[EWS] Default SPI pinout:
[EWS] MOSI: 11
[EWS] MISO: 12
[EWS] SCK: 13
[EWS] SS: 10
[EWS] =========================
Connected! IP address: 192.168.2.78
Attempting MQTT connection to broker.emqx.io...connected
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on NUCLEO_F767ZI with W5x00 & Ethernet_Generic Library
Message arrived [MQTT_Pub] Hello from MQTTClient_Auth on NUCLEO_F767ZI with W5x00 & Ethernet_Generic Library
Message Send : MQTT_Pub => Hello from MQTTClient_Auth on NUCLEO_F767ZI with W5x00 & Ethernet_Generic Library
Message arrived [MQTT_Pub] Hello from MQTTClient_Auth on NUCLEO_F767ZI with W5x00 & Ethernet_Generic Library
The terminal output of STM32F4 BLACK_F407VE with LAN8720 Ethernet and STM32Ethernet Library running SimpleWebSocket_LAN8720 example to demonstrate newly-added HTTP Client feature.
Starting SimpleWebSocket_LAN8720 on BLACK_F407VE with LAN8720 Ethernet & STM32Ethernet Library
EthernetWebServer_STM32 v1.5.0
Using mac index = 6
Connected! IP address: 192.168.2.138
starting WebSocket client
disconnected
starting WebSocket client
Sending Hello 0
Sending Hello 1
Received a message:
0 => Hello from SimpleWebSocket on BLACK_F407VE using LAN8720, millis = 16685
Sending Hello 2
Received a message:
1 => Hello from SimpleWebSocket on BLACK_F407VE using LAN8720, millis = 21685
Sending Hello 3
Received a message:
2 => Hello from SimpleWebSocket on BLACK_F407VE using LAN8720, millis = 26690
The terminal output of BLACK_F407VE using LAN8720 Ethernet and STM32Ethernet Library running WebClient_LAN8720 example to demonstrate newly-added HTTP Client feature.
Start WebClient_LAN8720 on BLACK_F407VE, using LAN8720 Ethernet & STM32Ethernet Library
EthernetWebServer_STM32 v1.5.0
You're connected to the network, IP = 192.168.2.139
Connecting...
HTTP/1.1 200 OK
Date: Wed, 27 Apr 2022 17:12:43 GMT
Content-Type: text/plain
Content-Length: 2263
Connection: close
x-amz-id-2: Y0KDwqmE5CUvFMSLnxWUV4XoqEDCUL1h9GN+vWHRz7vpjDK77h8fqAbuEqBXVEZRm3Ybv7bCZtE=
x-amz-request-id: EFJSRB21CQFZQDRX
Last-Modified: Wed, 23 Feb 2022 14:56:42 GMT
ETag: "667cf48afcc12c38c8c1637947a04224"
CF-Cache-Status: DYNAMIC
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=T2F7koaxDm8y3draFWHzKSKtqF3brIseyVbvIpy%2FDp4RGAh7d6Lc%2F7rw%2B96w7hYckhvRgN1l9sMJJuNuQCxG8JZeCIelNLNXDBKH5BJajxjC7kMiQ3PwdUm8jFr%2B0aA%3D"}],"group":"cf-nel","max_age":604800}
NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
Server: cloudflare
CF-RAY: 70292f44ceb3a253-YYZ
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
`:;;;,` .:;;:.
.;;;;;;;;;;;` :;;;;;;;;;;: TM
`;;;;;;;;;;;;;;;` :;;;;;;;;;;;;;;;
:;;;;;;;;;;;;;;;;;; `;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;; .;;;;;;;;;;;;;;;;;;;;
;;;;;;;;:` `;;;;;;;;; ,;;;;;;;;.` .;;;;;;;;
.;;;;;;, :;;;;;;; .;;;;;;; ;;;;;;;
;;;;;; ;;;;;;; ;;;;;;, ;;;;;;.
,;;;;; ;;;;;;.;;;;;;` ;;;;;;
;;;;;. ;;;;;;;;;;;` ``` ;;;;;`
;;;;; ;;;;;;;;;, ;;; .;;;;;
`;;;;: `;;;;;;;; ;;; ;;;;;
,;;;;` `,,,,,,,, ;;;;;;; .,,;;;,,, ;;;;;
:;;;;` .;;;;;;;; ;;;;;, :;;;;;;;; ;;;;;
:;;;;` .;;;;;;;; `;;;;;; :;;;;;;;; ;;;;;
.;;;;. ;;;;;;;. ;;; ;;;;;
;;;;; ;;;;;;;;; ;;; ;;;;;
;;;;; .;;;;;;;;;; ;;; ;;;;;,
;;;;;; `;;;;;;;;;;;; ;;;;;
`;;;;;, .;;;;;; ;;;;;;; ;;;;;;
;;;;;;: :;;;;;;. ;;;;;;; ;;;;;;
;;;;;;;` .;;;;;;;, ;;;;;;;; ;;;;;;;:
;;;;;;;;;:,:;;;;;;;;;: ;;;;;;;;;;:,;;;;;;;;;;
`;;;;;;;;;;;;;;;;;;;. ;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;; :;;;;;;;;;;;;;;;;:
,;;;;;;;;;;;;;, ;;;;;;;;;;;;;;
.;;;;;;;;;` ,;;;;;;;;:
;;; ;;;;;` ;;;;: .;; ;; ,;;;;;, ;;. `;, ;;;;
;;; ;;:;;; ;;;;;; .;; ;; ,;;;;;: ;;; `;, ;;;:;;
,;:; ;; ;; ;; ;; .;; ;; ,;, ;;;,`;, ;; ;;
;; ;: ;; ;; ;; ;; .;; ;; ,;, ;;;;`;, ;; ;;.
;: ;; ;;;;;: ;; ;; .;; ;; ,;, ;;`;;;, ;; ;;`
,;;;;; ;;`;; ;; ;; .;; ;; ,;, ;; ;;;, ;; ;;
;; ,;, ;; .;; ;;;;;: ;;;;;: ,;;;;;: ;; ;;, ;;;;;;
;; ;; ;; ;;` ;;;;. `;;;: ,;;;;;, ;; ;;, ;;;;
Disconnecting from server...
Following is debug terminal output and screen shot when running example AdvancedWebServer_LAN8720 on BLACK_F407VE, using LAN8720 Ethernet and STM32Ethernet Library
Start AdvancedWebServer_LAN8720 on BLACK_F407VE, using LAN8720 Ethernet & STM32Ethernet Library
EthernetWebServer_STM32 v1.5.0
.[EWS] String Len = 0, extend to 2048
......... .......... .......... .......... .......... .......... .......... ..........
Following is debug terminal output and screen shot when running example AdvancedWebServer on NUCLEO_L552ZE_Q, using W5500 Ethernet with Ethernet_Generic Library and custom SPI
Start AdvancedWebServer on NUCLEO_L552ZE_Q, with W5x00 using Ethernet_Generic Library and custom SPI
Ethernet_Generic v2.7.1
EthernetWebServer_STM32 v1.5.0
[EWS] Default SPI pinout:
[EWS] MOSI: 22
[EWS] MISO: 25
[EWS] SCK: 23
[EWS] SS: 24
[EWS] =========================
Connected! IP address: 192.168.2.116
HTTP EthernetWebServer is @ IP : 192.168.2.116
.[EWS] String Len = 0, extend to 2048
........ ....
Debug is enabled by default on Serial. Debug Level from 0 to 4. To disable, change the ETHERNET_WEBSERVER_LOGLEVEL to 0
// Use this to output debug msgs to Serial
#define DEBUG_ETHERNET_WEBSERVER_PORT Serial
// Use this to disable all output debug msgs
// Debug Level from 0 to 4
#define _ETHERNET_WEBSERVER_LOGLEVEL_ 0
If you get compilation errors, more often than not, you may need to install a newer version of the board's core, applying Libraries' Patches, Packages' Patches or this library latest version.
These boards are not supported:
- Some Nucleo-32 (small Flash/memory)
- Eval (no Serial, just need to redefine in sketch, library and UIPEthernet)
- Generic STM32F0 (small Flash/memory)
- Generic STM32F1 (with 64-K Flash): C6
- Generic STM32F3 : no HardwareSPI.h
- Electronics Speed Controllers (small Flash/memory)
Submit issues to: EthernetWebServer_STM32 issues
- Bug Searching and Killing
- Support more non-compatible Ethernet Libraries such as Ethernet_Shield_W5200, EtherCard, EtherSia
- Add mDNS features.
- Add support to STM32F1,2,3,4,7 boards with 64K+ Flash.
- Add support to built-in Ethernet LAN8742A using STM32Ethernet library, for boards such as Nucleo-144 NUCLEO_F767ZI.
- Add support to Ethernet W5x00, using either
Ethernet
,Ethernet2
,Ethernet3
orEthernetLarge
library - Add support to Ethernet ENC28J60, using
EthernetENC
orUIPEthernet
library - Add support to all STM32 boards (STM32F/L/H/G/WB/MP1) with 32K+ Flash.
- Add High-level HTTP (GET, POST, PUT, PATCH, DELETE) and WebSocket Client
- Add SSL/TLS Server support in EthernetWebServer_SSL_STM32
- Add support to Ethernet LAN8720 using STM32Ethernet library, for boards such as Nucleo-144 (F429ZI, NUCLEO_F746NG, NUCLEO_F746ZG, NUCLEO_F756ZG), Discovery (DISCO_F746NG) and STM32F4 boards (BLACK_F407VE, BLACK_F407VG, BLACK_F407ZE, BLACK_F407ZG, BLACK_F407VE_Mini, DIYMORE_F407VGT, FK407M1)
- Reduce usage of Arduino String with std::string
- Optimize library code and examples by using reference-passing instead of value-passing
- Fix authenticate issue and compiler warnings caused by libb64
- Use new Ethernet_Generic library as default for W5x00.
- Rewrite library and add example multiFileProject to demo for multiple-file project to fix
multiple-definitions
linker error - Change from
arduino.cc
toarduino.tips
in examples - Add support to any custom hardware / software
SPI
for W5x00 using Ethernet_Generic Library - Add support to STM32L5 boards, such as
Nucleo-L552ZE-Q
- Based on and modified from Ivan Grokhotkov's ESP8266WebServer
- Juraj Andrássy for
EthernetENC
and UIPEthernet library - Thanks to Miguel Alexandre Wisintainer to help debug and test.
- Thanks to Aron N. to initiate Sending GZIP HTML ~ 120kb+ (suggested enhancement), to help code and test the solution, to add support to PROGMEM-related commands, such as sendContent_P() and send_P(), leading to v1.0.6.
- Adrian McEwen for HttpClient Library on which the ArduinoHttpClient Library and this EthernetWebServer library are relied.
⭐️ Ivan Grokhotkov |
⭐️ Adrian McEwen |
⭐️ Juraj Andrássy |
⭐️ Miguel Wisintainer |
⭐️ Aron N. |
If you want to contribute to this project:
- Report bugs and errors
- Ask for enhancements
- Create issues and pull requests
- Tell other people about this library
- The library is licensed under MIT
Copyright (c) 2020- Khoi Hoang