khoih-prog / BlynkEthernet_STM32_WM

Simple Blynk Credentials Manager for STM32 boards using builtin Etherrnet LAN8742A, ENC28J60 or W5x00 Ethernet shields, with or without SSL, configuration data saved in EEPROM.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BlynkEthernet_STM32_WM

arduino-library-badge GitHub release GitHub contributions welcome GitHub issues



Table of Contents



Why do we need this BlynkEthernet_STM32_WM library

Features

This is a Blynk and Credentials Manager Library for configuring/auto(re)connecting STM32F/L/H/G/WB/MP1 boards to available MultiBlynk servers at runtime. Connection is with or without SSL. Configuration data to be saved in integrated-EEPROM or emulated-EEPROM using FlashStorage_STM32 Library. Default Credentials as well as Dynamic custom Parameters can be added and modified easily without coding knowledge.

DoubleResetDetector is used to force Config Portal opening even if the Credentials are still valid.

Already updated and tested with latest STM32 core v2.0.0

This is the new library, adding to the current Blynk_WiFiManager. It's designed to help you eliminate hardcoding your Blynk credentials in STM32F/L/H/G/WB/MP1 boards using Ethernet shields (W5100, W5200, W5500, ENC28J60, LAN8720, built-in LAN8742A Ethernet). It's currently not supporting SSL. Will support soon.

  • You can update Blynk Credentials any time you need to change via Configure Portal. Data are saved in configurable locations in integrated or emulated EEPROM using FlashStorage_STM32 library
  • DoubleDetectDetector feature to force Config Portal when double reset is detected within predetermined time, default 10s.
  • Configurable Config Portal Title to be either BoardName or default undistinguishable names.
  • Examples are redesigned to separate Credentials / Defines / Dynamic Params / Code so that you can change Credentials / Dynamic Params quickly for each device toconnect to local or Cloud Blynk Servers.

New recent features:

  • MultiBlynk feature for configuring/auto(re)connecting boards to one of the available MultiBlynk Servers at runtime.
  • DoubleDetectDetector feature to force Config Portal when double reset is detected within predetermined time, default 10s.
  • Configurable Config Portal Title to be either BoardName or default undistinguishable names.
  • Examples are redesigned to separate Credentials / Defines / Dynamic Params / Code so that you can change Credentials / Dynamic Params quickly for each device

Currently supported Boards

  1. STM32 boards with built-in Ethernet LAN8742A such as :
  1. 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
  • STM32G0, STM32G4
  • STM32H7
  • STM32WB
  • STM32MP1
  • LoRa boards
  • 3-D printer boards
  • Generic Flight Controllers
  • Midatronics boards
  1. 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)

Currently Supported Ethernet shields/modules:

  1. Built-in Ethernet LAN8742A using STM32Ethernet library
  2. W5x00 using Ethernet, EthernetLarge, Ethernet2 or Ethernet3 library
  3. ENC28J60 using EthernetENC or UIPEthernet library
  4. LAN8720 using STM32Ethernet and LwIP libraries.

Not supported boards

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)


Prerequisites

  1. Arduino IDE 1.8.19+ for Arduino. GitHub release
  2. Blynk library 1.0.1+. Latest release
  3. Arduino Core for STM32 v2.2.0+ for STM32 boards. GitHub release
  4. For LAN8720 or built-in LAN8742A Ethernet:
  1. For W5x00 Ethernet:
  1. For ENC28J60 Ethernet:
  1. EthernetWebServer_STM32 library v1.3.3+. To install, check arduino-library-badge.
  2. FlashStorage_STM32 library v1.2.0+. To install, check arduino-library-badge.
  3. DoubleResetDetector_Generic library v1.8.0+. To install. check arduino-library-badge.
  4. Functional-Vlpp library v1.0.2+ to use server's lambda function. To install. check arduino-library-badge


Installation

Use Arduino Library Manager

The best way is to use Arduino Library Manager. Search for BlynkEthernet_STM32_Manager, then select / install the latest version. You can also use this link arduino-library-badge for more detailed instructions.

Then copy BlynkDetectDevice.h to folder ~/Arduino/libraries/Blynk/src/Blynk to overwrite the original file BlynkDetectDevice.h.

Manual Install

  1. Navigate to BlynkEthernet_STM32_Manager page.
  2. Download the latest release BlynkEthernet_STM32_WM-master.zip.
  3. Extract the zip file to BlynkEthernet_STM32_WM-master directory
  4. Copy whole
  • BlynkEthernet_STM32_WM-master/src folder to Arduino libraries' directory such as ~/Arduino/libraries/.

Then copy BlynkDetectDevice.h to folder ~/Arduino/libraries/Blynk/src/Blynk to overwrite the original file BlynkDetectDevice.h. By doing this, the correct board type can be displayed correctly along with Blynk logo as follows:

    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on STM32 NUCLEO_F767ZI

not just unknown Arduino board type:

    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on Arduino

VS Code & PlatformIO

  1. Install VS Code
  2. Install PlatformIO
  3. Install BlynkEthernet_STM32_WM library or BlynkEthernet_STM32_WM library by using Library Manager. Search for BlynkEthernet_STM32_WM in Platform.io Author's Libraries
  4. 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


Packages' Patches

1. For STM32 boards to use LAN8720

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.1.0/system) to overwrite the old files.

Supposing the STM32 stm32 core version is 2.1.0. These files must be copied into the directory:

  • ~/.arduino15/packages/STM32/hardware/stm32/2.1.0/system/STM32F4xx/stm32f4xx_hal_conf_default.h for STM32F4.
  • ~/.arduino15/packages/STM32/hardware/stm32/2.1.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, theses 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

2. For STM32 boards to use Serial1

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.1.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.1.0. These files must be copied into the directory:

  • ~/.arduino15/packages/STM32/hardware/stm32/2.1.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.1.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, theses 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

Libraries' Patches

1. For application requiring 2K+ HTML page

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.

2. For Ethernet library

To fix Ethernet library, just copy these following files into the Ethernet library directory to overwrite the old files:

3. For EthernetLarge library

To fix EthernetLarge library, just copy these following files into the EthernetLarge library directory to overwrite the old files:

4. For Ethernet2 library

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:

5. For Ethernet3 library

  1. To fix Ethernet3 library, just copy these following files into the Ethernet3 library directory to overwrite the old files:

6. For UIPEthernet library

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:

7. Optional UIPEthernet patch

Check if you need to install the UIPEthernet patch new STM32 core F3/F4 compatibility to avoid errors #include HardwareSPI.h on some STM32 boards (Nucleo-32 F303K8, etc.)



Configuration Notes

1. How to select which built-in Ethernet or shield to use

Select one and only one Ethernet library to use as follows:

  • Standard W5x00 Ethernet library

Standard W5x00 using Ethernet library is used 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          false
  #define USE_ETHERNET2         false
  #define USE_ETHERNET3         false
  #define USE_ETHERNET_LARGE    false
  #define USE_ETHERNET_ESP8266  false
  #define USE_ETHERNET_ENC      false
  #define USE_CUSTOM_ETHERNET   false
#endif

To use built-in LAN8742A

#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          false
  #define USE_ETHERNET2         false
  #define USE_ETHERNET3         false
  #define USE_ETHERNET_LARGE    false
  #define USE_ETHERNET_ESP8266  false
  #define USE_ETHERNET_ENC      false
  #define USE_CUSTOM_ETHERNET   false
#endif

To use LAN8720

#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          false
  #define USE_ETHERNET2         false
  #define USE_ETHERNET3         false
  #define USE_ETHERNET_LARGE    false
  #define USE_ETHERNET_ESP8266  false
  #define USE_ETHERNET_ENC      false
  #define USE_CUSTOM_ETHERNET   false
#endif

To use W5x00 Ethernet, for example using 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          false
  #define USE_ETHERNET2         false
  #define USE_ETHERNET3         false
  #define USE_ETHERNET_LARGE    true
  #define USE_ETHERNET_ESP8266  false
  #define USE_ETHERNET_ENC      false
  #define USE_CUSTOM_ETHERNET   false
#endif

To use ENC28J60 Ethernet, using EthernetENC library (NEW and Better)

#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          false
  #define USE_ETHERNET2         false
  #define USE_ETHERNET3         false
  #define USE_ETHERNET_LARGE    false
  #define USE_ETHERNET_ESP8266  false
  #define USE_ETHERNET_ENC      true
  #define USE_CUSTOM_ETHERNET   false
#endif

To use ENC28J60 Ethernet, using UIPEthernet library

#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          false
  #define USE_ETHERNET2         false
  #define USE_ETHERNET3         false
  #define USE_ETHERNET_LARGE    false
  #define USE_ETHERNET_ESP8266  false
  #define USE_ETHERNET_ENC      false
  #define USE_CUSTOM_ETHERNET   false
#endif
  • To use any of the Ethernet libraries, such as Ethernet2, Ethernet3, EthernetLarge, EthernetENC:
#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          false
  #define USE_ETHERNET2         true
  #define USE_ETHERNET3         false
  #define USE_ETHERNET_LARGE    false
  #define USE_ETHERNET_ESP8266  false
  #define USE_ETHERNET_ENC      false
  #define USE_CUSTOM_ETHERNET   false
