Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Commit 26082cd

Browse files
authored
v2.2.0 for LwIP W6100 Ethernet
### Releases v2.2.0 1. Add support to `ESP32_S2/S3/C3` using `LwIP W6100 Ethernet` 2. Fix bug
1 parent 2342739 commit 26082cd

18 files changed

+400
-336
lines changed

CONTRIBUTING.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,34 @@ However, before reporting a bug please check through the following:
1010

1111
If you don't find anything, please [open a new issue](https://github.com/khoih-prog/AsyncUDP_ESP32_SC_Ethernet/issues/new).
1212

13+
---
14+
1315
### How to submit a bug report
1416

1517
Please ensure to specify the following:
1618

1719
* Arduino IDE version (e.g. 1.8.19) or Platform.io version
1820
* Board Type (e.g. ESP32S3_DEV, ESP32S2_DEV, ESP32C3_DEV)
19-
* Board Core Version (e.g. ESP32 core v2.0.5)
21+
* Board Core Version (e.g. ESP32 core v2.0.6)
2022
* Contextual information (e.g. what you were trying to achieve)
2123
* Simplest possible steps to reproduce
2224
* Anything that might be relevant in your opinion, such as:
2325
* Operating system (Windows, Ubuntu, etc.) and the output of `uname -a`
2426
* Network configuration
2527

2628

27-
Please be educated, civilized and constructive. 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.
29+
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.
2830

31+
---
2932

3033
### Example
3134

