-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Closed
Milestone
Description
Basic Infos
- [ X ] This issue complies with the issue POLICY doc.
- [ X ] I have read the documentation at readthedocs and the issue is not addressed there.
- [ X ] I have tested that the issue is present in current master branch (aka latest git).
- [ X ] I have searched the issue tracker for a similar issue.
- [ X ] If there is a stack dump, I have decoded it.
- [ X ] I have filled out all fields below.
Platform
- Hardware: [ESP-12]
- Core Version: [2.6.3]
- Development Env: [Arduino IDE]
- Operating System: [MacOS]
Settings in IDE
- Module: [Generic ESP8266 Module]
- Flash Mode: [DOUT]
- Flash Size: [4MB/2MB]
- lwip Variant: [v2 Lower Memory]
- Reset Method: [ck]
- Flash Frequency: [40Mhz]
- CPU Frequency: [80Mhz]
- Upload Using: [SERIAL]
- Upload Speed: [115200]
Problem Description
The ESP runs setup, scans available wifi networks to indicate unused channels, and starts the own AP (code in attachement).
When it is connected by Android or IOS devices - all good, and the ping commands to the IP 192.168.4.1 have no errors.
However, if I connect to the AP using the MacBook Pro, OS X El Captain 10.11.6, The AP crashes continuously and module restarts.
MCVE Sketch
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <FS.h>
#include <ESP8266FtpServer.h>
char* password = "Lea111111";
char* myssid = "Snezhinka";
IPAddress local_ip(192,168,4,1);
IPAddress gateway(192,168,4,1);
IPAddress subnet(255,255,255,0);
ESP8266WebServer HTTP(80);
FtpServer ftpSrv;
bool firstRun = true;
bool serachingNetworks = false;
byte wifiChannels[] = {0,0,0,0,0,0,0,0,0,0,0};
int getMin(byte* temp, int size) {
int minIndex = 0;
int min = temp[minIndex];
for (int i=1; i<size; i++) {
if (temp[i] < min) {
min = temp[i];
minIndex = i;
}
}
return minIndex;
}
String get_networks() {
serachingNetworks = true;
byte networksCount = WiFi.scanNetworks();
String returnJson = "";
if (networksCount > 0) {
String str = "";
for (int i=0;i < 11;i++) {
wifiChannels[i] = 0;
}
for (int i=0; i<networksCount; i++) {
Serial.println(networksCount);
// we accept only up to 11 channels
if (WiFi.channel(i) <= 11) {
if (i != 0) {
returnJson += ",";
}
Serial.println("");
wifiChannels[WiFi.channel(i) - 1]++;
Serial.printf("%d: %s, Ch:%d (%ddBm) %s\n", i + 1, WiFi.SSID(i).c_str(), WiFi.channel(i), WiFi.RSSI(i), WiFi.encryptionType(i) == ENC_TYPE_NONE ? "open" : "");
Serial.println("");
returnJson = returnJson + "{\"ssid\":" + "\"" + WiFi.SSID(i).c_str() + "\",";
returnJson = returnJson + "\"chnl\":" + "\"" + WiFi.channel(i) + "\",";
returnJson = returnJson + "\"rssi\":" + "\"" + WiFi.RSSI(i) + "\"}";
}
}
for (int i=0;i < 11;i++) {
str = str + wifiChannels[i] + ",";
}
Serial.println(str);
File configFile = SPIFFS.open("/networksList.txt", "w");
configFile.print(str);
configFile.close();
}
returnJson = "[" + returnJson + "]";
serachingNetworks = false;
return returnJson;
}
void startAP() {
int selectedWifiChannel = 1;
String foundNetworks = get_networks();
if (foundNetworks != "[]") {
// selecting the channel
Serial.println("NOW THE FINAL ARRAY:::");
for (int i=0; i<11;i++) {
Serial.println(wifiChannels[i]);
}
Serial.println("END:::");
Serial.println(getMin(wifiChannels,11));
selectedWifiChannel = getMin(wifiChannels,11) + 1;
Serial.println("WE WILL SELECT THIS CHNL:" + String(selectedWifiChannel));
}
WiFi.softAPConfig(local_ip, gateway, subnet);
WiFi.softAP(myssid, password, selectedWifiChannel);
}
void setup() {
Serial.begin(115200);
bool success = SPIFFS.begin();
HTTP.begin();
ftpSrv.begin("relay","relay");
HTTP.onNotFound([](){
if(!handleFileRead(HTTP.uri()))
HTTP.send(404, "text/plain", "Not Found");
});
WiFi.setSleepMode(WIFI_NONE_SLEEP);
WiFi.mode(WIFI_AP_STA);
startAP();
Serial.println();
Serial.print("Server IP address: ");
Serial.println(WiFi.softAPIP());
Serial.print("Server MAC address: ");
Serial.println(WiFi.softAPmacAddress());
}
void loop() {
if (!serachingNetworks) {
if (WiFi.status() != WL_CONNECTED) {
WiFi.disconnect(true);
}
}
HTTP.handleClient();
ftpSrv.handleFTP();
}
bool handleFileRead(String path){
if(path.endsWith("/")) path += "index.html";
String contentType = getContentType(path);
if(SPIFFS.exists(path)){
File file = SPIFFS.open(path, "r");
size_t sent = HTTP.streamFile(file, contentType);
file.close();
return true;
}
return false;
}
String getContentType(String filename){
if (filename.endsWith(".html")) return "text/html";
else if (filename.endsWith(".css")) return "text/css";
else if (filename.endsWith(".js")) return "application/javascript";
else if (filename.endsWith(".png")) return "image/png";
else if (filename.endsWith(".jpg")) return "image/jpeg";
else if (filename.endsWith(".gif")) return "image/gif";
else if (filename.endsWith(".ico")) return "image/x-icon";
return "text/plain";
}
Debug Messages
"Exception (3): epc1=0x4000deea epc2=0x00000000 epc3=0x00000000 excvaddr=0x402479f8 depc=0x00000000"
Exception 3: LoadStoreError: Processor internal physical address or data error during load or store
PC: 0x4000deea
EXCVADDR: 0x402479f8
Decoding stack results
0x40238d60: handle_dhcp at glue-lwip/esp-dhcpserver.c line 626
0x40238d20: handle_dhcp at glue-lwip/esp-dhcpserver.c line 679
0x40100c25: check_poison_neighbors(unsigned short) at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/umm_malloc/umm_local.c line 71
0x40100ced: umm_malloc_core(size_t) at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/umm_malloc/umm_malloc.cpp line 422
0x4021cc08: udp_input at core/udp.c line 404
0x4023843c: pbuf_alloc at glue-esp/lwip-esp.c line 669
0x402217a4: ip4_input at core/ipv4/ip4.c line 1461
0x40100f0b: umm_free(void*) at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/umm_malloc/umm_malloc.cpp line 362
0x40218e51: ethernet_input_LWIP2 at netif/ethernet.c line 188
0x40218c74: esp2glue_ethernet_input at glue-lwip/lwip-git.c line 469
0x40238522: ethernet_input at glue-esp/lwip-esp.c line 365
0x40238533: ethernet_input at glue-esp/lwip-esp.c line 373
0x40100f8c: umm_poison_malloc(size_t) at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/umm_malloc/umm_poison.c line 158
0x40218ac2: new_linkoutput at glue-lwip/lwip-git.c line 260
0x40100c25: check_poison_neighbors(unsigned short) at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/umm_malloc/umm_local.c line 71
0x40100ced: umm_malloc_core(size_t) at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/umm_malloc/umm_malloc.cpp line 422
0x40100bd6: check_poison_neighbors(unsigned short) at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/umm_malloc/umm_local.c line 59
0x40100bd6: check_poison_neighbors(unsigned short) at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/umm_malloc/umm_local.c line 59
0x40100ced: umm_malloc_core(size_t) at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/umm_malloc/umm_malloc.cpp line 422
0x40100f58: umm_malloc(size_t) at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/umm_malloc/umm_malloc.cpp line 511
0x40100fcd: umm_poison_calloc(size_t, size_t) at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/umm_malloc/umm_poison.c line 176
0x40100154: ets_post(uint8, ETSSignal, ETSParam) at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/core_esp8266_main.cpp line 160
0x40212375: _printf_i at /home/earle/src/esp-quick-toolchain/repo/newlib/newlib/libc/stdio/nano-vfprintf_i.c line 194
0x40100bd6: check_poison_neighbors(unsigned short) at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/umm_malloc/umm_local.c line 59
0x40100ced: umm_malloc_core(size_t) at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/umm_malloc/umm_malloc.cpp line 422
0x40100154: ets_post(uint8, ETSSignal, ETSParam) at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/core_esp8266_main.cpp line 160
0x40100154: ets_post(uint8, ETSSignal, ETSParam) at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/core_esp8266_main.cpp line 160
0x40208ed1: run_scheduled_functions() at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/Schedule.cpp line 123
0x4020681d: __loop_end() at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/core_esp8266_main.cpp line 167
0x40206830: loop_wrapper() at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/core_esp8266_main.cpp line 172
0x402066e7: loop_task(ETSEvent*) at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/core_esp8266_main.cpp line 188
0x40206830: loop_wrapper() at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/core_esp8266_main.cpp line 172
0x40100154: ets_post(uint8, ETSSignal, ETSParam) at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/core_esp8266_main.cpp line 160
0x40100175: esp_schedule() at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/core_esp8266_main.cpp line 113
0x40206859: loop_wrapper() at /Users/michael/Library/Arduino15/packages/esp8266/hardware/esp8266/2.6.3/cores/esp8266/core_esp8266_main.cpp line 182