#endif
  • To use another Ethernet library For example, Ethernet_XYZ library uses Ethernet_XYZ.h
#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          false
  #define USE_ETHERNET2         false
  #define USE_ETHERNET3         false
  #define USE_ETHERNET_LARGE    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 "EthernetENC.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          true
  #include "Ethernet.h"
  #warning Using Ethernet lib
  #define SHIELD_TYPE           "W5x00 & Ethernet Library"
#endif  
...

#include <EthernetWebServer.h>

Important:

  • 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.

2. How to connect or select another CS/SS pin to use

The default CS/SS pin is 10 for all boards, and is configurable in code.

If the default pin is not corect, 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

[ETHERNET_WEBSERVER] Board : NUCLEO_F767ZI , setCsPin: 10
[ETHERNET_WEBSERVER] Default SPI pinout:
[ETHERNET_WEBSERVER] MOSI: 11
[ETHERNET_WEBSERVER] MISO: 12
[ETHERNET_WEBSERVER] SCK: 13
[ETHERNET_WEBSERVER] SS: 10
[ETHERNET_WEBSERVER] =========================

Connect the wires according to the displayed information.

3. How to increase W5x00 TX/RX buffer

  • 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);

4. How to adjust sendContent_P() and send_P() buffer size

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).


How to use

In your code, replace

  1. BlynkSimpleEthernet.h with BlynkSTM32Ethernet_WM.h for board using W5100, W5200, W5500 without SSL

  2. BlynkSimpleUIPEthernet.h with BlynkSTM32UIPEthernet_WM.h for board using ENC28J60 without SSL

  3. BlynkSimpleUIPEthernet.h with BlynkSTM32EthernetENC_WM.h for board using ENC28J60 without SSL to use new EthernetENC library

  4. For STM32 with built-in Ethernet, use

  • BlynkSTM32BIEthernet_WM.h to use Blynk Manager feature (Config Portal, MultiBlynk, Dynamic Parameters, etc.)
  • BlynkSimple_STM32BI_Ethernet.h to just use Blynk feature
// Start location to store config data to avoid conflict with other functions
#define EEPROM_START   0

Then replace Blynk.begin(...) with :

Blynk.begin()

in your code. Keep Blynk.run() intact.

That's it.



HOWTO use default Credentials and have them pre-loaded onto Config Portal

See this example and modify as necessary

bool LOAD_DEFAULT_CONFIG_DATA = true;

2. To use system default to load "blank" when there is no valid Credentials

bool LOAD_DEFAULT_CONFIG_DATA = false;

3. Example of Default Credentials

/// Start Default Config Data //////////////////

/*
  #define BLYNK_SERVER_MAX_LEN      32
#define BLYNK_TOKEN_MAX_LEN       36

typedef struct
{
  char blynk_server[BLYNK_SERVER_MAX_LEN];
  char blynk_token [BLYNK_TOKEN_MAX_LEN];
}  Blynk_Credentials;

#define NUM_BLYNK_CREDENTIALS     2

// Configurable items besides fixed Header
#define NUM_CONFIGURABLE_ITEMS    ( 3 + (2 * NUM_BLYNK_CREDENTIALS) )

typedef struct Configuration
{
  char header         [16];
  Blynk_Credentials Blynk_Creds [NUM_BLYNK_CREDENTIALS];
  int  blynk_port;
  char static_IP      [16];
  char board_name     [24];
  int  checkSum;
} Blynk_Configuration;
*/

#define TO_LOAD_DEFAULT_CONFIG_DATA      true

#if TO_LOAD_DEFAULT_CONFIG_DATA

bool LOAD_DEFAULT_CONFIG_DATA = true;

Blynk_Configuration defaultConfig =
{
  //char header[16], dummy, not used
#if USE_SSL
  "SSL",
#else
  "NonSSL",
#endif
  // Blynk_Credentials Blynk_Creds [NUM_BLYNK_CREDENTIALS];
  // Blynk_Creds.blynk_server and Blynk_Creds.blynk_token
  "account.duckdns.org",  "token1",
  "blynk-cloud.com",     "<<my real Blynk auth>>",
  //int  blynk_port;
#if USE_SSL
  9443,
#else
  8080,
#endif
  // char static_IP      [16];
  //"192.168.2.230",
  // Use dynamic DHCP IP
  "",
  //char board_name     [24];
  "Air-Control",
  // terminate the list
  //int  checkSum, dummy, not used
  0
  /////////// End Default Config Data /////////////
};

#else

bool LOAD_DEFAULT_CONFIG_DATA = false;

Blynk_Configuration defaultConfig;

#endif    // TO_LOAD_DEFAULT_CONFIG_DATA

/////////// End Default Config Data /////////////

4. How to add dynamic parameters from sketch

  • To add custom parameters, just modify from the example below

In defines.h

#define USE_DYNAMIC_PARAMETERS     false

in dynamicParams.h

#if (USE_DYNAMIC_PARAMETERS)
  #warning USE_DYNAMIC_PARAMETERS
#endif

// USE_DYNAMIC_PARAMETERS defined in defined.h

/////////////// Start dynamic Credentials ///////////////

//Defined in BlynkEthernet_WM.h, <BlynkEthernet_ESP8266_WM.h>, <BlynkEthernet_ESP32 or_WM.h>
/**************************************
  #define MAX_ID_LEN                5
  #define MAX_DISPLAY_NAME_LEN      16

  typedef struct
  {
  char id             [MAX_ID_LEN + 1];
  char displayName    [MAX_DISPLAY_NAME_LEN + 1];
  char *pdata;
  uint8_t maxlen;
  } MenuItem;
**************************************/

#if USE_DYNAMIC_PARAMETERS

#define MAX_MQTT_SERVER_LEN      34
char MQTT_Server  [MAX_MQTT_SERVER_LEN + 1]   = "";

#define MAX_MQTT_PORT_LEN        6
char MQTT_Port   [MAX_MQTT_PORT_LEN + 1]  = "";

#define MAX_MQTT_USERNAME_LEN      34
char MQTT_UserName  [MAX_MQTT_USERNAME_LEN + 1]   = "";

#define MAX_MQTT_PW_LEN        34
char MQTT_PW   [MAX_MQTT_PW_LEN + 1]  = "";

#define MAX_MQTT_SUBS_TOPIC_LEN      34
char MQTT_SubsTopic  [MAX_MQTT_SUBS_TOPIC_LEN + 1]   = "";

#define MAX_MQTT_PUB_TOPIC_LEN       34
char MQTT_PubTopic   [MAX_MQTT_PUB_TOPIC_LEN + 1]  = "";

MenuItem myMenuItems [] =
{
  { "mqtt", "MQTT Server",      MQTT_Server,      MAX_MQTT_SERVER_LEN },
  { "mqpt", "Port",             MQTT_Port,        MAX_MQTT_PORT_LEN   },
  { "user", "MQTT UserName",    MQTT_UserName,    MAX_MQTT_USERNAME_LEN },
  { "mqpw", "MQTT PWD",         MQTT_PW,          MAX_MQTT_PW_LEN },
  { "subs", "Subs Topics",      MQTT_SubsTopic,   MAX_MQTT_SUBS_TOPIC_LEN },
  { "pubs", "Pubs Topics",      MQTT_PubTopic,    MAX_MQTT_PUB_TOPIC_LEN },
};

uint16_t NUM_MENU_ITEMS = sizeof(myMenuItems) / sizeof(MenuItem);  //MenuItemSize;

#else

MenuItem myMenuItems [] = {};

uint16_t NUM_MENU_ITEMS = 0;
#endif


/////// // End dynamic Credentials ///////////

5. If you don't need to add dynamic parameters

Use the following in sketch

#define USE_DYNAMIC_PARAMETERS     false


Important Notes for using Dynamic Parameters' ids

  1. These ids (such as "mqtt" in example) must be unique.

Please be noted that the following reserved names are already used in library:

"sv"    for Blynk Server
"tk"    for Blynk Token
"sv1"   for Blynk Server1
"tk1"   for Blynk Token1
"pt"    for Blynk Port
"ip"    for Static IP Address
"nm"    for Board Name


Why using this BlynkEthernet_STM32_WM with MultiBlynk features

You can see that the system automatically detects and connects to the avaiable Blynk Servers, whenever interruption happens. This feature is very useful for systems requiring high degree of reliability.

Moreover, this Blynk.begin() is not a blocking call, so you can use it for critical functions requiring in loop().

Anyway, this is better for projects using Blynk just for GUI (graphical user interface).

In operation, if WiFi or Blynk connection is lost, Blynk.run() will try reconnecting automatically. Therefore, Blynk.run() must be called in the loop() function. Don't use:

void loop()
{
  if (Blynk.connected())
     Blynk.run();
     
  ...
}

just

void loop()
{
  Blynk.run();
  ...
}


HOWTO use STM32F4 with LAN8720

Already tested with latest STM32 core v2.0.0

1. Wiring

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

2. HOWTO program using STLink V-2 or V-3

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


3. HOWTO use Serial Port for Debugging

Connect FDTI (USB to Serial) as follows:

FDTI <---> STM32F4
RX <---> TX=PA_9
TX <---> RX=PA_10
GND <---> GND


Examples

