ESP Wifi Soft AP Crashing on Device Re-connect?
Posted: Thu May 14, 2020 10:40 pm
I thought I sent this earlier, but I can't find it in my history on on the board anywhere... hopefully not spamming here.
I'll do my best to provide the information that'll be helpful.
I'm using Platform IO, configured with a heltec_wifi_kit_32 board and the arduino framework. No pio libs installed.
When I build and upload the code, it starts the access point, and I can connect to it.
When I rebuild it (unchanged) and upload, and reconnect, it drops the esp into a reboot loop with a stack dump on the serial monitor.
If I change the ssid, and build and upload, it works once.
It seems like there is something I'm missing in my WiFi code, or there's a bug in the dhcp library when a client has an existing lease.
Any advice appreciated.
The code:
I'll do my best to provide the information that'll be helpful.
I'm using Platform IO, configured with a heltec_wifi_kit_32 board and the arduino framework. No pio libs installed.
When I build and upload the code, it starts the access point, and I can connect to it.
When I rebuild it (unchanged) and upload, and reconnect, it drops the esp into a reboot loop with a stack dump on the serial monitor.
If I change the ssid, and build and upload, it works once.
It seems like there is something I'm missing in my WiFi code, or there's a bug in the dhcp library when a client has an existing lease.
Any advice appreciated.
The code:
Code: Select all
#include <WiFi.h>
#include <WebServer.h>
#include <DNSServer.h>
IPAddress ip(192, 168, 1, 1);
void setup() {
delay(3000);
WiFi.disconnect();
WiFi.mode(WIFI_OFF);
WiFi.mode(WIFI_AP);
WiFi.softAPConfig(ip, ip, IPAddress(255, 255, 255, 0));
WiFi.softAP("test");
}
void loop() { }
Code: Select all
Rebooting...
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x17 (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:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5828
entry 0x400806ac
dhcps: send_offer>>udp_sendto result 0
Guru Meditation Error: Core 0 panic'ed (InstrFetchProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x00000000 PS : 0x00060e30 A0 : 0x8010dfd9 A1 : 0x3ffb3b40
A2 : 0x3ffcb660 A3 : 0x3ffcbc0c A4 : 0x3ffbda68 A5 : 0x3ffbda48
A6 : 0x0201a8c0 A7 : 0x0c01a8c0 A8 : 0x8010de7c A9 : 0x3ffb3b00
A10 : 0x3ffcb670 A11 : 0x3ffcbc0c A12 : 0x3ffb3b4c A13 : 0x00000044
A14 : 0x00000001 A15 : 0x00000006 SAR : 0x00000010 EXCCAUSE: 0x00000014
EXCVADDR: 0x00000000 LBEG : 0x4000c349 LEND : 0x4000c36b LCOUNT : 0x00000000
Backtrace: 0x00000000:0x3ffb3b40 0x4010dfd6:0x3ffb3b80 0x40116515:0x3ffb3ba0 0x4011b51d:0x3ffb3be0 0x40120642:0x3ffb3c00 0x4010e1a3:0x3ffb3c20 0x400886e1:0x3ffb3c50
#0 0x00000000:0x3ffb3b40 in ?? ??:0
#1 0x4010dfd6:0x3ffb3b80 in handle_dhcp at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/apps/dhcpserver/dhcpserver.c:1031
#2 0x40116515:0x3ffb3ba0 in udp_input at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/udp.c:401
#3 0x4011b51d:0x3ffb3be0 in ip4_input at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/core/ipv4/ip4.c:740
#4 0x40120642:0x3ffb3c00 in ethernet_input at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/netif/ethernet.c:184
#5 0x4010e1a3:0x3ffb3c20 in tcpip_thread at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/lwip/lwip/src/api/tcpip.c:483
#6 0x400886e1:0x3ffb3c50 in vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)