3235
```
3336
Arduino IDE version: 1.8.19
3437
ESP32S3_DEV board
35-
ESP32 core v2.0.5
38+
ESP32 core v2.0.6
3639
OS: Ubuntu 20.04 LTS
37-
Linux xy-Inspiron-3593 5.15.0-56-generic #62~20.04.1-Ubuntu SMP Tue Nov 22 21:24:20 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
38-
40+
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
3941
Context:
4042
I encountered a crash while using this library
4143
Steps to reproduce:

Images/W6100.png

116 KB
Loading

changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
## Table of Contents
1818

1919
* [Changelog](#changelog)
20+
* [Releases v2.2.0](#releases-v220)
2021
* [Releases v2.1.0](#releases-v210)
2122
* [Initial Releases v2.0.0](#initial-releases-v200)
2223

@@ -25,6 +26,11 @@
2526

2627
## Changelog
2728

29+
### Releases v2.2.0
30+
31+
1. Add support to `ESP32_S2/S3/C3` using `LwIP W6100 Ethernet`
32+
2. Fix bug
33+
2834
### Releases v2.1.0
2935

3036
1. Add support to `ESP32S2/C3` boards using `LwIP W5500 or ENC28J60 Ethernet`

examples/AsyncUDPClient/AsyncUDPClient.ino

Lines changed: 53 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
/****************************************************************************************************************************
22
Async_UdpClient.ino
33
4-
AsyncUDP_ESP32_SC_Ethernet is a Async UDP library for the ESP32_SC_Ethernet (ESP32S2/S3/C3 + LwIP W5500 / ENC28J60)
4+
AsyncUDP_ESP32_SC_Ethernet is a Async UDP library for the ESP32_SC_Ethernet (ESP32S2/S3/C3 + LwIP W5500 / W6100 / ENC28J60)
55
66
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
77
Built by Khoi Hoang https://github.com/khoih-prog/AsyncUDP_ESP32_SC_Ethernet
88
Licensed under GPLv3 license
99
*****************************************************************************************************************************/
1010

1111
#if !( defined(ESP32) )
12-
#error This code is designed for (ESP32S2/S3/C3 + LwIP W5500 or ENC28J60) to run on ESP32 platform! Please check your Tools->Board setting.
12+
#error This code is designed for (ESP32S2/S3/C3 + LwIP W5500, W6100 or ENC28J60) to run on ESP32 platform! Please check your Tools->Board setting.
1313
#endif
1414

1515
#include <Arduino.h>
1616

1717
#define USING_W5500 true
18+
#define USING_W6100 false
1819
#define USING_ENC28J60 false
1920

20-
#if !USING_W5500 && !USING_ENC28J60
21+
#if !USING_W5500 && !USING_W6100 && !USING_ENC28J60
2122
#undef USING_W5500
2223
#define USING_W5500 true
2324
#endif
@@ -31,6 +32,9 @@
3132

3233
#if USING_W5500
3334

35+
#define ESP32_Ethernet_onEvent ESP32_W5500_onEvent
36+
#define ESP32_Ethernet_waitForConnect ESP32_W5500_waitForConnect
37+
3438
// For ESP32_S3
3539
// Optional values to override default settings
3640
// Don't change unless you know what you're doing
@@ -61,12 +65,51 @@
6165

6266
//////////////////////////////////////////////////////////
6367

68+
#elif USING_W6100
69+
70+
#define ESP32_Ethernet_onEvent ESP32_W6100_onEvent
71+
#define ESP32_Ethernet_waitForConnect ESP32_W6100_waitForConnect
72+
73+
// For ESP32_S3
74+
// Optional values to override default settings
75+
// Don't change unless you know what you're doing
76+
//#define ETH_SPI_HOST SPI3_HOST
77+
//#define SPI_CLOCK_MHZ 25
78+
79+
// Must connect INT to GPIOxx or not working
80+
//#define INT_GPIO 4
81+
82+
//#define MISO_GPIO 13
83+
//#define MOSI_GPIO 11
84+
//#define SCK_GPIO 12
85+
//#define CS_GPIO 10
86+
87+
// For ESP32_C3
88+
// Optional values to override default settings
89+
// Don't change unless you know what you're doing
90+
//#define ETH_SPI_HOST SPI2_HOST
91+
//#define SPI_CLOCK_MHZ 25
92+
93+
// Must connect INT to GPIOxx or not working
94+
//#define INT_GPIO 10
95+
96+
//#define MISO_GPIO 5
97+
//#define MOSI_GPIO 6
98+
//#define SCK_GPIO 4
99+
//#define CS_GPIO 7
100+
101+
//////////////////////////////////////////////////////////
102+
64103
#else // #if USING_W5500
65104

66105
//////////////////////////////////////////////////////////
67106

68107
// For ENC28J60
69108

109+
#define ESP32_Ethernet_onEvent ESP32_ENC_onEvent
110+
#define ESP32_Ethernet_waitForConnect ESP32_ENC_waitForConnect
111+
#define ETH_SPI_HOST SPI_HOST
112+
70113
// Optional values to override default settings
71114
// Don't change unless you know what you're doing
72115
//#define ETH_SPI_HOST SPI2_HOST
@@ -154,45 +197,6 @@ void parsePacket(AsyncUDPPacket packet)
154197
packet.printf("Got %u bytes of data", packet.length());
155198
}
156199

157-
#if USING_W5500
158-
159-
void initEthernet()
160-
{
161-
UDP_LOGWARN(F("Default SPI pinout:"));
162-
UDP_LOGWARN1(F("SPI_HOST:"), ETH_SPI_HOST);
163-
UDP_LOGWARN1(F("MOSI:"), MOSI_GPIO);
164-
UDP_LOGWARN1(F("MISO:"), MISO_GPIO);
165-
UDP_LOGWARN1(F("SCK:"), SCK_GPIO);
166-
UDP_LOGWARN1(F("CS:"), CS_GPIO);
167-
UDP_LOGWARN1(F("INT:"), INT_GPIO);
168-
UDP_LOGWARN1(F("SPI Clock (MHz):"), SPI_CLOCK_MHZ);
169-
UDP_LOGWARN(F("========================="));
170-
171-
///////////////////////////////////
172-
173-
// To be called before ETH.begin()
174-
ESP32_W5500_onEvent();
175-
176-
// start the ethernet connection and the server:
177-
// Use DHCP dynamic IP and random mac
178-
uint16_t index = millis() % NUMBER_OF_MAC;
179-
180-
//bool begin(int MISO_GPIO, int MOSI_GPIO, int SCLK_GPIO, int CS_GPIO, int INT_GPIO, int SPI_CLOCK_MHZ,
181-
// int SPI_HOST, uint8_t *W5500_Mac = W5500_Default_Mac);
182-
//ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST );
183-
ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST, mac[index] );
184-
185-
// Static IP, leave without this line to get IP via DHCP
186-
//bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0);
187-
//ETH.config(myIP, myGW, mySN, myDNS);
188-
189-
ESP32_W5500_waitForConnect();
190-
191-
///////////////////////////////////
192-
}
193-
194-
#else
195-
196200
void initEthernet()
197201
{
198202
UDP_LOGWARN(F("Default SPI pinout:"));
@@ -208,28 +212,24 @@ void initEthernet()
208212
///////////////////////////////////
209213

210214
// To be called before ETH.begin()
211-
ESP32_ENC_onEvent();
215+
ESP32_Ethernet_onEvent();
212216

213217
// start the ethernet connection and the server:
214218
// Use DHCP dynamic IP and random mac
215-
uint16_t index = millis() % NUMBER_OF_MAC;
216-
217219
//bool begin(int MISO_GPIO, int MOSI_GPIO, int SCLK_GPIO, int CS_GPIO, int INT_GPIO, int SPI_CLOCK_MHZ,
218-
// int SPI_HOST, uint8_t *ENC28J60_Mac = ENC28J60_Default_Mac);
219-
//ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST );
220-
ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST, mac[index] );
220+
// int SPI_HOST, uint8_t *W6100_Mac = W6100_Default_Mac);
221+
ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST );
222+
//ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST, mac[millis() % NUMBER_OF_MAC] );
221223

222224
// Static IP, leave without this line to get IP via DHCP
223225
//bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0);
224226
//ETH.config(myIP, myGW, mySN, myDNS);
225227

226-
ESP32_ENC_waitForConnect();
228+
ESP32_Ethernet_waitForConnect();
227229

228230
///////////////////////////////////
229231
}
230232

231-
#endif
232-
233233
////////////////////////////////////
234234

235235
void setup()
@@ -247,6 +247,8 @@ void setup()
247247

248248
#if USING_W5500
249249
Serial.println(WEBSERVER_ESP32_SC_W5500_VERSION);
250+
#elif USING_W6100
251+
Serial.println(WEBSERVER_ESP32_SC_W6100_VERSION);
250252
#else
251253
Serial.println(WEBSERVER_ESP32_SC_ENC_VERSION);
252254
#endif

0 commit comments

Comments
 (0)