Also see examples:

  1. AM2315_W5100
  2. BI_Ethernet_Blynk
  3. BI_Ethernet_Blynk_Email
  4. BI_Ethernet_WM_Config
  5. BlynkHTTPClient
  6. DHT11_W5100
  7. ENC28J60_Blynk
  8. ENC28J60_Blynk_Email
  9. ENC28J60_WM_Config
  10. EthernetENC_Blynk. New
  11. EthernetENC_Blynk_Email.New
  12. EthernetENC_WM_Config. New
  13. W5100_Blynk
  14. W5100_WM_Config
  15. W5100_Blynk_Email
  16. LAN8720_Ethernet_Blynk
  17. LAN8720_Ethernet_Blynk_Email
  18. LAN8720_Ethernet_WM_Config

So, how it works?

If no valid config data are stored in EEPROM (data verified by checksum), forced Config Portal (DoubleResetDetect, soft Config Portal request), it will switch to Configuration Mode. Connect to access point at the IP address displayed on Terminal or Router's DHCP server as in the following terminal output:

Start BI_Ethernet_Blynk on NUCLEO_F767ZI using LAN8742A Ethernet & STM32Ethernet Library
BlynkEthernet_STM32_WM v1.2.2

EEPROM size = 16384, start = 0
Flag read = 0xd0d01234
doubleResetDetected
ClearFlag write = 0xd0d04321
[2394] CCSum=0x2a68,RCSum=0x2a68
[2394] ChkCrR:CrCCsum=0x15bd,CrRCsum=0x15bd
[2398] CrCCsum=0x15bd,CrRCsum=0x15bd
[2401] ======= Start Stored Config Data =======
[2405] Hdr=LAN8742A,BName=F767ZI_BI
[2409] Svr=account.duckdns.org,Tok=token
[2414] Svr1=account.duckdns.org,Tok1=token1
[2421] Prt=8080,SIP=blank
[2423] MAC: FE-C6-B0-96-A9-DF
[10748] IP:192.168.2.163
[10748] bg:Stay forever in CP:DRD/MRD
[11875] CfgIP=192.168.2.163
F
Your stored Credentials :
MQTT Server = mqtt_server
Port = 1883
MQTT UserName = mqtt_user
MQTT PWD = mqtt_pwd
Subs Topics = Subs_Topics
Pubs Topics = Pubs_Topics

After you connected to, for example, 192.168.2.86, the Browser will display the following picture:

Enter your credentials (Blynk Server and Port). If you prefer static IP, input it (for example 192.168.2.79) in the corresponding field. Otherwise, just leave it blank or nothing to use auto IP assigned by DHCP server.

Then click Save. After the board auto-restarted, you will see if it's connected to your Blynk server successfully as in the following terminal output:

Start BI_Ethernet_Blynk on NUCLEO_F767ZI using LAN8742A Ethernet & STM32Ethernet Library

EEPROM size = 16384, start = 0
Flag read = 0xd0d04321
No doubleResetDetected
SetFlag write = 0xd0d01234
[2408] CCSum=0x2a68,RCSum=0x2a68
[2408] ChkCrR:CrCCsum=0x15bd,CrRCsum=0x15bd
[2411] CrCCsum=0x15bd,CrRCsum=0x15bd
[2415] ======= Start Stored Config Data =======
[2419] Hdr=LAN8742A,BName=F767ZI_BI
[2422] Svr=account.duckdns.org,Tok=token
[2428] Svr1=account.duckdns.org,Tok1=token1
[2434] Prt=8080,SIP=blank
[2437] MAC: FE-C6-B0-96-A9-DF
[11054] IP:192.168.2.163
[11054] bg:ECon.TryB
[11054] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on STM32 NUCLEO_F767ZI

[11067] BlynkArduinoClient.connect: Connecting to account.duckdns.org:8080
[11152] Ready (ping: 6ms).
[11219] Connected to BlynkServer=account.duckdns.org,Token=token
[11221] bg:EBCon
Conn2Blynk: server = account.duckdns.org, port = 8080
Token = token
IP = 192.168.2.163
Stop doubleResetDetecting
ClearFlag write = 0xd0d04321
B
Your stored Credentials :
MQTT Server = mqtt_server
Port = 1883
MQTT UserName = mqtt_user
MQTT PWD = mqtt_pwd
Subs Topics = Subs_Topics
Pubs Topics = Pubs_Topics
BBBBBBBBBB BBBBBBBBBB BBBBBBBBBB

This library's Blynk.begin() is not a blocking call, so you can use it for critical functions requiring in loop(). Anyway, this is better for projects using Blynk just for GUI (graphical user interface).

In operation, if Ethernet or Blynk connection is lost, Blynk.run() will try reconnecting automatically. Therefore, Blynk.run() must be called in the loop() function. Don't use:

void loop()
{
  if (Blynk.connected())
     Blynk.run();
     
  ...
}

just

void loop()
{
  Blynk.run();
  ...
}


#include "defines.h"
#include "Credentials.h"
#include "dynamicParams.h"

#include <SPI.h>

#define BLYNK_PIN_FORCED_CONFIG           V10
#define BLYNK_PIN_FORCED_PERS_CONFIG      V20

// Use button V10 (BLYNK_PIN_FORCED_CONFIG) to forced Config Portal
BLYNK_WRITE(BLYNK_PIN_FORCED_CONFIG)
{ 
  if (param.asInt())
  {
    Serial.println( F("\nCP Button Hit. Rebooting") ); 

    // This will keep CP once, clear after reset, even you didn't enter CP at all.
    Blynk.resetAndEnterConfigPortal(); 
  }
}

// Use button V20 (BLYNK_PIN_FORCED_PERS_CONFIG) to forced Persistent Config Portal
BLYNK_WRITE(BLYNK_PIN_FORCED_PERS_CONFIG)
{ 
  if (param.asInt())
  {
    Serial.println( F("\nPersistent CP Button Hit. Rebooting") ); 
   
    // This will keep CP forever, until you successfully enter CP, and Save data to clear the flag.
    Blynk.resetAndEnterConfigPortalPersistent();
  }
}

void heartBeatPrint()
{
  static int num = 1;

  if (Blynk.connected())
    Serial.print(F("B"));
  else
    Serial.print(F("F"));

  if (num == 80)
  {
    Serial.println();
    num = 1;
  }
  else if (num++ % 10 == 0)
  {
    Serial.print(F(" "));
  }
}

void check_status()
{
  static unsigned long checkstatus_timeout = 0;

#define STATUS_CHECK_INTERVAL     60000L

  // Send status report every STATUS_REPORT_INTERVAL (60) seconds: we don't need to send updates frequently if there is no status change.
  if ((millis() > checkstatus_timeout) || (checkstatus_timeout == 0))
  {
    heartBeatPrint();
    checkstatus_timeout = millis() + STATUS_CHECK_INTERVAL;
  }
}

void setup()
{
  // Debug console
  Serial.begin(115200);
  while (!Serial);

  delay(200);
  
  Serial.print(F("\nStart BI_Ethernet_Blynk on ")); Serial.print(BOARD_NAME);
  Serial.print(F(" using ")); Serial.println(SHIELD_TYPE);
  Serial.println(BLYNK_ETHERNET_STM32_WM_VERSION);
  
#if !(USE_BUILTIN_ETHERNET || USE_UIP_ETHERNET)
  pinMode(SDCARD_CS, OUTPUT);
  digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card
#endif

#if USE_BLYNK_WM
  Blynk.begin();
#else
#if USE_LOCAL_SERVER
  Blynk.begin(auth, server, BLYNK_HARDWARE_PORT);
#else
  Blynk.begin(auth);
  // You can also specify server:
  //Blynk.begin(auth, server, BLYNK_HARDWARE_PORT);
#endif
#endif

  if (Blynk.connected())
  {
#if USE_BLYNK_WM
    Serial.print(F("Conn2Blynk: server = "));
    Serial.print(Blynk.getServerName());
    Serial.print(F(", port = "));
    Serial.println(Blynk.getHWPort());
    Serial.print(F("Token = "));
    Serial.println(Blynk.getToken());
#endif
    Serial.print(F("IP = "));
    Serial.println(Ethernet.localIP());
  }
}

#if (USE_BLYNK_WM && USE_DYNAMIC_PARAMETERS)
void displayCredentials()
{
  Serial.println(F("\nYour stored Credentials :"));

  for (uint16_t i = 0; i < NUM_MENU_ITEMS; i++)
  {
    Serial.print(myMenuItems[i].displayName);
    Serial.print(F(" = "));
    Serial.println(myMenuItems[i].pdata);
  }
}
#endif

void loop()
{
  Blynk.run();
  check_status();

#if (USE_BLYNK_WM && USE_DYNAMIC_PARAMETERS)
  static bool displayedCredentials = false;

  if (!displayedCredentials)
  {
    for (uint16_t i = 0; i < NUM_MENU_ITEMS; i++)
    {
      if (!strlen(myMenuItems[i].pdata))
      {
        break;
      }

      if ( i == (NUM_MENU_ITEMS - 1) )
      {
        displayedCredentials = true;
        displayCredentials();
      }
    }
  }
#endif    
}

2. File defines.h

#ifndef defines_h
#define defines_h

