diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 0000000..00fe362 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,7 @@ +# See: https://github.com/codespell-project/codespell#using-a-config-file +[codespell] +# In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here: +ignore-words-list = , +check-filenames = +check-hidden = +skip = ./.git,./src,./examples,./Packages_Patches,./LibraryPatches diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d21b86b..7ff7b36 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,12 +10,15 @@ However, before reporting a bug please check through the following: If you don't find anything, please [open a new issue](https://github.com/khoih-prog/WebServer_ESP32_ENC/issues/new). +--- + ### How to submit a bug report Please ensure to specify the following: * Arduino IDE version (e.g. 1.8.19) or Platform.io version -* Board Core Version (e.g. ESP32 core v2.0.5) +* Board type (e.g. ESP32_DEV) +* Board Core Version (e.g. ESP32 core v2.0.6) * Contextual information (e.g. what you were trying to achieve) * Simplest possible steps to reproduce * Anything that might be relevant in your opinion, such as: @@ -23,14 +26,18 @@ Please ensure to specify the following: * Network configuration +Please be educated, civilized and constructive as you've always been. Disrespective posts against [GitHub Code of Conduct](https://docs.github.com/en/site-policy/github-terms/github-event-code-of-conduct) will be ignored and deleted. + +--- + ### Example ``` Arduino IDE version: 1.8.19 -WT32_ETH01 board -ESP32 core v2.0.5 +ESP32_DEV board +ESP32 core v2.0.6 OS: Ubuntu 20.04 LTS -Linux xy-Inspiron-3593 5.15.0-53-generic #59~20.04.1-Ubuntu SMP Thu Oct 20 15:10:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux +Linux xy-Inspiron-3593 5.15.0-57-generic #63~20.04.1-Ubuntu SMP Wed Nov 30 13:40:16 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux Context: I encountered a crash while using this library diff --git a/changelog.md b/changelog.md index cda6f1e..9125621 100644 --- a/changelog.md +++ b/changelog.md @@ -8,6 +8,7 @@ Donate to my libraries using BuyMeACoffee + --- --- @@ -15,6 +16,7 @@ * [Changelog](#changelog) + * [Releases v1.5.3](#releases-v153) * [Releases v1.5.1](#releases-v151) --- @@ -22,6 +24,11 @@ ## Changelog +#### Releases v1.5.3 + +1. Using `built-in ESP32 MAC Address` +2. Increase default `SPI_CLOCK_MHZ` clock to 20MHz from 8MHz + #### Releases v1.5.1 1. Initial coding to support ESP32 boards using ENC28J60 LwIP Ethernet. Sync with [WebServer_WT32_ETH01 v1.5.1](https://github.com/khoih-prog/WebServer_WT32_ETH01) diff --git a/examples/AdvancedWebServer/AdvancedWebServer.ino b/examples/AdvancedWebServer/AdvancedWebServer.ino index b8c5f42..879d1fb 100644 --- a/examples/AdvancedWebServer/AdvancedWebServer.ino +++ b/examples/AdvancedWebServer/AdvancedWebServer.ino @@ -50,8 +50,8 @@ ////////////////////////////////////////////////////////// // Optional values to override default settings -//#define SPI_HOST 1 -//#define SPI_CLOCK_MHZ 8 +//#define ETH_SPI_HOST SPI3_HOST +//#define SPI_CLOCK_MHZ 20 // Must connect INT to GPIOxx or not working //#define INT_GPIO 4 @@ -208,16 +208,14 @@ void setup() // start the ethernet connection and the server: // Use DHCP dynamic IP and random mac - uint16_t index = millis() % NUMBER_OF_MAC; - //bool begin(int MISO_GPIO, int MOSI_GPIO, int SCLK_GPIO, int CS_GPIO, int INT_GPIO, int SPI_CLOCK_MHZ, - // int SPI_HOST, uint8_t *ENC28J60_Mac = ENC28J60_Default_Mac); - //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST ); - ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST, mac[index] ); + // int SPI_HOST, uint8_t *W6100_Mac = W6100_Default_Mac); + ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST ); + //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST, mac[millis() % NUMBER_OF_MAC] ); // Static IP, leave without this line to get IP via DHCP //bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0); - ETH.config(myIP, myGW, mySN, myDNS); + //ETH.config(myIP, myGW, mySN, myDNS); ESP32_ENC_waitForConnect(); diff --git a/examples/HelloServer/HelloServer.ino b/examples/HelloServer/HelloServer.ino index 95f7792..1a1cda1 100644 --- a/examples/HelloServer/HelloServer.ino +++ b/examples/HelloServer/HelloServer.ino @@ -22,8 +22,8 @@ ////////////////////////////////////////////////////////// // Optional values to override default settings -//#define SPI_HOST 1 -//#define SPI_CLOCK_MHZ 8 +//#define ETH_SPI_HOST SPI3_HOST +//#define SPI_CLOCK_MHZ 20 // Must connect INT to GPIOxx or not working //#define INT_GPIO 4 @@ -131,12 +131,10 @@ void setup() // start the ethernet connection and the server: // Use DHCP dynamic IP and random mac - uint16_t index = millis() % NUMBER_OF_MAC; - //bool begin(int MISO_GPIO, int MOSI_GPIO, int SCLK_GPIO, int CS_GPIO, int INT_GPIO, int SPI_CLOCK_MHZ, - // int SPI_HOST, uint8_t *ENC28J60_Mac = ENC28J60_Default_Mac); - //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST ); - ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST, mac[index] ); + // int SPI_HOST, uint8_t *W6100_Mac = W6100_Default_Mac); + ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST ); + //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST, mac[millis() % NUMBER_OF_MAC] ); // Static IP, leave without this line to get IP via DHCP //bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0); diff --git a/examples/HelloServer2/HelloServer2.ino b/examples/HelloServer2/HelloServer2.ino index cb3cd3b..2aa8246 100644 --- a/examples/HelloServer2/HelloServer2.ino +++ b/examples/HelloServer2/HelloServer2.ino @@ -22,8 +22,8 @@ ////////////////////////////////////////////////////////// // Optional values to override default settings -//#define SPI_HOST 1 -//#define SPI_CLOCK_MHZ 8 +//#define ETH_SPI_HOST SPI3_HOST +//#define SPI_CLOCK_MHZ 20 // Must connect INT to GPIOxx or not working //#define INT_GPIO 4 @@ -131,12 +131,10 @@ void setup() // start the ethernet connection and the server: // Use DHCP dynamic IP and random mac - uint16_t index = millis() % NUMBER_OF_MAC; - //bool begin(int MISO_GPIO, int MOSI_GPIO, int SCLK_GPIO, int CS_GPIO, int INT_GPIO, int SPI_CLOCK_MHZ, - // int SPI_HOST, uint8_t *ENC28J60_Mac = ENC28J60_Default_Mac); - //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST ); - ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST, mac[index] ); + // int SPI_HOST, uint8_t *W6100_Mac = W6100_Default_Mac); + ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST ); + //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST, mac[millis() % NUMBER_OF_MAC] ); // Static IP, leave without this line to get IP via DHCP //bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0); diff --git a/examples/HttpBasicAuth/HttpBasicAuth.ino b/examples/HttpBasicAuth/HttpBasicAuth.ino index c61ef92..8968064 100644 --- a/examples/HttpBasicAuth/HttpBasicAuth.ino +++ b/examples/HttpBasicAuth/HttpBasicAuth.ino @@ -22,8 +22,8 @@ ////////////////////////////////////////////////////////// // Optional values to override default settings -//#define SPI_HOST 1 -//#define SPI_CLOCK_MHZ 8 +//#define ETH_SPI_HOST SPI3_HOST +//#define SPI_CLOCK_MHZ 20 // Must connect INT to GPIOxx or not working //#define INT_GPIO 4 @@ -105,12 +105,10 @@ void setup() // start the ethernet connection and the server: // Use DHCP dynamic IP and random mac - uint16_t index = millis() % NUMBER_OF_MAC; - //bool begin(int MISO_GPIO, int MOSI_GPIO, int SCLK_GPIO, int CS_GPIO, int INT_GPIO, int SPI_CLOCK_MHZ, - // int SPI_HOST, uint8_t *ENC28J60_Mac = ENC28J60_Default_Mac); - //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST ); - ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST, mac[index] ); + // int SPI_HOST, uint8_t *W6100_Mac = W6100_Default_Mac); + ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST ); + //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST, mac[millis() % NUMBER_OF_MAC] ); // Static IP, leave without this line to get IP via DHCP //bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0); diff --git a/examples/MQTTClient_Auth/MQTTClient_Auth.ino b/examples/MQTTClient_Auth/MQTTClient_Auth.ino index ef466b9..e89a4c9 100644 --- a/examples/MQTTClient_Auth/MQTTClient_Auth.ino +++ b/examples/MQTTClient_Auth/MQTTClient_Auth.ino @@ -35,8 +35,8 @@ ////////////////////////////////////////////////////////// // Optional values to override default settings -//#define SPI_HOST 1 -//#define SPI_CLOCK_MHZ 8 +//#define ETH_SPI_HOST SPI3_HOST +//#define SPI_CLOCK_MHZ 20 // Must connect INT to GPIOxx or not working //#define INT_GPIO 4 @@ -188,12 +188,10 @@ void setup() // start the ethernet connection and the server: // Use DHCP dynamic IP and random mac - uint16_t index = millis() % NUMBER_OF_MAC; - //bool begin(int MISO_GPIO, int MOSI_GPIO, int SCLK_GPIO, int CS_GPIO, int INT_GPIO, int SPI_CLOCK_MHZ, - // int SPI_HOST, uint8_t *ENC28J60_Mac = ENC28J60_Default_Mac); - //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST ); - ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST, mac[index] ); + // int SPI_HOST, uint8_t *W6100_Mac = W6100_Default_Mac); + ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST ); + //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST, mac[millis() % NUMBER_OF_MAC] ); // Static IP, leave without this line to get IP via DHCP //bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0); diff --git a/examples/MQTTClient_Basic/MQTTClient_Basic.ino b/examples/MQTTClient_Basic/MQTTClient_Basic.ino index 5555551..a58f5e4 100644 --- a/examples/MQTTClient_Basic/MQTTClient_Basic.ino +++ b/examples/MQTTClient_Basic/MQTTClient_Basic.ino @@ -36,8 +36,8 @@ ////////////////////////////////////////////////////////// // Optional values to override default settings -//#define SPI_HOST 1 -//#define SPI_CLOCK_MHZ 8 +//#define ETH_SPI_HOST SPI3_HOST +//#define SPI_CLOCK_MHZ 20 // Must connect INT to GPIOxx or not working //#define INT_GPIO 4 @@ -189,11 +189,10 @@ void setup() // start the ethernet connection and the server: // Use DHCP dynamic IP and random mac - uint16_t index = millis() % NUMBER_OF_MAC; - //bool begin(int MISO_GPIO, int MOSI_GPIO, int SCLK_GPIO, int CS_GPIO, int INT_GPIO, int SPI_CLOCK_MHZ, - // int SPI_HOST, uint8_t *ENC28J60_Mac = ENC28J60_Default_Mac); - //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST ); + // int SPI_HOST, uint8_t *W6100_Mac = W6100_Default_Mac); + ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST ); + //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST, mac[millis() % NUMBER_OF_MAC] ); ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST, mac[index] ); // Static IP, leave without this line to get IP via DHCP diff --git a/examples/MQTT_ThingStream/MQTT_ThingStream.ino b/examples/MQTT_ThingStream/MQTT_ThingStream.ino index 64b557a..00da35f 100644 --- a/examples/MQTT_ThingStream/MQTT_ThingStream.ino +++ b/examples/MQTT_ThingStream/MQTT_ThingStream.ino @@ -38,8 +38,8 @@ ////////////////////////////////////////////////////////// // Optional values to override default settings -//#define SPI_HOST 1 -//#define SPI_CLOCK_MHZ 8 +//#define ETH_SPI_HOST SPI3_HOST +//#define SPI_CLOCK_MHZ 20 // Must connect INT to GPIOxx or not working //#define INT_GPIO 4 @@ -234,12 +234,10 @@ void setup() // start the ethernet connection and the server: // Use DHCP dynamic IP and random mac - uint16_t index = millis() % NUMBER_OF_MAC; - //bool begin(int MISO_GPIO, int MOSI_GPIO, int SCLK_GPIO, int CS_GPIO, int INT_GPIO, int SPI_CLOCK_MHZ, - // int SPI_HOST, uint8_t *ENC28J60_Mac = ENC28J60_Default_Mac); - //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST ); - ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST, mac[index] ); + // int SPI_HOST, uint8_t *W6100_Mac = W6100_Default_Mac); + ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST ); + //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST, mac[millis() % NUMBER_OF_MAC] ); // Static IP, leave without this line to get IP via DHCP //bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0); diff --git a/examples/PostServer/PostServer.ino b/examples/PostServer/PostServer.ino index 0130ee0..d331d42 100644 --- a/examples/PostServer/PostServer.ino +++ b/examples/PostServer/PostServer.ino @@ -22,8 +22,8 @@ ////////////////////////////////////////////////////////// // Optional values to override default settings -//#define SPI_HOST 1 -//#define SPI_CLOCK_MHZ 8 +//#define ETH_SPI_HOST SPI3_HOST +//#define SPI_CLOCK_MHZ 20 // Must connect INT to GPIOxx or not working //#define INT_GPIO 4 @@ -180,12 +180,10 @@ void setup() // start the ethernet connection and the server: // Use DHCP dynamic IP and random mac - uint16_t index = millis() % NUMBER_OF_MAC; - //bool begin(int MISO_GPIO, int MOSI_GPIO, int SCLK_GPIO, int CS_GPIO, int INT_GPIO, int SPI_CLOCK_MHZ, - // int SPI_HOST, uint8_t *ENC28J60_Mac = ENC28J60_Default_Mac); - //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST ); - ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST, mac[index] ); + // int SPI_HOST, uint8_t *W6100_Mac = W6100_Default_Mac); + ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST ); + //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST, mac[millis() % NUMBER_OF_MAC] ); // Static IP, leave without this line to get IP via DHCP //bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0); diff --git a/examples/SimpleAuthentication/SimpleAuthentication.ino b/examples/SimpleAuthentication/SimpleAuthentication.ino index c4422bd..3d6c0c5 100644 --- a/examples/SimpleAuthentication/SimpleAuthentication.ino +++ b/examples/SimpleAuthentication/SimpleAuthentication.ino @@ -22,8 +22,8 @@ ////////////////////////////////////////////////////////// // Optional values to override default settings -//#define SPI_HOST 1 -//#define SPI_CLOCK_MHZ 8 +//#define ETH_SPI_HOST SPI3_HOST +//#define SPI_CLOCK_MHZ 20 // Must connect INT to GPIOxx or not working //#define INT_GPIO 4 @@ -224,12 +224,10 @@ void setup() // start the ethernet connection and the server: // Use DHCP dynamic IP and random mac - uint16_t index = millis() % NUMBER_OF_MAC; - //bool begin(int MISO_GPIO, int MOSI_GPIO, int SCLK_GPIO, int CS_GPIO, int INT_GPIO, int SPI_CLOCK_MHZ, - // int SPI_HOST, uint8_t *ENC28J60_Mac = ENC28J60_Default_Mac); - //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST ); - ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST, mac[index] ); + // int SPI_HOST, uint8_t *W6100_Mac = W6100_Default_Mac); + ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST ); + //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST, mac[millis() % NUMBER_OF_MAC] ); // Static IP, leave without this line to get IP via DHCP //bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0); diff --git a/examples/UdpNTPClient/UdpNTPClient.ino b/examples/UdpNTPClient/UdpNTPClient.ino index 97ff630..4028783 100644 --- a/examples/UdpNTPClient/UdpNTPClient.ino +++ b/examples/UdpNTPClient/UdpNTPClient.ino @@ -27,8 +27,8 @@ ////////////////////////////////////////////////////////// // Optional values to override default settings -//#define SPI_HOST 1 -//#define SPI_CLOCK_MHZ 8 +//#define ETH_SPI_HOST SPI3_HOST +//#define SPI_CLOCK_MHZ 20 // Must connect INT to GPIOxx or not working //#define INT_GPIO 4 @@ -142,12 +142,10 @@ void setup() // start the ethernet connection and the server: // Use DHCP dynamic IP and random mac - uint16_t index = millis() % NUMBER_OF_MAC; - //bool begin(int MISO_GPIO, int MOSI_GPIO, int SCLK_GPIO, int CS_GPIO, int INT_GPIO, int SPI_CLOCK_MHZ, - // int SPI_HOST, uint8_t *ENC28J60_Mac = ENC28J60_Default_Mac); - //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST ); - ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST, mac[index] ); + // int SPI_HOST, uint8_t *W6100_Mac = W6100_Default_Mac); + ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST ); + //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST, mac[millis() % NUMBER_OF_MAC] ); // Static IP, leave without this line to get IP via DHCP //bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0); diff --git a/examples/UdpSendReceive/UdpSendReceive.ino b/examples/UdpSendReceive/UdpSendReceive.ino index 2aee65a..a57e56e 100644 --- a/examples/UdpSendReceive/UdpSendReceive.ino +++ b/examples/UdpSendReceive/UdpSendReceive.ino @@ -22,8 +22,8 @@ ////////////////////////////////////////////////////////// // Optional values to override default settings -//#define SPI_HOST 1 -//#define SPI_CLOCK_MHZ 8 +//#define ETH_SPI_HOST SPI3_HOST +//#define SPI_CLOCK_MHZ 20 // Must connect INT to GPIOxx or not working //#define INT_GPIO 4 @@ -138,12 +138,10 @@ void setup() // start the ethernet connection and the server: // Use DHCP dynamic IP and random mac - uint16_t index = millis() % NUMBER_OF_MAC; - //bool begin(int MISO_GPIO, int MOSI_GPIO, int SCLK_GPIO, int CS_GPIO, int INT_GPIO, int SPI_CLOCK_MHZ, - // int SPI_HOST, uint8_t *ENC28J60_Mac = ENC28J60_Default_Mac); - //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST ); - ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST, mac[index] ); + // int SPI_HOST, uint8_t *W6100_Mac = W6100_Default_Mac); + ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST ); + //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST, mac[millis() % NUMBER_OF_MAC] ); // Static IP, leave without this line to get IP via DHCP //bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0); diff --git a/examples/WebClient/WebClient.ino b/examples/WebClient/WebClient.ino index d7adec7..2403195 100644 --- a/examples/WebClient/WebClient.ino +++ b/examples/WebClient/WebClient.ino @@ -22,8 +22,8 @@ ////////////////////////////////////////////////////////// // Optional values to override default settings -//#define SPI_HOST 1 -//#define SPI_CLOCK_MHZ 8 +//#define ETH_SPI_HOST SPI3_HOST +//#define SPI_CLOCK_MHZ 20 // Must connect INT to GPIOxx or not working //#define INT_GPIO 4 @@ -105,12 +105,10 @@ void setup() // start the ethernet connection and the server: // Use DHCP dynamic IP and random mac - uint16_t index = millis() % NUMBER_OF_MAC; - //bool begin(int MISO_GPIO, int MOSI_GPIO, int SCLK_GPIO, int CS_GPIO, int INT_GPIO, int SPI_CLOCK_MHZ, - // int SPI_HOST, uint8_t *ENC28J60_Mac = ENC28J60_Default_Mac); - //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST ); - ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST, mac[index] ); + // int SPI_HOST, uint8_t *W6100_Mac = W6100_Default_Mac); + ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST ); + //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST, mac[millis() % NUMBER_OF_MAC] ); // Static IP, leave without this line to get IP via DHCP //bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0); diff --git a/examples/WebClientRepeating/WebClientRepeating.ino b/examples/WebClientRepeating/WebClientRepeating.ino index 4259605..c281750 100644 --- a/examples/WebClientRepeating/WebClientRepeating.ino +++ b/examples/WebClientRepeating/WebClientRepeating.ino @@ -27,8 +27,8 @@ ////////////////////////////////////////////////////////// // Optional values to override default settings -//#define SPI_HOST 1 -//#define SPI_CLOCK_MHZ 8 +//#define ETH_SPI_HOST SPI3_HOST +//#define SPI_CLOCK_MHZ 20 // Must connect INT to GPIOxx or not working //#define INT_GPIO 4 @@ -143,12 +143,10 @@ void setup() // start the ethernet connection and the server: // Use DHCP dynamic IP and random mac - uint16_t index = millis() % NUMBER_OF_MAC; - //bool begin(int MISO_GPIO, int MOSI_GPIO, int SCLK_GPIO, int CS_GPIO, int INT_GPIO, int SPI_CLOCK_MHZ, - // int SPI_HOST, uint8_t *ENC28J60_Mac = ENC28J60_Default_Mac); - //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST ); - ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST, mac[index] ); + // int SPI_HOST, uint8_t *W6100_Mac = W6100_Default_Mac); + ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST ); + //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST, mac[millis() % NUMBER_OF_MAC] ); // Static IP, leave without this line to get IP via DHCP //bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0); diff --git a/examples/WebServer/WebServer.ino b/examples/WebServer/WebServer.ino index d17ed94..5ab16ba 100644 --- a/examples/WebServer/WebServer.ino +++ b/examples/WebServer/WebServer.ino @@ -22,8 +22,8 @@ ////////////////////////////////////////////////////////// // Optional values to override default settings -//#define SPI_HOST 1 -//#define SPI_CLOCK_MHZ 8 +//#define ETH_SPI_HOST SPI3_HOST +//#define SPI_CLOCK_MHZ 20 // Must connect INT to GPIOxx or not working //#define INT_GPIO 4 @@ -104,12 +104,10 @@ void setup() // start the ethernet connection and the server: // Use DHCP dynamic IP and random mac - uint16_t index = millis() % NUMBER_OF_MAC; - //bool begin(int MISO_GPIO, int MOSI_GPIO, int SCLK_GPIO, int CS_GPIO, int INT_GPIO, int SPI_CLOCK_MHZ, - // int SPI_HOST, uint8_t *ENC28J60_Mac = ENC28J60_Default_Mac); - //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST ); - ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, SPI_HOST, mac[index] ); + // int SPI_HOST, uint8_t *W6100_Mac = W6100_Default_Mac); + ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST ); + //ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST, mac[millis() % NUMBER_OF_MAC] ); // Static IP, leave without this line to get IP via DHCP //bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0); diff --git a/library.json b/library.json index 6d3c3ff..783ddd6 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "WebServer_ESP32_ENC", - "version": "1.5.1", + "version": "1.5.3", "keywords": "WebServer, Ethernet, MQTT, MQTTS, HTTP, HTTPS, SSL, Arduino, ESP32, ENC28J60, HTTP-Client, WebSocket-Client, MQTT-Client, server, client, websocket, LittleFS, SPIFFS, ThingStream", "description": "Simple Ethernet WebServer, HTTP/HTTPS Client wrapper library for ESP32 boards using ENC28J60 with LwIP Ethernet library. The WebServer supports HTTP(S) GET and POST requests, provides argument parsing, handles one client at a time. It provides HTTP(S), MQTT(S) Client and supports WebServer serving from LittleFS/SPIFFS", "authors": diff --git a/library.properties b/library.properties index 6e3646d..ccab9e5 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=WebServer_ESP32_ENC -version=1.5.1 +version=1.5.3 author=Khoi Hoang license=GPLv3 maintainer=Khoi Hoang diff --git a/pics/ENC28J60.png b/pics/ENC28J60.png new file mode 100644 index 0000000..dfaf18b Binary files /dev/null and b/pics/ENC28J60.png differ diff --git a/platformio/platformio.ini b/platformio/platformio.ini index 0dbe720..90f3eb0 100644 --- a/platformio/platformio.ini +++ b/platformio/platformio.ini @@ -29,19 +29,24 @@ upload_speed = 921600 ;monitor_speed = 9600 ;monitor_port = COM11 +; ============================================================ ; Checks for the compatibility with frameworks and dev/platforms lib_compat_mode = strict lib_ldf_mode = chain+ ;lib_ldf_mode = deep+ +; ============================================================ lib_deps = +; ============================================================ build_flags = ; set your debug output (default=Serial) -D DEBUG_ESP_PORT=Serial ; comment the following line to enable WiFi debugging -D NDEBUG +; ============================================================ +; ============================================================ [env:ESP32] platform = espressif32 framework = arduino @@ -84,6 +89,8 @@ board = esp32doit-devkit-v1 ;board = iotbusproteus ;board = nina_w10 +; ============================================================ +; ============================================================ [env:esp32s2] platform = espressif32 framework = arduino @@ -112,7 +119,8 @@ build_flags = -DARDUINO_ESP32S2_DEV -DARDUINO_VARIANT="esp32s2" - +; ============================================================ +; ============================================================ [env:esp32s3] platform = espressif32 framework = arduino @@ -131,7 +139,8 @@ build_flags = -DARDUINO_ESP32S3_DEV -DARDUINO_VARIANT="esp32s3" - +; ============================================================ +; ============================================================ [env:esp32sc3] platform = espressif32 framework = arduino @@ -149,3 +158,7 @@ build_unflags = build_flags = -DARDUINO_ESP32S3_DEV -DARDUINO_VARIANT="esp32c3" + +; ============================================================ +; ============================================================ + diff --git a/src/WebServer_ESP32_ENC.h b/src/WebServer_ESP32_ENC.h index 811f375..9f0a1d8 100644 --- a/src/WebServer_ESP32_ENC.h +++ b/src/WebServer_ESP32_ENC.h @@ -5,15 +5,16 @@ WebServer_ESP32_ENC is a library for the ESP32 with Ethernet ENC28J60 to run WebServer - Based on and modified from ESP8266 https://github.com/esp8266/Arduino/releases + Based on and modified from ESP32-IDF https://github.com/espressif/esp-idf Built by Khoi Hoang https://github.com/khoih-prog/WebServer_ESP32_ENC Licensed under GPLv3 license - Version: 1.5.1 + Version: 1.5.3 Version Modified By Date Comments ------- ----------- ---------- ----------- 1.5.1 K Hoang 28/11/2022 Initial coding for ESP32_ENC (ESP32 + ENC28J60). Sync with WebServer_WT32_ETH01 v1.5.1 + 1.5.3 K Hoang 11/01/2023 Using built-in ESP32 MAC. Increase default SPI clock to 20MHz from 8MHz *****************************************************************************************************************************/ #pragma once @@ -31,28 +32,52 @@ #warning Using code for ESP32 core v2.0.0+ in WebServer_ESP32_ENC.h #endif - #define WEBSERVER_ESP32_ENC_VERSION "WebServer_ESP32_ENC v1.5.1 for core v2.0.0+" + #define WEBSERVER_ESP32_ENC_VERSION "WebServer_ESP32_ENC v1.5.3 for core v2.0.0+" #else #if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 2) #warning Using code for ESP32 core v1.0.6- in WebServer_ESP32_ENC.h #endif - #define WEBSERVER_ESP32_ENC_VERSION "WebServer_ESP32_ENC v1.5.1 for core v1.0.6-" + #define WEBSERVER_ESP32_ENC_VERSION "WebServer_ESP32_ENC v1.5.3 for core v1.0.6-" #endif #define WEBSERVER_ESP32_ENC_VERSION_MAJOR 1 #define WEBSERVER_ESP32_ENC_VERSION_MINOR 5 -#define WEBSERVER_ESP32_ENC_VERSION_PATCH 1 +#define WEBSERVER_ESP32_ENC_VERSION_PATCH 3 -#define WEBSERVER_ESP32_ENC_VERSION_INT 1005001 +#define WEBSERVER_ESP32_ENC_VERSION_INT 1005003 + +////////////////////////////////////////////////////////////// + +#if ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_ESP32S2_THING_PLUS || ARDUINO_MICROS2 || \ + ARDUINO_METRO_ESP32S2 || ARDUINO_MAGTAG29_ESP32S2 || ARDUINO_FUNHOUSE_ESP32S2 || \ + ARDUINO_ADAFRUIT_FEATHER_ESP32S2_NOPSRAM ) + + #error ESP32_S2 not supported. Use WebServer_ESP32_SC_ENC library + +#elif ( defined(ARDUINO_ESP32C3_DEV) ) + + #error ESP32_C3 not supported. Use WebServer_ESP32_SC_ENC library + +#elif ( defined(ARDUINO_ESP32S3_DEV) || defined(ARDUINO_ESP32_S3_BOX) || defined(ARDUINO_TINYS3) || \ + defined(ARDUINO_PROS3) || defined(ARDUINO_FEATHERS3) ) + + #error ESP32_S3 not supported. Use WebServer_ESP32_SC_ENC library + +#elif ESP32 + + #if (_ETHERNET_WEBSERVER_LOGLEVEL_ > 3) + #warning Using ESP32 architecture for WebServer_ESP32_W5500 + #endif + +#define BOARD_NAME ARDUINO_BOARD -#if ESP32 - #warning Using ESP32 architecture for WebServer_ESP32_ENC - #define BOARD_NAME ARDUINO_BOARD #else #error This code is designed to run on ESP32 platform! Please check your Tools->Board setting. #endif +////////////////////////////////////////////////////////////// + #include #include "WebServer_ESP32_ENC_Debug.h" diff --git a/src/WebServer_ESP32_ENC.hpp b/src/WebServer_ESP32_ENC.hpp index 877d4e6..fa8cf78 100644 --- a/src/WebServer_ESP32_ENC.hpp +++ b/src/WebServer_ESP32_ENC.hpp @@ -5,15 +5,16 @@ WebServer_ESP32_ENC is a library for the ESP32 with Ethernet ENC28J60 to run WebServer - Based on and modified from ESP8266 https://github.com/esp8266/Arduino/releases + Based on and modified from ESP32-IDF https://github.com/espressif/esp-idf Built by Khoi Hoang https://github.com/khoih-prog/WebServer_ESP32_ENC Licensed under GPLv3 license - Version: 1.5.1 + Version: 1.5.3 Version Modified By Date Comments ------- ----------- ---------- ----------- 1.5.1 K Hoang 28/11/2022 Initial coding for ESP32_ENC (ESP32 + ENC28J60). Sync with WebServer_WT32_ETH01 v1.5.1 + 1.5.3 K Hoang 11/01/2023 Using built-in ESP32 MAC. Increase default SPI clock to 20MHz from 8MHz *****************************************************************************************************************************/ #pragma once @@ -27,11 +28,15 @@ #include // Introduce corresponding libraries #if !defined(SPI_HOST) - #define SPI_HOST 1 + #define SPI_HOST SPI3_HOST +#endif + +#if !defined(ETH_SPI_HOST) + #define ETH_SPI_HOST SPI3_HOST #endif #if !defined(SPI_CLOCK_MHZ) - #define SPI_CLOCK_MHZ 8 + #define SPI_CLOCK_MHZ 20 //8 #endif #if !defined(INT_GPIO) @@ -54,10 +59,14 @@ #define CS_GPIO 5 #endif +////////////////////////////////////////////////////////////// + #ifndef SHIELD_TYPE #define SHIELD_TYPE "ESP32_ENC28J60" #endif +////////////////////////////////////////////////////////////// + extern bool ESP32_ENC_eth_connected; extern void ESP32_ENC_onEvent(); diff --git a/src/WebServer_ESP32_ENC_Debug.h b/src/WebServer_ESP32_ENC_Debug.h index c3a0b05..e907dd5 100644 --- a/src/WebServer_ESP32_ENC_Debug.h +++ b/src/WebServer_ESP32_ENC_Debug.h @@ -5,15 +5,16 @@ WebServer_ESP32_ENC is a library for the ESP32 with Ethernet ENC28J60 to run WebServer - Based on and modified from ESP8266 https://github.com/esp8266/Arduino/releases + Based on and modified from ESP32-IDF https://github.com/espressif/esp-idf Built by Khoi Hoang https://github.com/khoih-prog/WebServer_ESP32_ENC Licensed under GPLv3 license - Version: 1.5.1 + Version: 1.5.3 Version Modified By Date Comments ------- ----------- ---------- ----------- 1.5.1 K Hoang 28/11/2022 Initial coding for ESP32_ENC (ESP32 + ENC28J60). Sync with WebServer_WT32_ETH01 v1.5.1 + 1.5.3 K Hoang 11/01/2023 Using built-in ESP32 MAC. Increase default SPI clock to 20MHz from 8MHz *****************************************************************************************************************************/ #pragma once diff --git a/src/WebServer_ESP32_ENC_Impl.h b/src/WebServer_ESP32_ENC_Impl.h index 9ce538d..ef0731c 100644 --- a/src/WebServer_ESP32_ENC_Impl.h +++ b/src/WebServer_ESP32_ENC_Impl.h @@ -5,15 +5,16 @@ WebServer_ESP32_ENC is a library for the ESP32 with Ethernet ENC28J60 to run WebServer - Based on and modified from ESP8266 https://github.com/esp8266/Arduino/releases + Based on and modified from ESP32-IDF https://github.com/espressif/esp-idf Built by Khoi Hoang https://github.com/khoih-prog/WebServer_ESP32_ENC Licensed under GPLv3 license - Version: 1.5.1 + Version: 1.5.3 Version Modified By Date Comments ------- ----------- ---------- ----------- 1.5.1 K Hoang 28/11/2022 Initial coding for ESP32_ENC (ESP32 + ENC28J60). Sync with WebServer_WT32_ETH01 v1.5.1 + 1.5.3 K Hoang 11/01/2023 Using built-in ESP32 MAC. Increase default SPI clock to 20MHz from 8MHz *****************************************************************************************************************************/ #pragma once diff --git a/src/enc28j60/esp32_enc28j60.cpp b/src/enc28j60/esp32_enc28j60.cpp index 0000b4d..7007432 100644 --- a/src/enc28j60/esp32_enc28j60.cpp +++ b/src/enc28j60/esp32_enc28j60.cpp @@ -5,15 +5,16 @@ WebServer_ESP32_ENC is a library for the ESP32 with Ethernet ENC28J60 to run WebServer - Based on and modified from ESP8266 https://github.com/esp8266/Arduino/releases + Based on and modified from ESP32-IDF https://github.com/espressif/esp-idf Built by Khoi Hoang https://github.com/khoih-prog/WebServer_ESP32_ENC Licensed under GPLv3 license - Version: 1.5.1 + Version: 1.5.3 Version Modified By Date Comments ------- ----------- ---------- ----------- 1.5.1 K Hoang 28/11/2022 Initial coding for ESP32_ENC (ESP32 + ENC28J60). Sync with WebServer_WT32_ETH01 v1.5.1 + 1.5.3 K Hoang 11/01/2023 Using built-in ESP32 MAC. Increase default SPI clock to 20MHz from 8MHz *****************************************************************************************************************************/ /* Based on ETH.h from arduino-esp32 and esp-idf @@ -68,7 +69,26 @@ bool ESP32_ENC::begin(int MISO, int MOSI, int SCLK, int CS, int INT, int SPICLOC { tcpipInit(); - esp_base_mac_addr_set( ENC28J60_Mac ); + //esp_base_mac_addr_set( ENC28J60_Mac ); + + if ( esp_read_mac(mac_eth, ESP_MAC_ETH) == ESP_OK ) + { + char macStr[18] = { 0 }; + + sprintf(macStr, "%02X:%02X:%02X:%02X:%02X:%02X", mac_eth[0], mac_eth[1], mac_eth[2], + mac_eth[3], mac_eth[4], mac_eth[5]); + + ET_LOGINFO1("Using built-in mac_eth =", macStr); + + esp_base_mac_addr_set( mac_eth ); + } + else + { + ET_LOGINFO("Using user mac_eth"); + memcpy(mac_eth, ENC28J60_Mac, sizeof(mac_eth)); + + esp_base_mac_addr_set( ENC28J60_Mac ); + } tcpip_adapter_set_default_eth_handlers(); @@ -107,7 +127,7 @@ bool ESP32_ENC::begin(int MISO, int MOSI, int SCLK, int CS, int INT, int SPICLOC return false; } - eth_mac->set_addr(eth_mac, ENC28J60_Mac); + eth_mac->set_addr(eth_mac, mac_eth); if (emac_enc28j60_get_chip_info(eth_mac) < ENC28J60_REV_B5 && SPICLOCK_MHZ < 8) { diff --git a/src/enc28j60/esp32_enc28j60.h b/src/enc28j60/esp32_enc28j60.h index 4ac5c55..2b8ad70 100644 --- a/src/enc28j60/esp32_enc28j60.h +++ b/src/enc28j60/esp32_enc28j60.h @@ -5,15 +5,16 @@ WebServer_ESP32_ENC is a library for the ESP32 with Ethernet ENC28J60 to run WebServer - Based on and modified from ESP8266 https://github.com/esp8266/Arduino/releases + Based on and modified from ESP32-IDF https://github.com/espressif/esp-idf Built by Khoi Hoang https://github.com/khoih-prog/WebServer_ESP32_ENC Licensed under GPLv3 license - Version: 1.5.1 + Version: 1.5.3 Version Modified By Date Comments ------- ----------- ---------- ----------- 1.5.1 K Hoang 28/11/2022 Initial coding for ESP32_ENC (ESP32 + ENC28J60). Sync with WebServer_WT32_ETH01 v1.5.1 + 1.5.3 K Hoang 11/01/2023 Using built-in ESP32 MAC. Increase default SPI clock to 20MHz from 8MHz *****************************************************************************************************************************/ /* esp32_enc28j60.h - ETH PHY support for ENC28J60 @@ -28,6 +29,8 @@ #include "esp_system.h" #include "esp_eth.h" +#include + //////////////////////////////////////// #if ESP_IDF_VERSION_MAJOR < 4 || ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4,4,0) @@ -46,7 +49,7 @@ class ESP32_ENC bool initialized; bool staticIP; - //static uint8_t ENC28J60_Default_Mac[6] = { 0x02, 0x00, 0xDE, 0xAD, 0xBE, 0xEF }; + uint8_t mac_eth[6] = { 0xFE, 0xED, 0xDE, 0xAD, 0xBE, 0xEF }; #if ESP_IDF_VERSION_MAJOR > 3 esp_eth_handle_t eth_handle; @@ -64,7 +67,7 @@ class ESP32_ENC ESP32_ENC(); ~ESP32_ENC(); - bool begin(int MISO, int MOSI, int SCLK, int CS, int INT, int SPICLOCK_MHZ, int SPIHOST, + bool begin(int MISO, int MOSI, int SCLK, int CS, int INT, int SPICLOCK_MHZ = 8, int SPIHOST = SPI3_HOST, uint8_t *ENC28J60_Mac = ENC28J60_Default_Mac); bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = (uint32_t)0x00000000, diff --git a/src/enc28j60/extmod/enc28j60.h b/src/enc28j60/extmod/enc28j60.h index a696484..cf2e271 100644 --- a/src/enc28j60/extmod/enc28j60.h +++ b/src/enc28j60/extmod/enc28j60.h @@ -1,3 +1,22 @@ +/**************************************************************************************************************************** + enc28j60.h + + For Ethernet shields using ESP32_ENC (ESP32 + ENC28J60) + + WebServer_ESP32_ENC is a library for the ESP32 with Ethernet ENC28J60 to run WebServer + + Based on and modified from ESP32-IDF https://github.com/espressif/esp-idf + Built by Khoi Hoang https://github.com/khoih-prog/WebServer_ESP32_ENC + Licensed under GPLv3 license + + Version: 1.5.3 + + Version Modified By Date Comments + ------- ----------- ---------- ----------- + 1.5.1 K Hoang 28/11/2022 Initial coding for ESP32_ENC (ESP32 + ENC28J60). Sync with WebServer_WT32_ETH01 v1.5.1 + 1.5.3 K Hoang 11/01/2023 Using built-in ESP32 MAC. Increase default SPI clock to 20MHz from 8MHz + *****************************************************************************************************************************/ + // Copyright 2019 Espressif Systems (Shanghai) PTE LTD // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/enc28j60/extmod/esp_eth_enc28j60.h b/src/enc28j60/extmod/esp_eth_enc28j60.h index 37a3c56..a5c2683 100644 --- a/src/enc28j60/extmod/esp_eth_enc28j60.h +++ b/src/enc28j60/extmod/esp_eth_enc28j60.h @@ -1,3 +1,21 @@ +/**************************************************************************************************************************** + esp_eth_enc28j60.c + + For Ethernet shields using ESP32_ENC (ESP32 + ENC28J60) + + WebServer_ESP32_ENC is a library for the ESP32 with Ethernet ENC28J60 to run WebServer + + Based on and modified from ESP32-IDF https://github.com/espressif/esp-idf + Built by Khoi Hoang https://github.com/khoih-prog/WebServer_ESP32_ENC + Licensed under GPLv3 license + + Version: 1.5.3 + + Version Modified By Date Comments + ------- ----------- ---------- ----------- + 1.5.1 K Hoang 28/11/2022 Initial coding for ESP32_ENC (ESP32 + ENC28J60). Sync with WebServer_WT32_ETH01 v1.5.1 + 1.5.3 K Hoang 11/01/2023 Using built-in ESP32 MAC. Increase default SPI clock to 20MHz from 8MHz + *****************************************************************************************************************************/ // Copyright 2021 Espressif Systems (Shanghai) PTE LTD // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/enc28j60/extmod/esp_eth_mac_enc28j60.c b/src/enc28j60/extmod/esp_eth_mac_enc28j60.c index 8f83d4b..0938262 100644 --- a/src/enc28j60/extmod/esp_eth_mac_enc28j60.c +++ b/src/enc28j60/extmod/esp_eth_mac_enc28j60.c @@ -1,3 +1,21 @@ +/**************************************************************************************************************************** + esp_eth_mac_enc28j60.c + + For Ethernet shields using ESP32_ENC (ESP32 + ENC28J60) + + WebServer_ESP32_ENC is a library for the ESP32 with Ethernet ENC28J60 to run WebServer + + Based on and modified from ESP32-IDF https://github.com/espressif/esp-idf + Built by Khoi Hoang https://github.com/khoih-prog/WebServer_ESP32_ENC + Licensed under GPLv3 license + + Version: 1.5.3 + + Version Modified By Date Comments + ------- ----------- ---------- ----------- + 1.5.1 K Hoang 28/11/2022 Initial coding for ESP32_ENC (ESP32 + ENC28J60). Sync with WebServer_WT32_ETH01 v1.5.1 + 1.5.3 K Hoang 11/01/2023 Using built-in ESP32 MAC. Increase default SPI clock to 20MHz from 8MHz + *****************************************************************************************************************************/ // Copyright 2019 Espressif Systems (Shanghai) PTE LTD // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/enc28j60/extmod/esp_eth_phy_enc28j60.c b/src/enc28j60/extmod/esp_eth_phy_enc28j60.c index 6d6402f..e38c5ab 100644 --- a/src/enc28j60/extmod/esp_eth_phy_enc28j60.c +++ b/src/enc28j60/extmod/esp_eth_phy_enc28j60.c @@ -1,3 +1,21 @@ +/**************************************************************************************************************************** + esp_eth_phy_enc28j60.c + + For Ethernet shields using ESP32_ENC (ESP32 + ENC28J60) + + WebServer_ESP32_ENC is a library for the ESP32 with Ethernet ENC28J60 to run WebServer + + Based on and modified from ESP32-IDF https://github.com/espressif/esp-idf + Built by Khoi Hoang https://github.com/khoih-prog/WebServer_ESP32_ENC + Licensed under GPLv3 license + + Version: 1.5.3 + + Version Modified By Date Comments + ------- ----------- ---------- ----------- + 1.5.1 K Hoang 28/11/2022 Initial coding for ESP32_ENC (ESP32 + ENC28J60). Sync with WebServer_WT32_ETH01 v1.5.1 + 1.5.3 K Hoang 11/01/2023 Using built-in ESP32 MAC. Increase default SPI clock to 20MHz from 8MHz + *****************************************************************************************************************************/ // Copyright 2019 Espressif Systems (Shanghai) PTE LTD // // Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/src/enc28j60/extmod/esp_eth_spi_enc28j60.c b/src/enc28j60/extmod/esp_eth_spi_enc28j60.c index 7f208f1..093847e 100644 --- a/src/enc28j60/extmod/esp_eth_spi_enc28j60.c +++ b/src/enc28j60/extmod/esp_eth_spi_enc28j60.c @@ -1,4 +1,22 @@ +/**************************************************************************************************************************** + esp_eth_spi_enc28j60.c + For Ethernet shields using ESP32_ENC (ESP32 + ENC28J60) + + WebServer_ESP32_ENC is a library for the ESP32 with Ethernet ENC28J60 to run WebServer + + Based on and modified from ESP32-IDF https://github.com/espressif/esp-idf + Built by Khoi Hoang https://github.com/khoih-prog/WebServer_ESP32_ENC + Licensed under GPLv3 license + + Version: 1.5.3 + + Version Modified By Date Comments + ------- ----------- ---------- ----------- + 1.5.1 K Hoang 28/11/2022 Initial coding for ESP32_ENC (ESP32 + ENC28J60). Sync with WebServer_WT32_ETH01 v1.5.1 + 1.5.3 K Hoang 11/01/2023 Using built-in ESP32 MAC. Increase default SPI clock to 20MHz from 8MHz + *****************************************************************************************************************************/ + #include #include #include "sdkconfig.h"