Description
Board
ESP32 Dev Module
Device Description
Proprietary board based on ESP32-WROOM-32E and RTL8201F, using APLL on GPIO17.
Hardware Configuration
PHY CLK from APLL via GPIO17.
Version
latest master (checkout manually)
IDE Name
arduino IDE
Operating System
windows 10
Flash frequency
80M
PSRAM enabled
no
Upload speed
921600
Description
The ethernet link is active, IP set by DHCP, and the standard client test is used (GET on google), when AP and STA are OFF, there is no problem, all client calls are all processed correctly, there is no ethernet disconnects.
However, when AP or when STA is enabled, ethernet link disconnections occurs at pretty much every client calls as can be seen below.
While i admit it is dubious to enable STA mode at the same time as ethernet, i tested it because the clients told they "configure" the STA "without connecting it" (whatever this means). So, i had to test. On the other hand i see no reason why the AP mode would cause any problem, it can be useful or necessary to have the AP running at the same time as ethernet and i dont see why or how they could interfere with each other.
The board power rails are as follow :
DC 5V power in -> 600R 0805 FB -> 1* 22uF 50V electrolytic + 10uF 16V ceramic ->
[RT9013]
->600R 0805 FB -> 2* 22uF 16V -> ESP32 VDD
->600R 0805 FB -> 1* 22uF 16V -> RTL8201F AVDD
->1* 22uF 16V -> RTL8201F DVDD
Of course there are multiple 100nF X7R decoupling caps all over, in particular before and after the LDO, and 6 around the RTL8201F, etc.
The RT9013 can provide 500mA @ 3.3V with good PSRR. So while 500mA does not let so much margin in peaks i doubt it is a problem of available current, provided all the storage available on the board; i will still verify that with scope and sourcemeter, i did not get any brownout either.
I suspect this is related to the TCP/IP handling or the ETH driver.
``
Sketch
#include <Arduino.h>
#include <ETH.h>
//#define ETH_CLK_MODE ETH_CLOCK_GPIO0_IN
#define ETH_CLK_MODE ETH_CLOCK_GPIO17_OUT
#define ETH_TYPE ETH_PHY_RTL8201
#define ETH_POWER_PIN 5
#define ETH_ADDR 0x01
#define ETH_MDC_PIN 23
#define ETH_MDIO_PIN 18
IPAddress voidAddr = IPAddress(0,0,0,0);
static bool eth_connected=false;
unsigned long c=0;
void EthEvent(WiFiEvent_t event){
switch (event)
{
case ARDUINO_EVENT_ETH_START:
Serial.println("ETH Started");
ETH.setHostname("esp32-ethernet");
break;
case ARDUINO_EVENT_ETH_CONNECTED:
Serial.println("ETH Connected");
break;
case ARDUINO_EVENT_ETH_GOT_IP:
Serial.print("ETH MAC: ");
Serial.println(ETH.macAddress());
Serial.print("IPv4: ");
Serial.println(ETH.localIP());
if (ETH.fullDuplex()){Serial.print("FULL_DUPLEX");}
Serial.print(" ");
Serial.print(ETH.linkSpeed());
Serial.println("Mbps");
eth_connected = true;
break;
case ARDUINO_EVENT_ETH_DISCONNECTED:
Serial.println("\nETH Disconnected");
eth_connected = false;
break;
case ARDUINO_EVENT_ETH_STOP:
Serial.println("ETH Stopped");
eth_connected = false;
break;
default:
break;
}
}
void testClient(const char *host, uint16_t port) {
Serial.print("connect ");
Serial.print(host);
WiFiClient client;
if(!client.connect(host, port)) {
Serial.println(" ... failed");
return;
}
client.printf("GET / HTTP/1.1\r\nHost: %s\r\n\r\n", host);
while (client.connected() && !client.available()) delay(1);
//while (client.available()) Serial.write(client.read());
while (client.available()){ client.read(); }
Serial.println(" ... closing");
client.stop();
}
void wifi_sta(void){
WiFi.begin("SFR_6200","inlandser");
Serial.print("Connecting");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println();
Serial.print("Wifi connected, IP address: ");
Serial.println(WiFi.localIP());
}
void wifi_ap(void){
WiFi.mode(WIFI_AP);
WiFi.softAP("ESP32_AP");
Serial.print("AP Created with IP Gateway ");
Serial.println(WiFi.softAPIP());
}
void wifi_off(void){
WiFi.disconnect(true);
WiFi.mode(WIFI_OFF);
}
void setup() {
Serial.begin(115200);
Serial.println("system init");
wifi_off();
//wifi_sta();
wifi_ap();
WiFi.onEvent(EthEvent);
ETH.begin(ETH_ADDR,ETH_POWER_PIN,ETH_MDC_PIN,ETH_MDIO_PIN,ETH_TYPE,ETH_CLK_MODE);
// trick to force DHCP re-acquisition https://github.com/espressif/arduino-esp32/issues/7795
ETH.config(voidAddr,voidAddr,voidAddr,voidAddr);
}
void loop() {
if(eth_connected && c++==50) {
testClient("www.google.com", 80);
c=0;
}
delay(5);
}
Debug Message
***************with only STA active**************
system init
Connecting.
Wifi connected, IP address: 192.168.1.34
ETH Started
ETH Connected
ETH MAC: 94:B5:55:6B:5D:B3
IPv4: 192.168.1.37
FULL_DUPLEX 100Mbps
connect www.google.com ... closing
connect www.google.com
ETH Disconnected
... closing
ETH Connected
ETH MAC: 94:B5:55:6B:5D:B3
IPv4: 192.168.1.37
FULL_DUPLEX 100Mbps
connect www.google.com ... closing
connect www.google.com
ETH Disconnected
... closing
ETH Connected
ETH MAC: 94:B5:55:6B:5D:B3
IPv4: 192.168.1.37
FULL_DUPLEX 100Mbps
connect www.google.com ... closing
connect www.google.com
ETH Disconnected
... closing
ETH Connected
ETH MAC: 94:B5:55:6B:5D:B3
IPv4: 192.168.1.37
FULL_DUPLEX 100Mbps
connect www.google.com ... closing
connect www.google.com
ETH Disconnected
... closing
ETH Connected
ETH MAC: 94:B5:55:6B:5D:B3
IPv4: 192.168.1.37
FULL_DUPLEX 100Mbps
connect www.google.com ... closing
connect www.google.com
ETH Disconnected
... closing
ETH Connected
ETH MAC: 94:B5:55:6B:5D:B3
IPv4: 192.168.1.37
FULL_DUPLEX 100Mbps
connect www.google.com ... closing
connect www.google.com ... closing
ETH Disconnected
ETH Connected
ETH MAC: 94:B5:55:6B:5D:B3
IPv4: 192.168.1.37
FULL_DUPLEX 100Mbps
connect www.google.com ... closing
connect www.google.com ... closing
***************with only AP active**************
system init
AP Created with IP Gateway 192.168.4.1
ETH Started
ETH Connected
ETH MAC: 94:B5:55:6B:5D:B3
IPv4: 192.168.1.37
FULL_DUPLEX 100Mbps
connect www.google.com ... closing
connect www.google.com
ETH Disconnected
[ 3786][E][WiFiClient.cpp:268] connect(): socket error on fd 48, errno: 113, "Software caused connection abort"
... failed
ETH Connected
ETH MAC: 94:B5:55:6B:5D:B3
IPv4: 192.168.1.37
FULL_DUPLEX 100Mbps
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com
ETH Disconnected
[ 21786][E][WiFiClient.cpp:268] connect(): socket error on fd 48, errno: 113, "Software caused connection abort"
... failed
***************with WiFi OFF**************
system init
ETH Started
ETH Connected
ETH MAC: 94:B5:55:6B:5D:B3
IPv4: 192.168.1.37
FULL_DUPLEX 100Mbps
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
connect www.google.com ... closing
Other Steps to Reproduce
No response
I have checked existing issues, online documentation and the Troubleshooting Guide
- I confirm I have checked existing issues, online documentation and Troubleshooting guide.