#if !( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3)  ||defined(STM32F4) || defined(STM32F7) || \
       defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7)  ||defined(STM32G0) || defined(STM32G4) || \
       defined(STM32WB) || defined(STM32MP1) )
  #error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting.
#endif

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

#define DEBUG_ETHERNET_WEBSERVER_PORT       Serial

// Debug Level from 0 to 4
#define BLYNK_WM_DEBUG                      1
#define _ETHERNET_WEBSERVER_LOGLEVEL_       2

#define DRD_GENERIC_DEBUG                   true

// If USE_BUILTIN_ETHERNET == false and USE_UIP_ETHERNET == false => 
// either use W5x00 with EthernetXYZ library
// or ENC28J60 with EthernetENC library
#define USE_BUILTIN_ETHERNET    true
#define USE_UIP_ETHERNET        false

// 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

#if !(USE_BUILTIN_ETHERNET || USE_UIP_ETHERNET)
  // Only one if the following to be true
  #define USE_ETHERNET          false
  #define USE_ETHERNET2         false
  #define USE_ETHERNET3         false
  #define USE_ETHERNET_LARGE    false
  #define USE_ETHERNET_ENC      false
  #define USE_CUSTOM_ETHERNET   false
#endif

#if ( USE_ETHERNET2 || USE_ETHERNET3 || USE_ETHERNET_LARGE || USE_ETHERNET_ENC )
  #ifdef USE_CUSTOM_ETHERNET
    #undef USE_CUSTOM_ETHERNET
  #endif
  #define USE_CUSTOM_ETHERNET   false //true
#endif

#if (USE_BUILTIN_ETHERNET)
  #warning Using LAN8742A Ethernet & STM32Ethernet lib
  #define SHIELD_TYPE           "LAN8742A Ethernet & STM32Ethernet Library"
#elif (USE_UIP_ETHERNET)
  #warning Using ENC28J60 & UIPEthernet lib
  #define SHIELD_TYPE           "ENC28J60 & UIPEthernet Library"
#elif USE_ETHERNET3
  //#include "Ethernet3.h"
  #warning Using W5x00 & Ethernet3 lib
  #define SHIELD_TYPE           "W5x00 & Ethernet3 Library"
#elif USE_ETHERNET2
  //#include "Ethernet2.h"
  #warning Using W5x00 & Ethernet2 lib
  #define SHIELD_TYPE           "W5x00 & Ethernet2 Library"
#elif USE_ETHERNET_LARGE
  //#include "EthernetLarge.h"
  #warning Using W5x00 & EthernetLarge lib
  #define SHIELD_TYPE           "W5x00 & EthernetLarge Library"
#elif USE_ETHERNET_ENC
  //#include "EthernetENC.h"
  #warning Using ENC28J60 & EthernetENC lib
  #define SHIELD_TYPE           "ENC28J60 & EthernetENC Library"
#elif USE_CUSTOM_ETHERNET
  //#include "Ethernet_XYZ.h"
  #include "EthernetENC.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          true
  //#include "Ethernet.h"
  #warning Using Ethernet lib
  #define SHIELD_TYPE           "W5x00 & Ethernet Library"
#endif

#define BLYNK_NO_YIELD

// Start location in emulated-EEPROM to store config data. Default 0.
// Config data Size currently is 128 bytes w/o chksum, 132 with chksum)
#define EEPROM_START     0

#define USE_BLYNK_WM      true

#define USE_SSL           false

#if USE_BLYNK_WM

  #define USE_DYNAMIC_PARAMETERS                    true
 
  #if USE_SSL
    // Need ArduinoECCX08 and ArduinoBearSSL libraries
    // Currently, error not enough memory for many STM32 boards. Don't use
    #error SSL not support
  #else
    #if USE_BUILTIN_ETHERNET
      #include <BlynkSTM32BIEthernet_WM.h>
    #elif USE_UIP_ETHERNET
      #include <BlynkSTM32UIPEthernet_WM.h>
    #elif USE_ETHERNET_ENC
      #include <BlynkSTM32EthernetENC_WM.h>
    #else
      #include <BlynkSTM32Ethernet_WM.h>
    #endif
  #endif

#else   //USE_BLYNK_WM

  #if USE_BUILTIN_ETHERNET
    #include <BlynkSimple_STM32BI_Ethernet.h>
  #elif USE_UIP_ETHERNET
    #include <BlynkSimpleUIPEthernet.h>
  #else
    #include <BlynkSimpleEthernet.h>
  #endif
  
  #define USE_LOCAL_SERVER      true
  
  #if USE_LOCAL_SERVER
    char auth[] = "******";
    char server[] = "account.duckdns.org";
    //char server[] = "192.168.2.112";
  
  #else
    char auth[] = "******";
    char server[] = "blynk-cloud.com";
  #endif
  
  #define BLYNK_HARDWARE_PORT       8080

#endif    //USE_BLYNK_WM

#if !(USE_BUILTIN_ETHERNET || USE_UIP_ETHERNET)
  #define W5100_CS  10
  #define SDCARD_CS 4
#endif

#define BLYNK_HOST_NAME   "STM32-Master-Controller"

#endif      //defines_h
#ifndef Credentials_h
#define Credentials_h

#include "defines.h"

#if USE_BLYNK_WM

/// Start Default Config Data //////////////////

/*
  #define BLYNK_SERVER_MAX_LEN      32
#define BLYNK_TOKEN_MAX_LEN       36

typedef struct
{
  char blynk_server[BLYNK_SERVER_MAX_LEN];
  char blynk_token [BLYNK_TOKEN_MAX_LEN];
}  Blynk_Credentials;

#define NUM_BLYNK_CREDENTIALS     2

// Configurable items besides fixed Header
#define NUM_CONFIGURABLE_ITEMS    ( 3 + (2 * NUM_BLYNK_CREDENTIALS) )

typedef struct Configuration
{
  char header         [16];
  Blynk_Credentials Blynk_Creds [NUM_BLYNK_CREDENTIALS];
  int  blynk_port;
  char static_IP      [16];
  char board_name     [24];
  int  checkSum;
} Blynk_Configuration;
*/

#define TO_LOAD_DEFAULT_CONFIG_DATA      true

#if TO_LOAD_DEFAULT_CONFIG_DATA

bool LOAD_DEFAULT_CONFIG_DATA = false;

Blynk_Configuration defaultConfig =
{
  //char header[16], dummy, not used
#if USE_SSL
  "SSL",
#else
  "NonSSL",
#endif
  // Blynk_Credentials Blynk_Creds [NUM_BLYNK_CREDENTIALS];
  // Blynk_Creds.blynk_server and Blynk_Creds.blynk_token
  "account.duckdns.org",  "token1",
  "blynk-cloud.com",     "<<my real Blynk auth>>",
  //int  blynk_port;
#if USE_SSL
  9443,
#else
  8080,
#endif
  // char static_IP      [16];
  //"192.168.2.230",
  // Use dynamic DHCP IP
  "",
  //char board_name     [24];
  "Air-Control",
  // terminate the list
  //int  checkSum, dummy, not used
  0
  /////////// End Default Config Data /////////////
};

#else

bool LOAD_DEFAULT_CONFIG_DATA = false;

Blynk_Configuration defaultConfig;

#endif    // TO_LOAD_DEFAULT_CONFIG_DATA

/////////// End Default Config Data /////////////

#else     //#if USE_BLYNK_WM

#define USE_LOCAL_SERVER      true

#if USE_LOCAL_SERVER
char auth[] = "******";
char server[] = "account.duckdns.org";
//char server[] = "192.168.2.112";
#else
char auth[] = "******";
char server[] = "blynk-cloud.com";
#endif

#define BLYNK_HARDWARE_PORT       8080

#endif      //#if USE_BLYNK_WM

#endif    //Credentials_h
#ifndef dynamicParams_h
#define dynamicParams_h

#include "defines.h"

#if USE_BLYNK_WM

#if (USE_DYNAMIC_PARAMETERS)
  #warning USE_DYNAMIC_PARAMETERS
#endif

// USE_DYNAMIC_PARAMETERS defined in defined.h

/////////////// Start dynamic Credentials ///////////////

//Defined in BlynkEthernet_WM.h, <BlynkEthernet_ESP8266_WM.h>, <BlynkEthernet_ESP32 or_WM.h>
/**************************************
  #define MAX_ID_LEN                5
  #define MAX_DISPLAY_NAME_LEN      16

  typedef struct
  {
  char id             [MAX_ID_LEN + 1];
  char displayName    [MAX_DISPLAY_NAME_LEN + 1];
  char *pdata;
  uint8_t maxlen;
  } MenuItem;
**************************************/

#if USE_DYNAMIC_PARAMETERS

#define MAX_MQTT_SERVER_LEN      34
char MQTT_Server  [MAX_MQTT_SERVER_LEN + 1]   = "default-mqtt-server";

#define MAX_MQTT_PORT_LEN        6
char MQTT_Port   [MAX_MQTT_PORT_LEN + 1]  = "1883";

#define MAX_MQTT_USERNAME_LEN      34
char MQTT_UserName  [MAX_MQTT_USERNAME_LEN + 1]   = "default-mqtt-username";

