Description
Hardware:
Board: DOIT ESP32 DEVKIT V1, default settings
Core Installation version: 1.0.4
IDE name: Arduino EDE 1.8.9
Flash Frequency: default settings
PSRAM enabled: default settings
Upload Speed: 921600
Computer OS: Windows 10
Description:
Example of CaptivePortal crashed the ESP
Steps to replicate
- Uploaded the example CaptivePortal sketch (both the 1.0.4 version and the one on github do not work)
- Try to connect with the AP with an (android) device
- ESP panic'd and rebooted (loop back to step 2 and repeat until you are tired...)
What I expected
That the example sketch does not crash when a device connects to it.
and that the DNS server will redirect you as it suppose to
Sketch:
arduino-esp32/libraries/DNSServer/examples/CaptivePortal/CaptivePortal.ino
#include <DNSServer.h>
const byte DNS_PORT = 53;
IPAddress apIP(192, 168, 1, 1);
DNSServer dnsServer;
WiFiServer server(80);
String responseHTML = ""
"<!DOCTYPE html><html><head><title>CaptivePortal</title></head><body>"
"<h1>Hello World!</h1><p>This is a captive portal example. All requests will "
"be redirected here.</p></body></html>";
void setup() {
WiFi.disconnect(); //added to start with the wifi off, avoid crashing
WiFi.mode(WIFI_OFF); //added to start with the wifi off, avoid crashing
WiFi.mode(WIFI_AP);
WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
WiFi.softAP("DNSServer CaptivePortal example");
// if DNSServer is started with "*" for domain name, it will reply with
// provided IP to all DNS request
dnsServer.start(DNS_PORT, "*", apIP);
server.begin();
}
void loop() {
dnsServer.processNextRequest();
WiFiClient client = server.available(); // listen for incoming clients
if (client) {
String currentLine = "";
while (client.connected()) {
if (client.available()) {
char c = client.read();
if (c == '\n') {
if (currentLine.length() == 0) {
client.println("HTTP/1.1 200 OK");
client.println("Content-type:text/html");
client.println();
client.print(responseHTML);
break;
} else {
currentLine = "";
}
} else if (c != '\r') {
currentLine += c;
}
}
}
client.stop();
}
}
Debug Messages:
Enable Core debug level: Debug on tools menu of Arduino IDE, then put the serial output here
Crash error
`rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac
Guru Meditation Error: Core 0 panic'ed (InstrFetchProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x00000000 PS : 0x00060030 A0 : 0x8010feb1 A1 : 0x3ffb3b40
A2 : 0x3ffcc8a4 A3 : 0x3ffcbfe8 A4 : 0x3ffcb744 A5 : 0x3ffcb724
A6 : 0x0201a8c0 A7 : 0x0c01a8c0 A8 : 0x8010fd54 A9 : 0x3ffb3b00
A10 : 0x3ffcc8b4 A11 : 0x3ffcbfe8 A12 : 0x3ffb3b4c A13 : 0x00000044
A14 : 0x00000001 A15 : 0x00000006 SAR : 0x00000010 EXCCAUSE: 0x00000014
EXCVADDR: 0x00000000 LBEG : 0x4000c349 LEND : 0x4000c36b LCOUNT : 0x00000000
Backtrace: 0x00000000:0x3ffb3b40 0x4010feae:0x3ffb3b80 0x4011cd35:0x3ffb3ba0 0x40121d3d:0x3ffb3be0 0x40126fda:0x3ffb3c00 0x401108b7:0x3ffb3c20 0x400886e1:0x3ffb3c50`
=====DECODED
PC: 0x00000000
EXCVADDR: 0x00000000
Decoding stack results
0x4010feae: handle_dhcp at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/apps/dhcpserver/dhcpserver.c line 1031
0x4011cd35: udp_input at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/udp.c line 401
0x40121d3d: ip4_input at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/ipv4/ip4.c line 740
0x40126fda: ethernet_input at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/netif/ethernet.c line 184
0x401108b7: tcpip_thread at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/api/tcpip.c line 135
0x400886e1: vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c line 143
Metadata
Metadata
Assignees
Labels
Type
Projects
Status