ESP32 as WiFi access point crashes on connection

1

I'm programming an ESP32 via ArduinoIDE and stumble upon a strange problem. It operates as WiFi access point, the code is quite simple and straight-forward:

IPAddress apIP(192,168,1,1);

WiFi.mode(WIFI_AP);
WiFi.softAP("MyESP32");
WiFi.softAPConfig(apIP,apIP,IPAddress(255,255,255,0));

Now when a client connects to this AP, it often prints out these error messages:

dhcps: send_nak>>udp_sendto result 0
dhcps: send_offer>>udp_sendto result 0

...and sometimes they are followed by a crash:

Guru Meditation Error: Core  0 panic'ed (InstrFetchProhibited). Exception was unhandled.
Core 0 register dump:
PC      : 0x00000000  PS      : 0x00060e30  A0      : 0x8011cc29  A1      : 0x3ffb3e00  
A2      : 0x3ffcdbd0  A3      : 0x3ffcde04  A4      : 0x3ffcd844  A5      : 0x3ffcd824  
A6      : 0x0201a8c0  A7      : 0x0c01a8c0  A8      : 0x8011cacc  A9      : 0x3ffb3dc0  
A10     : 0x3ffcdbe0  A11     : 0x3ffcde04  A12     : 0x3ffb3e0c  A13     : 0x00000044  
A14     : 0x00000001  A15     : 0x00000006  SAR     : 0x00000010  EXCCAUSE: 0x00000014  
EXCVADDR: 0x00000000  LBEG    : 0x4000c349  LEND    : 0x4000c36b  LCOUNT  : 0x00000000  

Backtrace: 0x00000000:0x3ffb3e00 0x4011cc26:0x3ffb3e40 0x40129959:0x3ffb3e60 0x4012e961:0x3ffb3ea0 0x40133bfe:0x3ffb3ec0 0x4011d54b:0x3ffb3ee0 0x40089001:0x3ffb3f10

To say that clear: this happens during connection of a client, nothing else is done where my own ESP32 code would be involved.

Any idea what the reason could be for this and how to fix it?

arduino
wifi
arduino-ide
esp32
access-point
asked on Stack Overflow Dec 27, 2019 by Elmi

1 Answer

0

The core panic in the time of client connect can be solved by adding a 2 seconds delay after 'WiFi.softAP' and before 'WiFi.softAPConfig' like this:

IPAddress apIP(192,168,1,1);

WiFi.mode(WIFI_AP);
WiFi.softAP("MyESP32");
delay(2000);
WiFi.softAPConfig(apIP,apIP,IPAddress(255,255,255,0));

more info can be found here: WiFi.softAPIP() causes Core 0 panic'ed (InstrFetchProhibited)

answered on Stack Overflow Nov 22, 2020 by Saadat

User contributions licensed under CC BY-SA 3.0