#define MAX_MQTT_PW_LEN        34
char MQTT_PW   [MAX_MQTT_PW_LEN + 1]  = "default-mqtt-password";

#define MAX_MQTT_SUBS_TOPIC_LEN      34
char MQTT_SubsTopic  [MAX_MQTT_SUBS_TOPIC_LEN + 1]   = "default-mqtt-SubTopic";

#define MAX_MQTT_PUB_TOPIC_LEN       34
char MQTT_PubTopic   [MAX_MQTT_PUB_TOPIC_LEN + 1]  = "default-mqtt-PubTopic";

MenuItem myMenuItems [] =
{
  { "mqtt", "MQTT Server",      MQTT_Server,      MAX_MQTT_SERVER_LEN },
  { "mqpt", "Port",             MQTT_Port,        MAX_MQTT_PORT_LEN   },
  { "user", "MQTT UserName",    MQTT_UserName,    MAX_MQTT_USERNAME_LEN },
  { "mqpw", "MQTT PWD",         MQTT_PW,          MAX_MQTT_PW_LEN },
  { "subs", "Subs Topics",      MQTT_SubsTopic,   MAX_MQTT_SUBS_TOPIC_LEN },
  { "pubs", "Pubs Topics",      MQTT_PubTopic,    MAX_MQTT_PUB_TOPIC_LEN },
};

uint16_t NUM_MENU_ITEMS = sizeof(myMenuItems) / sizeof(MenuItem);  //MenuItemSize;

#else

MenuItem myMenuItems [] = {};

uint16_t NUM_MENU_ITEMS = 0;
#endif


/////// // End dynamic Credentials ///////////

#endif      //#if USE_BLYNK_WM


#endif      //dynamicParams_h


Debug Terminal Output Samples

1. BI_Ethernet_Blynk on NUCLEO_F767ZI using LAN8742A Ethernet and STM32Ethernet Library

The following is the sample terminal output when running example BI_Ethernet_Blynk on Nucleo-144 F767ZI with built-in LAN8742A Ethernet using STM32Ethernet Library.

1.1 No DoubleReset Detected => Running normally

Start BI_Ethernet_Blynk on NUCLEO_F767ZI using LAN8742A Ethernet & STM32Ethernet Library
BlynkEthernet_STM32_WM v1.2.2

EEPROM size = 16384, start = 0
Flag read = 0xd0d04321
No doubleResetDetected
SetFlag write = 0xd0d01234
[2408] CCSum=0x2a68,RCSum=0x2a68
[2408] ChkCrR:CrCCsum=0x15bd,CrRCsum=0x15bd
[2411] CrCCsum=0x15bd,CrRCsum=0x15bd
[2415] ======= Start Stored Config Data =======
[2419] Hdr=LAN8742A,BName=F767ZI_BI
[2422] Svr=account.duckdns.org,Tok=token
[2428] Svr1=account.duckdns.org,Tok1=token1
[2434] Prt=8080,SIP=blank
[2437] MAC: FE-C6-B0-96-A9-DF
[11054] IP:192.168.2.163
[11054] bg:ECon.TryB
[11054] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on STM32 NUCLEO_F767ZI

[11067] BlynkArduinoClient.connect: Connecting to account.duckdns.org:8080
[11152] Ready (ping: 6ms).
[11219] Connected to BlynkServer=account.duckdns.org,Token=token
[11221] bg:EBCon
Conn2Blynk: server = account.duckdns.org, port = 8080
Token = token
IP = 192.168.2.163
Stop doubleResetDetecting
ClearFlag write = 0xd0d04321
B
Your stored Credentials :
MQTT Server = mqtt_server
Port = 1883
MQTT UserName = mqtt_user
MQTT PWD = mqtt_pwd
Subs Topics = Subs_Topics
Pubs Topics = Pubs_Topics

1.2 DoubleReset Detected => Enter Config Portal

Start BI_Ethernet_Blynk on NUCLEO_F767ZI using LAN8742A Ethernet & STM32Ethernet Library
BlynkEthernet_STM32_WM v1.2.2

EEPROM size = 16384, start = 0
Flag read = 0xd0d01234
doubleResetDetected
ClearFlag write = 0xd0d04321
[2394] CCSum=0x2a68,RCSum=0x2a68
[2394] ChkCrR:CrCCsum=0x15bd,CrRCsum=0x15bd
[2398] CrCCsum=0x15bd,CrRCsum=0x15bd
[2401] ======= Start Stored Config Data =======
[2405] Hdr=LAN8742A,BName=F767ZI_BI
[2409] Svr=account.duckdns.org,Tok=token
[2414] Svr1=account.duckdns.org,Tok1=token1
[2421] Prt=8080,SIP=blank
[2423] MAC: FE-C6-B0-96-A9-DF
[10748] IP:192.168.2.163
[10748] bg:Stay forever in CP:DRD/MRD
[11875] CfgIP=192.168.2.163
F
Your stored Credentials :
MQTT Server = mqtt_server
Port = 1883
MQTT UserName = mqtt_user
MQTT PWD = mqtt_pwd
Subs Topics = Subs_Topics
Pubs Topics = Pubs_Topics

1.3 Enter non-persistent ConfigPortal

CP Button Hit. Rebooting

Start BI_Ethernet_Blynk on NUCLEO_F767ZI using LAN8742A Ethernet & STM32Ethernet Library
BlynkEthernet_STM32_WM v1.2.2

EEPROM size = 16384, start = 0
Flag read = 0xd0d04321
No doubleResetDetected
SetFlag write = 0xd0d01234
[2409] CCSum=0x2a68,RCSum=0x2a68
[2409] ChkCrR:CrCCsum=0x15bd,CrRCsum=0x15bd
[2412] CrCCsum=0x15bd,CrRCsum=0x15bd
[2416] ======= Start Stored Config Data =======
[2420] Hdr=LAN8742A,BName=F767ZI_BI
[2423] Svr=account.duckdns.org,Tok=token
[2429] Svr1=account.duckdns.org,Tok1=token1
[2435] Prt=8080,SIP=blank
[2438] MAC: FE-C6-B0-96-A9-DF
[9055] IP:192.168.2.163
[9055] bg:Stay forever in CP:Forced-non-Persistent
[10193] CfgIP=192.168.2.163
Stop doubleResetDetecting
ClearFlag write = 0xd0d04321
F
Your stored Credentials :
MQTT Server = mqtt_server
Port = 1883
MQTT UserName = mqtt_user
MQTT PWD = mqtt_pwd
Subs Topics = Subs_Topics
Pubs Topics = Pubs_Topics

1.4 Enter persistent ConfigPortal

Persistent CP Button Hit. Rebooting

Start BI_Ethernet_Blynk on NUCLEO_F767ZI using LAN8742A Ethernet & STM32Ethernet Library
BlynkEthernet_STM32_WM v1.2.2

EEPROM size = 16384, start = 0
Flag read = 0xd0d04321
No doubleResetDetected
SetFlag write = 0xd0d01234
[2406] CCSum=0x2a68,RCSum=0x2a68
[2406] ChkCrR:CrCCsum=0x15bd,CrRCsum=0x15bd
[2410] CrCCsum=0x15bd,CrRCsum=0x15bd
[2413] ======= Start Stored Config Data =======
[2418] Hdr=LAN8742A,BName=F767ZI_BI
[2421] Svr=account.duckdns.org,Tok=token
[2427] Svr1=account.duckdns.org,Tok1=token1
[2433] Prt=8080,SIP=blank
[2436] MAC: FE-C6-B0-96-A9-DF
[9552] IP:192.168.2.163
[9552] bg:Stay forever in CP:Forced-Persistent
[9552] CfgIP=192.168.2.163
F
Your stored Credentials :
MQTT Server = mqtt_server
Port = 1883
MQTT UserName = mqtt_user
MQTT PWD = mqtt_pwd
Subs Topics = Subs_Topics
Pubs Topics = Pubs_Topics
Stop doubleResetDetecting
ClearFlag write = 0xd0d04321

2. EthernetENC_Blynk on NUCLEO_F767ZI using ENC28J60 and EthernetENC Library

The following is the sample terminal output when running example EthernetENC_Blynk on Nucleo-144 F767ZI with ENC28J60 using EthernetENC Library.

2.1 No DoubleReset Detected => Running normally

Start EthernetENC_Blynk on NUCLEO_F767ZI using ENC28J60 & EthernetENC Library
BlynkEthernet_STM32_WM v1.2.2

EEPROM size = 16384, start = 0
Flag read = 0xd0d04321
No doubleResetDetected
SetFlag write = 0xd0d01234
[3244] CCSum=0x2e09,RCSum=0x2e09
[3244] ChkCrR:CrCCsum=0x15bd,CrRCsum=0x15bd
[3248] CrCCsum=0x15bd,CrRCsum=0x15bd
[3251] ======= Start Stored Config Data =======
[3256] Hdr=ENC28J60,BName=F767ZI_UIPEthernet
[3260] Svr=account.duckdns.org,Tok=token
[3266] Svr1=account.duckdns.org,Tok1=token1
[3272] Prt=8080,SIP=blank
[3274] MAC: FE-C6-B0-96-A9-DF
[9054] IP:192.168.2.163
[9054] bg:ECon.TryB
[9054] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on STM32 NUCLEO_F767ZI

