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?

Elmi
  • 5,899
  • 15
  • 72
  • 143
  • I suspect the problem is in the client code. Can you post a minimal client example that fails? – Bradford Needham Dec 27 '19 at 21:55
  • @BradfordNeedham the client is nothing special, just a Linux Notebook which connects to the Wifi AP of my ESP32. The ESP code is what is shown above. Fun fact: it seems the crash happens more probably the closer the notebook is to the ESP32. With a distance of >2m, it works properly all the time – Elmi Dec 30 '19 at 15:20
  • Have you ever solved the issue? I have exactly the same problem. – Aros Aug 24 '20 at 20:23
  • @Aros no, no solution found until now – Elmi Sep 10 '20 at 08:02
  • @ٍElmi. Could you try to use a variable for subnet too. Like 'IPAddress subnet(255,255,255,0)' and pass as third argument for 'softAPConfig'. Also I created a string as password and pass it to 'softAP' as second argument. I didn't try the NULL password for OPEN network; however only difference between my code and yours is those two variables. – Saadat Nov 01 '20 at 14:38
  • @Saadat the subnet already is part of the softAPConfig()-call!? Using a password also does not make a difference, currently I'm using one and still see this problem from time to time. – Elmi Nov 20 '20 at 06:57
  • @Elmi ; I had the same problem sometimes. I found something in here: https://github.com/espressif/arduino-esp32/issues/2025 ; For me, it solved by adding a 2 second delay after 'WiFi.softAP' and before 'WiFi.softAPConfig'. I add it as an answer. – Saadat Nov 22 '20 at 10:33

1 Answers1

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)

Saadat
  • 461
  • 6
  • 9