[9066] BlynkArduinoClient.connect: Connecting to account.duckdns.org:8080
[9152] Ready (ping: 6ms).
[9219] Connected to BlynkServer=account.duckdns.org,Token=token
[9221] bg:EBCon
Conn2Blynk: server = account.duckdns.org, port = 8080
Token = token1
IP = 192.168.2.163
Stop doubleResetDetecting
ClearFlag write = 0xd0d04321
B
Your stored Credentials :
MQTT Server = mqtt_server
Port = 1883
MQTT UserName = mqtt_user
MQTT PWD = mqtt_pwd
Subs Topics = Subs_Topics
Pubs Topics = Pubs_Topics

2.2 DoubleReset Detected => Enter Config Portal

Start EthernetENC_Blynk on NUCLEO_F767ZI using ENC28J60 & EthernetENC Library
BlynkEthernet_STM32_WM v1.2.2

EEPROM size = 16384, start = 0
Flag read = 0xd0d01234
doubleResetDetected
ClearFlag write = 0xd0d04321
[3266] CCSum=0x2e09,RCSum=0x2e09
[3266] ChkCrR:CrCCsum=0x15bd,CrRCsum=0x15bd
[3270] CrCCsum=0x15bd,CrRCsum=0x15bd
[3274] ======= Start Stored Config Data =======
[3278] Hdr=ENC28J60,BName=F767ZI_UIPEthernet
[3282] Svr=account.duckdns.org,Tok=token
[3288] Svr1=account.duckdns.org,Tok1=token1
[3294] Prt=8080,SIP=blank
[3296] MAC: FE-C6-B0-96-A9-DF
[8619] IP:192.168.2.163
[8619] bg:Stay forever in CP:DRD/MRD
[9641] CfgIP=192.168.2.163
F
Your stored Credentials :
MQTT Server = mqtt_server
Port = 1883
MQTT UserName = mqtt_user
MQTT PWD = mqtt_pwd
Subs Topics = Subs_Topics
Pubs Topics = Pubs_Topics

2.3 Enter non-persistent ConfigPortal

CP Button Hit. Rebooting

Start EthernetENC_Blynk on NUCLEO_F767ZI using ENC28J60 & EthernetENC Library
BlynkEthernet_STM32_WM v1.2.2

EEPROM size = 16384, start = 0
Flag read = 0xd0d04321
No doubleResetDetected
SetFlag write = 0xd0d01234
[3259] CCSum=0x2e09,RCSum=0x2e09
[3259] ChkCrR:CrCCsum=0x15bd,CrRCsum=0x15bd
[3263] CrCCsum=0x15bd,CrRCsum=0x15bd
[3266] ======= Start Stored Config Data =======
[3271] Hdr=ENC28J60,BName=F767ZI_UIPEthernet
[3275] Svr=account.duckdns.org,Tok=token
[3281] Svr1=account.duckdns.org,Tok1=token1
[3287] Prt=8080,SIP=blank
[3289] MAC: FE-C6-B0-96-A9-DF
[4461] IP:192.168.2.163
[4461] bg:Stay forever in CP:Forced-non-Persistent
[4524] CfgIP=192.168.2.163
F
Your stored Credentials :
MQTT Server = mqtt_server
Port = 1883
MQTT UserName = mqtt_user
MQTT PWD = mqtt_pwd
Subs Topics = Subs_Topics
Pubs Topics = Pubs_Topics
Stop doubleResetDetecting
ClearFlag write = 0xd0d04321

2.4 Enter persistent ConfigPortal

Persistent CP Button Hit. Rebooting

Start EthernetENC_Blynk on NUCLEO_F767ZI using ENC28J60 & EthernetENC Library
BlynkEthernet_STM32_WM v1.2.2

EEPROM size = 16384, start = 0
Flag read = 0xd0d04321
No doubleResetDetected
SetFlag write = 0xd0d01234
[3169] CCSum=0x2e09,RCSum=0x2e09
[3169] ChkCrR:CrCCsum=0x15bd,CrRCsum=0x15bd
[3173] CrCCsum=0x15bd,CrRCsum=0x15bd
[3176] ======= Start Stored Config Data =======
[3181] Hdr=ENC28J60,BName=F767ZI_UIPEthernet
[3185] Svr=account.duckdns.org,Tok=token
[3191] Svr1=account.duckdns.org,Tok1=token1
[3197] Prt=8080,SIP=blank
[3199] MAC: FE-C6-B0-96-A9-DF
[8422] IP:192.168.2.163
[8422] bg:Stay forever in CP:Forced-Persistent
[8422] CfgIP=192.168.2.163
F
Your stored Credentials :
MQTT Server = mqtt_server
Port = 1883
MQTT UserName = mqtt_user
MQTT PWD = mqtt_pwd
Subs Topics = Subs_Topics
Pubs Topics = Pubs_Topics
Stop doubleResetDetecting
ClearFlag write = 0xd0d04321
FFFFFFFFF FFFFFFFFFF FF[1322491] h:UpdEEPROM
[1322491] SaveEEPROM,Sz=16384,DataSz=380,WCSum=0x2e09
[1324544] CrCCSum=0x15bd
[1325574] h:Rst

2.5. Lost Blynk Server => autoreconnect to another Blynk Server

Start EthernetENC_Blynk on NUCLEO_F767ZI using ENC28J60 & EthernetENC Library
BlynkEthernet_STM32_WM v1.2.2

EEPROM size = 16384, start = 0
Flag read = 0xd0d04321
No doubleResetDetected
SetFlag write = 0xd0d01234
[1337] CCSum=0x25aa,RCSum=0x25aa
[1337] ChkCrR:CrCCsum=0x15bd,CrRCsum=0x15bd
[1340] CrCCsum=0x15bd,CrRCsum=0x15bd
[1344] ======= Start Stored Config Data =======
[1348] Hdr=ENC28J60,BName=F767ZI_UIPEthernet
[1352] Svr=192.168.2.112,Tok=token
[1358] Svr1=192.168.2.32,Tok1=token1
[1363] Prt=8080,SIP=blank
[1366] MAC: FE-C6-B0-96-A9-DF
[6589] IP:192.168.2.163
[6589] bg:ECon.TryB
[6589] Try connecting to BlynkServer=192.168.2.112,Token=token
[6595] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on STM32 NUCLEO_F767ZI

[6610] BlynkArduinoClient.connect: Connecting to 192.168.2.112:8080
[7302] Ready (ping: 92ms).
[7369] Connected to BlynkServer=192.168.2.112,Token=token
[7371] bg:EBCon
Conn2Blynk: server = 192.168.2.112, port = 8080
Token = token
IP = 192.168.2.163
B
Your stored Credentials :
MQTT Server = mqtt_server
Port = 1883
MQTT UserName = mqtt_user
MQTT PWD = mqtt_pwd
Subs Topics = Subs_Topics
Pubs Topics = Pubs_Topics
Stop doubleResetDetecting
ClearFlag write = 0xd0d04321
[36377] Heartbeat timeout
[36377] r:BLost.TryB
[36377] Try connecting to BlynkServer=192.168.2.112,Token=token
[36384] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on STM32 NUCLEO_F767ZI

[36398] BlynkArduinoClient.connect: Connecting to 192.168.2.112:8080
[41405] Try connecting to BlynkServer=192.168.2.32,Token=token1
[41407] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on STM32 NUCLEO_F767ZI

[41421] BlynkArduinoClient.connect: Connecting to 192.168.2.32:8080
[41586] Ready (ping: 20ms).
[41653] Connected to BlynkServer=192.168.2.32,Token=token1
[41655] r:BRecon
BBBBB

3. ENC28J60_Blynk on NUCLEO_F767ZI using ENC28J60 and UIPEthernet Library

The following is the sample terminal output when running example ENC28J60_Blynk on Nucleo-144 F767ZI with ENC28J60 using UIPEthernet Library.

3.1 No DoubleReset Detected => Running normally

Start ENC28J60_Blynk on NUCLEO_F767ZI using ENC28J60 & UIPEthernet Library
BlynkEthernet_STM32_WM v1.2.2

EEPROM size = 16384, start = 0
Flag read = 0xd0d04321
No doubleResetDetected
SetFlag write = 0xd0d01234
[2202] CCSum=0x2e09,RCSum=0x2e09
[2202] ChkCrR:CrCCsum=0x15bd,CrRCsum=0x15bd
[2205] CrCCsum=0x15bd,CrRCsum=0x15bd
[2209] ======= Start Stored Config Data =======
[2213] Hdr=ENC28J60,BName=F767ZI_UIPEthernet
[2217] Svr=account.duckdns.org,Tok=token
[2223] Svr1=account.duckdns.org,Tok1=token1
[2229] Prt=8080,SIP=blank
[2232] MAC: FE-C6-B0-96-A9-DF
ENC28J60_CONTROL_CS =10
SS =10
SPI_MOSI =11
SPI_MISO =12
SPI_SCK =13
[7477] IP:192.168.2.163
[7477] bg:ECon.TryB
[7477] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on STM32 NUCLEO_F767ZI

[7490] BlynkArduinoClient.connect: Connecting to account.duckdns.org:8080
[8263] Ready (ping: 14ms).
[8330] Connected to BlynkServer=account.duckdns.org,Token=token
[8332] bg:EBCon
Conn2Blynk: server = account.duckdns.org, port = 8080
Token = token
IP = 192.168.2.163
B
Your stored Credentials :
MQTT Server = mqtt_server
Port = 1883
MQTT UserName = mqtt_user
MQTT PWD = mqtt_pwd
Subs Topics = Subs_Topics
Pubs Topics = Pubs_Topics
Stop doubleResetDetecting
ClearFlag write = 0xd0d04321
BBBBBBBBB

3.2 DoubleReset Detected => Enter Config Portal

Start ENC28J60_Blynk on NUCLEO_F767ZI using ENC28J60 & UIPEthernet Library
BlynkEthernet_STM32_WM v1.2.2

EEPROM size = 16384, start = 0
Flag read = 0xd0d01234
doubleResetDetected
ClearFlag write = 0xd0d04321
[3245] CCSum=0xecf,RCSum=0xecf
[3245] ChkCrR:CrCCsum=0xc30,CrRCsum=0xc30
[3248] CrCCsum=0xc30,CrRCsum=0xc30
[3251] ======= Start Stored Config Data =======
[3256] Hdr=ENC28J60,BName=blank
[3259] Svr=blank,Tok=blank
[3261] Svr1=blank,Tok1=blank
[3264] Prt=8080,SIP=blank
[3266] MAC: FE-C9-A1-8E-D4-B7
ENC28J60_CONTROL_CS =10
SS =10
SPI_MOSI =11
SPI_MISO =12
SPI_SCK =13
[4460] IP:192.168.2.162
[4460] bg:Stay forever in CP:DRD/MRD
[4523] CfgIP=192.168.2.162
F
Your stored Credentials :
MQTT Server = blank
Port = blank
MQTT UserName = blank
MQTT PWD = blank
Subs Topics = blank
Pubs Topics = blank
FF

Your stored Credentials :
MQTT Server = blank
Port = blank
MQTT UserName = blank
MQTT PWD = blank
Subs Topics = blank
Pubs Topics = blank
FFF[233631] h:UpdEEPROM
[233631] SaveEEPROM,Sz=16384,DataSz=380,WCSum=0x2e09
[235667] CrCCSum=0x15bd
[235667] h:Rst

3.3 Enter non-persistent ConfigPortal

CP Button Hit. Rebooting

Start ENC28J60_Blynk on NUCLEO_F767ZI using ENC28J60 & UIPEthernet Library
BlynkEthernet_STM32_WM v1.2.2

EEPROM size = 16384, start = 0
Flag read = 0xd0d04321
No doubleResetDetected
SetFlag write = 0xd0d01234
[2297] CCSum=0x2e09,RCSum=0x2e09
[2297] ChkCrR:CrCCsum=0x15bd,CrRCsum=0x15bd
[2300] CrCCsum=0x15bd,CrRCsum=0x15bd
[2304] ======= Start Stored Config Data =======
[2308] Hdr=ENC28J60,BName=F767ZI_UIPEthernet
[2312] Svr=account.duckdns.org,Tok=token
[2318] Svr1=account.duckdns.org,Tok1=token1
[2324] Prt=8080,SIP=blank
[2327] MAC: FE-C6-B0-96-A9-DF
ENC28J60_CONTROL_CS =10
SS =10
SPI_MOSI =11
SPI_MISO =12
SPI_SCK =13
[3520] IP:192.168.2.163
[3520] bg:Stay forever in CP:Forced-non-Persistent
[4544] CfgIP=192.168.2.163
F
Your stored Credentials :
MQTT Server = mqtt_server
Port = 1883
MQTT UserName = mqtt_user
MQTT PWD = mqtt_pwd
Subs Topics = Subs_Topics
Pubs Topics = Pubs_Topics
Stop doubleResetDetecting
ClearFlag write = 0xd0d04321

3.4 Enter persistent ConfigPortal

Persistent CP Button Hit. Rebooting

Start ENC28J60_Blynk on NUCLEO_F767ZI using ENC28J60 & UIPEthernet Library
BlynkEthernet_STM32_WM v1.2.2

EEPROM size = 16384, start = 0
Flag read = 0xd0d04321
No doubleResetDetected
SetFlag write = 0xd0d01234
[2298] CCSum=0x2e09,RCSum=0x2e09
[2298] ChkCrR:CrCCsum=0x15bd,CrRCsum=0x15bd
[2301] CrCCsum=0x15bd,CrRCsum=0x15bd
[2305] ======= Start Stored Config Data =======
[2309] Hdr=ENC28J60,BName=F767ZI_UIPEthernet
[2313] Svr=account.duckdns.org,Tok=token
[2319] Svr1=account.duckdns.org,Tok1=token1
[2325] Prt=8080,SIP=blank
[2328] MAC: FE-C6-B0-96-A9-DF
ENC28J60_CONTROL_CS =10
SS =10
SPI_MOSI =11
SPI_MISO =12
SPI_SCK =13
[7524] IP:192.168.2.163
[7524] bg:Stay forever in CP:Forced-Persistent
[7524] CfgIP=192.168.2.163
F
Your stored Credentials :
MQTT Server = mqtt_server
Port = 1883
MQTT UserName = mqtt_user
MQTT PWD = mqtt_pwd
Subs Topics = Subs_Topics
Pubs Topics = Pubs_Topics
Stop doubleResetDetecting
ClearFlag write = 0xd0d04321


4. W5100_Blynk on NUCLEO_F767ZI using W5x00 and EthernetLarge Library

The following is the sample terminal output when running example W5100_Blynk on Nucleo-144 F767ZI with W5x00 using EthernetLarge Library.

4.1 No DoubleReset Detected => Running normally

Start W5100_Blynk on NUCLEO_F767ZI using W5x00 & EthernetLarge Library
BlynkEthernet_STM32_WM v1.2.2

EEPROM size = 16384, start = 0
Flag read = 0xd0d04321
No doubleResetDetected
SetFlag write = 0xd0d01234
[2380] CCSum=0x2a68,RCSum=0x2a68
[2380] ChkCrR:CrCCsum=0x15bd,CrRCsum=0x15bd
[2384] CrCCsum=0x15bd,CrRCsum=0x15bd
[2387] ======= Start Stored Config Data =======
[2392] Hdr=LAN8742A,BName=F767ZI_BI
[2395] Svr=account.duckdns.org,Tok=token
[2401] Svr1=account.duckdns.org,Tok1=token1
[2407] Prt=8080,SIP=blank
[2409] MAC: FE-C6-B0-96-A9-DF
_pinCS = 0
W5100 init, using SS_PIN_DEFAULT = 10, new ss_pin = 10, W5100Class::ss_pin = 10
W5100::init: W5500, SSIZE =8192
[4079] IP:192.168.2.163
[4079] bg:ECon.TryB
[4079] Try connecting to BlynkServer=account.duckdns.org,Token=token
[4086] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on STM32 NUCLEO_F767ZI

[4100] BlynkArduinoClient.connect: Connecting to account.duckdns.org:8080
[4215] Ready (ping: 4ms).
[4282] Connected to BlynkServer=account.duckdns.org,Token=token
[4284] bg:EBCon
Conn2Blynk: server = account.duckdns.org, port = 8080
Token = token
IP = 192.168.2.163
B
Your stored Credentials :
MQTT Server = mqtt_server
Port = 1883
MQTT UserName = mqtt_user
MQTT PWD = mqtt_pwd
Subs Topics = Subs_Topics
Pubs Topics = Pubs_Topics
Stop doubleResetDetecting
ClearFlag write = 0xd0d04321
BBBBBBBBB B

4.2 DoubleReset Detected => Enter Config Portal

Start W5100_Blynk on NUCLEO_F767ZI using W5x00 & EthernetLarge Library
BlynkEthernet_STM32_WM v1.2.2

EEPROM size = 16384, start = 0
Flag read = 0xd0d01234
doubleResetDetected
ClearFlag write = 0xd0d04321
[2327] CCSum=0x24d7,RCSum=0x24d7
[2327] ChkCrR:CrCCsum=0x15bd,CrRCsum=0x15bd
[2331] CrCCsum=0x15bd,CrRCsum=0x15bd
[2335] ======= Start Stored Config Data =======
[2339] Hdr=W5100,BName=F767ZI_UIPEthernet
[2343] Svr=192.168.2.112,Tok=token
[2348] Svr1=192.168.2.32,Tok1=token1
[2354] Prt=8080,SIP=blank
[2356] MAC: FE-C6-B0-96-A9-DF
_pinCS = 0
W5100 init, using SS_PIN_DEFAULT = 10, new ss_pin = 10, W5100Class::ss_pin = 10
W5100::init: W5500, SSIZE =8192
[4026] IP:192.168.2.163
[4026] bg:Stay forever in CP:DRD/MRD
[4042] CfgIP=192.168.2.163
F
Your stored Credentials :
MQTT Server = mqtt_server
Port = 1883
MQTT UserName = mqtt_user
MQTT PWD = mqtt_pwd
Subs Topics = Subs_Topics
Pubs Topics = Pubs_Topics

4.3 Enter non-persistent ConfigPortal

CP Button Hit. Rebooting

Start W5100_Blynk on NUCLEO_F767ZI using W5x00 & EthernetLarge Library
BlynkEthernet_STM32_WM v1.2.2

EEPROM size = 16384, start = 0
Flag read = 0xd0d04321
No doubleResetDetected
SetFlag write = 0xd0d01234
[1335] CCSum=0x2a68,RCSum=0x2a68
[1335] ChkCrR:CrCCsum=0x15bd,CrRCsum=0x15bd
[1339] CrCCsum=0x15bd,CrRCsum=0x15bd
[1342] ======= Start Stored Config Data =======
[1347] Hdr=LAN8742A,BName=F767ZI_BI
[1350] Svr=account.duckdns.org,Tok=token
[1356] Svr1=account.duckdns.org,Tok1=token1
[1362] Prt=8080,SIP=blank
[1364] MAC: FE-C6-B0-96-A9-DF
_pinCS = 0
W5100 init, using SS_PIN_DEFAULT = 10, new ss_pin = 10, W5100Class::ss_pin = 10
W5100::init: W5500, SSIZE =8192
[3034] IP:192.168.2.163
[3034] bg:Stay forever in CP:Forced-non-Persistent
[4151] CfgIP=192.168.2.163
F
Your stored Credentials :
MQTT Server = mqtt_server
Port = 1883
MQTT UserName = mqtt_user
MQTT PWD = mqtt_pwd
Subs Topics = Subs_Topics
Pubs Topics = Pubs_Topics

4.4 Enter persistent ConfigPortal

Persistent CP Button Hit. Rebooting

Start W5100_Blynk on NUCLEO_F767ZI using W5x00 & EthernetLarge Library
BlynkEthernet_STM32_WM v1.2.2

EEPROM size = 16384, start = 0
Flag read = 0xd0d04321
No doubleResetDetected
SetFlag write = 0xd0d01234
[2321] CCSum=0x2d36,RCSum=0x2d36
[2321] ChkCrR:CrCCsum=0x15bd,CrRCsum=0x15bd
[2325] CrCCsum=0x15bd,CrRCsum=0x15bd
[2328] ======= Start Stored Config Data =======
[2333] Hdr=W5100,BName=F767ZI_UIPEthernet
[2337] Svr=account.duckdns.org,Tok=token
[2343] Svr1=account.duckdns.org,Tok1=token1
[2349] Prt=8080,SIP=blank
[2351] MAC: FE-C6-B0-96-A9-DF
_pinCS = 0
W5100 init, using SS_PIN_DEFAULT = 10, new ss_pin = 10, W5100Class::ss_pin = 10
W5100::init: W5500, SSIZE =8192
[4021] IP:192.168.2.163
[4021] bg:Stay forever in CP:Forced-Persistent
[4021] CfgIP=192.168.2.163
F
Your stored Credentials :
MQTT Server = mqtt_server
Port = 1883
MQTT UserName = mqtt_user
MQTT PWD = mqtt_pwd
Subs Topics = Subs_Topics
Pubs Topics = Pubs_Topics
Stop doubleResetDetecting
ClearFlag write = 0xd0d04321

5. LAN8720_Ethernet_Blynk on STM32F4 BLACK_F407VE with LAN8720 Ethernet using STM32Ethernet Library

The following is the sample terminal output when running example LAN8720_Ethernet_Blynk on STM32F4 BLACK_F407VE with LAN8720 Ethernet using STM32Ethernet Library.

5.1. DoubleReset Detected => Enter Config Portal

Start LAN8720_Ethernet_Blynk on BLACK_F407VE using LAN8720 Ethernet & STM32Ethernet Library
BlynkEthernet_STM32_WM v1.2.2

EEPROM size = 16384, start = 0
Flag read = 0xd0d01234
doubleResetDetected
ClearFlag write = 0xd0d04321
[3053] CCSum=0x23bd,RCSum=0x0
[3053] ChkCrR:CrCCsum=0x8a73,CrRCsum=0xffffffff
[3057] InitCfgFile,Sz=200
[3060] InitCfgFile,DataSz=0
[3062] SaveEEPROM,Sz=16384,DataSz=0,WCSum=0xed0
[3101] CrCCSum=0xc30
[3101] MAC: FE-C9-A1-8E-D4-B7
[9229] IP:192.168.2.167
[9229] bg:Stay forever in CP:DRD/MRD
[9246] CfgIP=192.168.2.167
F
Your stored Credentials :
MQTT Server = blank
Port = blank
MQTT UserName = blank
MQTT PWD = blank
Subs Topics = blank
Pubs Topics = blank
FF[178269] h:UpdEEPROM
[178269] SaveEEPROM,Sz=16384,DataSz=0,WCSum=0x2a72
[178304] CrCCSum=0x15d7
[178304] h:Rst

5.2. Config Data Saved => Connect to Blynk

Start LAN8720_Ethernet_Blynk on BLACK_F407VE using LAN8720 Ethernet & STM32Ethernet Library
BlynkEthernet_STM32_WM v1.2.2

EEPROM size = 16384, start = 0
Flag read = 0xd0d04321
No doubleResetDetected
SetFlag write = 0xd0d01234
[3054] CCSum=0x2a72,RCSum=0x2a72
[3054] ChkCrR:CrCCsum=0x15d7,CrRCsum=0x15d7
[3058] CrCCsum=0x15d7,CrRCsum=0x15d7
[3061] ======= Start Stored Config Data =======
[3066] Hdr=LAN8742A,BName=BLACK_F407VE
[3070] Svr=account.duckdns.org,Tok=token1
[3076] Svr1=account.ddns.net,Tok1=token2
[3082] Prt=8080,SIP=192.168.2.167
[3086] connectEthernet: Use static_IP=192.168.2.167
[3091] MAC: FE-C6-B0-96-A9-DF
[5715] IP:192.168.2.167
[5715] bg:ECon.TryB
[5715] Try connecting to BlynkServer=account.duckdns.org,Token=token1
[5722] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on STM32 BLACK_F407VE

[5813] Ready (ping: 7ms).
[5880] Connected to BlynkServer=account.duckdns.org,Token=token1
[5882] bg:EBCon
Conn2Blynk: server = account.duckdns.org, port = 8080
Token = token1
IP = 192.168.2.167
B
Your stored Credentials :
MQTT Server = mqtt_server
Port = 1883
MQTT UserName = mqtt-User
MQTT PWD = mqtt_pass
Subs Topics = Subs_Topics
Pubs Topics = Pubs_Topics
Stop doubleResetDetecting
ClearFlag write = 0xd0d04321


Debug

Debug is enabled by default on Serial.

You can also change the debugging level from 0 to 4

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

#define DEBUG_ETHERNET_WEBSERVER_PORT       Serial

// Debug Level from 0 to 4
#define BLYNK_WM_DEBUG                      1
#define _ETHERNET_WEBSERVER_LOGLEVEL_       2

#define DRD_GENERIC_DEBUG                   true

Troubleshooting

If you get compilation errors, more often than not, you may need to install a newer version of the core for Arduino boards.

Sometimes, the library will only work if you update the board core to the latest version because I am using newly added functions.



Issues

Submit issues to: BlynkEthernet_STM32_WM issues


TO DO

  1. Same features for other boards with Ethernet shields.
  2. To write code and make SSL working. Currently, Ethernet SSL is not supported by Blynk code yet.

DONE

  1. Permit EEPROM size and location configurable to avoid conflict with others.
  2. More flexible to configure reconnection timeout.
  3. For fresh config data, don't need to wait for connecting timeout before entering config portal.
  4. If the config data not entered completely (Server, HardwarePort and Blynk token), entering config portal
  5. Change Synch XMLHttpRequest to Async
  6. Reduce memory usage.
  7. Support W5x00, ENC28J60 Ethernet shield as well as built-in Ethernet LAN8742A
  8. Add checksums
  9. Support STM32F/L/H/G/WB/MP1 boards
  10. Add MultiBlynk features with Auto(Re)Connect to the available Server.
  11. Easy-to-use Dynamic Parameters without the necessity to write complicated ArduinoJSon functions
  12. Permit to input special chars such as % and # into data fields.
  13. Make emulated-EEPROM work on all STM32 boards
  14. DoubleDetectDetector to force Config Portal when double reset is detected within predetermined time, default 10s.
  15. Configurable Config Portal Title
  16. Re-structure all examples to separate Credentials / Defines / Dynamic Params / Code so that you can change Credentials / Dynamic Params quickly for each device.
  17. Add support to new EthernetENC library for ENC28J60.
  18. Add Table of Contents and Version String

Contributions and Thanks

  1. Thanks to thorathome in GitHub to test, suggest and encourage to add those new features to Blynk_WM, such as Default Credentials/Dynamic Params, Configurable Config Portal Title, DRD. Those features are included in this library now.
thorathome
⭐️ Thor Johnson


Contributing

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

License

  • The library is licensed under MIT

Copyright

Copyright 2020- Khoi Hoang

About

Simple Blynk Credentials Manager for STM32 boards using builtin Etherrnet LAN8742A, ENC28J60 or W5x00 Ethernet shields, with or without SSL, configuration data saved in EEPROM.

License:MIT License


Languages

Language:C++ 65.7%Language:C 34.3%