[GH-ISSUE #1173] memory failure #1001

Open
opened 2026-02-28 01:28:04 +03:00 by kerem · 11 comments
Owner

Originally created by @sebosfato on GitHub (Dec 15, 2020).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1173

Exception 3: LoadStoreError: Processor internal physical address or data error during load or store
PC: 0x40100a9c: umm_malloc_core(size_t) at C:\Users\Fabio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\umm_malloc\umm_malloc.cpp line 433
EXCVADDR: 0x40012121

Decoding stack results
0x4021de8a: String::changeBuffer(unsigned int) at C:\Users\Fabio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\WString.cpp line 182
0x40100c84: malloc(size_t) at C:\Users\Fabio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\umm_malloc\umm_malloc.cpp line 552
0x402213c1: uart_write(uart_t*, char const*, size_t) at C:\Users\Fabio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\uart.cpp line 509
0x401005a0: pvPortMalloc(size_t, char const*, int) at C:\Users\Fabio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\heap.cpp line 271
0x4021c644: HardwareSerial::write(unsigned char) at C:\Users\Fabio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/HardwareSerial.h line 161
0x4021c650: HardwareSerial::write(unsigned char const*, unsigned int) at C:\Users\Fabio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/HardwareSerial.h line 162
0x4020bdc9: ESP8266WiFiGenericClass::mode(WiFiMode, WiFiState*) at C:\Users\Fabio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266WiFi\src\ESP8266WiFiGeneric.cpp line 441
0x4021ccb0: Print::println() at C:\Users\Fabio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\Print.cpp line 184
0x4020c2c4: ESP8266WiFiGenericClass::mode(WiFiMode, WiFiState*) at C:\Users\Fabio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266WiFi\src\ESP8266WiFiGeneric.cpp line 415
0x40205a3c: setup() at C:\Users\Fabio\Documents\Arduino\GardenToy\pro4s/pro4s.ino line 487
0x4021f468: loop_wrapper() at C:\Users\Fabio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\core_esp8266_main.cpp line 192

Basic Infos

Hardware

WiFimanager Branch/Release:

  • Master
  • ESP8266
    Hardware: ESP-12e, esp01, esp25
  • ESP12 E/F/S (nodemcu, wemos, feather)
    ESP Core Version: 2.4.0, staging
    [ ] 2.4.0

Description

after some time on if reboot unexpectedly it will ran into a sequence of autoreboot... printing the above stack trace...
the last lines say is a problem in setup were i declared WiFi.mode(WIFI_STA); line 487 the other indication i dont understand much but i think is related to the wifi manager because if i reset the module with a button i set, it will erase the wifimanager credentials and the module run again but only in ap mode... if i set the password again it keeps reboting and giving this stack

so i think is a memory related issue and is conflicting with the wifimanager...

im using rtavars
spiffs
eppron

is this a known issue?

Settings in IDE

Module: NodeMcu, Wemos D1

Additional libraries:

#include <FS.h>
#include <ESP8266WiFi.h> // ja tem no wifi manager
#include <WiFiClient.h> // ja tem na libraria abaixo http client
#include <ESP8266HTTPClient.h> // httprequest possui arduino.h
#include <ESP8266httpUpdate.h>
#include <ESP_EEPROM.h>
#include <WiFiUdp.h> //ota
#include <WiFiManager.h> // contem esp8266webserver e esp8266WiFi.h
#include <ESP8266mDNS.h>
#include <ESP8266WebServer.h>
#include <DNSServer.h>// wifi manager
#include <NTPClient.h>
#include <TaskScheduler.h>
#include <RTCVars.h>
RTCVars state;
WiFiClient client;

#define TRIGGER_PIN D3
const char* host = "GardenToy";
WiFiManager wm;
IPAddress apIP(172, 217, 28, 1);
//IPAddress apIP(192, 168, 4, 1);// nao funciona o captive pq ip loca\l
IPAddress netMsk(255, 255, 255, 0);
DNSServer dnsServer;
void RESTART() {
wait = millis();
}
void t1Callback();
void t2Callback();
void t3Callback();
void t4Callback();
Task t1(65000, TASK_FOREVER, &t1Callback);
Task t2(200, TASK_FOREVER, &t2Callback); // original 150
Task t3(100000, TASK_FOREVER, &t3Callback);
Task t4(1000, TASK_FOREVER, &t4Callback);
Scheduler runner;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
IPAddress iplocal;
void setup(void) {

pinMode(LED, OUTPUT); //
pinMode(rele1, OUTPUT); //
pinMode(rele2, OUTPUT); //
pinMode(rele3, OUTPUT); //
pinMode(rele4, OUTPUT); //
pinMode(TRIGGER_PIN, INPUT_PULLUP); //
pinMode(sensorPin, INPUT);
digitalWrite(LED, HIGH);
digitalWrite(rele1, HIGH);
digitalWrite(rele2, HIGH);
digitalWrite(rele3, HIGH);
digitalWrite(rele4, HIGH);
Serial.begin(115200); //if serial is used led is not available
Serial.println(" ");
delay(1000);
if (digitalRead(TRIGGER_PIN) == LOW ) {
WIFIRESET();
}
EEPROM.begin(202);
EEPROM.get(50, memoria);

if (memoria == false) {
EEPROM.put(50, memoria); // long - so 8 bytes (next address would be '12')
boolean ok11 = EEPROM.commit();
//Serial.println((ok11) ? "/memoria false commit OK" : "Commit memoria failed");
dat = 99;
tempdesj = 30;
vezes = 12;
seconds = 0;
minutes = 0;
hour = 0;
tempdesj2 = 30;
vezes2 = 12;
prg1 = 1;
prg2 = 1;
horin1 = 6;
horin2 = 7;
horter1 = 18;
horter2 = 19;
funsta1 = 0;
funsta2 = 0;
bbtout = tempdesj;
bbtout2 = tempdesj2;
minin1 = 0;
minin2 = 0;
minter1 = 0;
minter2 = 0;
tempdesj3 = 30;
vezes3 = 12;
tempdesj4 = 30;
vezes4 = 12;
prg3 = 1;
prg4 = 1;
horin3 = 6;
horin4 = 7;
horter3 = 18;
horter4 = 19;
funsta3 = 0;
funsta4 = 0;
bbtout3 = tempdesj3;
bbtout4 = tempdesj4;
minin3 = 0;
minin4 = 0;
minter3 = 0;
minter4 = 0;
EEPROM.get(198, versao);
EEPROM.get(170, userid);
Serial.print("versao instalada memoria nao salva ");
Serial.println(versao);
vercomp=versao;
if ((vercomp >1) && (vercomp <5 ))// EEPROM.get(198, versao);
EEPROM.get(174, hourofday);
}else {

if (memoria == true) {
EEPROM.get(0, tempdesj);
EEPROM.get(4, vezes);
EEPROM.get(8, noite1);
EEPROM.get(12, dat);
EEPROM.get(16, datmes);
EEPROM.get(20, datano);
EEPROM.get(24, hour);
EEPROM.get(32, minutes);
EEPROM.get(40, tempdesj2);
EEPROM.get(44, vezes2);
EEPROM.get(52, prg1);
EEPROM.get(56, prg2);
EEPROM.get(60, horin1);
EEPROM.get(64, horin2);
EEPROM.get(68, horter1);
EEPROM.get(72, horter2);
EEPROM.get(76, funsta1);
EEPROM.get(80, funsta2);
EEPROM.get(84, minin1);
EEPROM.get(88, minin2);
EEPROM.get(92, minter1);
EEPROM.get(96, minter2);
EEPROM.get(100, noite2);
EEPROM.get(102, prg3);
EEPROM.get(106, prg4);
EEPROM.get(110, horin3);
EEPROM.get(114, horin4);
EEPROM.get(118, horter3);
EEPROM.get(122, horter4);
EEPROM.get(126, funsta3);
EEPROM.get(130, funsta4);
EEPROM.get(134, minin3);
EEPROM.get(138, minin4);
EEPROM.get(142, minter3);
EEPROM.get(146, minter4);
EEPROM.get(150, noite4);
EEPROM.get(152, noite3);
EEPROM.get(154, tempdesj4);
EEPROM.get(158, vezes4);
EEPROM.get(162, tempdesj3);
EEPROM.get(166, vezes3);
EEPROM.get(170, userid);
EEPROM.get(174, hourofday);
EEPROM.get(178, day);
EEPROM.get(182, nivelre);
EEPROM.get(186, sensormin);
EEPROM.get(190, sensormax);
EEPROM.get(198, versao);
}
}

if (versao < 1) {
versao=1;

//if ((versaoupdate > versao)){
//se a versao update no sketch novo que subiu for maior que a versao salva

//deixe zero no sketch original e vai subindo conforme as versoes..
//versao = versaofs;
//versao update igual versaofs 11 o numero que chama o proximo update
EEPROM.put(102, versao);
EEPROM.commit();
}

state.registerVar( &minutes ); // we send a pointer to each of our variables
state.registerVar( &hourofday );
state.registerVar( &countdown );
state.registerVar( &countdown2 );
state.registerVar( &countdown3 );
state.registerVar( &countdown4 );
state.registerVar( &irrigou1 );
state.registerVar( &irrigou2 );
state.registerVar( &irrigou3 );
state.registerVar( &irrigou4 );
state.registerVar( &religou );

if (state.loadFromRTC()) { // we load the values from rtc memory back into the registered variables
// reset_counter++;
Serial.println("This is reset no. " + (String)religou);
state.saveToRTC(); // since we changed a state relevant variable, we store the new values
} else {
//reset_counter = 0; // cold boot part
Serial.println("This seems to be a cold boot. We don't have a valid state on RTC memory");
//program_step = 0;
}

religou++;

variavel="reiniciou";
valor=religou;
AddtoString();

variavel="modelo";
valor=modelo;
AddtoString();

variavel="versao";
valor=versao;
AddtoString();

WiFi.hostname(hostnamed);

Serial.println("mac address "+WiFi.macAddress());
String macaddress=WiFi.macAddress();
macaddress.replace(":","");
// Serial.println("user id from hell "+macaddress);

userid= macaddress;
Serial.println(userid);
// WiFi.mode(WIFI_STA); // problem line 487
//WiFi.mode(WIFI_AP_STA);
//Serial.setDebugOutput(false);

WiFi.softAPConfig(apIP, apIP, netMsk); // subnet FF FF FF 00

if (wm.getWiFiIsSaved()==1){

 Serial.println("I have a saved network");

wm.setTimeout(180);
wm.setConfigPortalBlocking(false);
wm.autoConnect();
delay(500);

}

WiFi.softAPConfig(apIP, apIP, netMsk);

delay(500);
WiFi.softAP(ssid);

//IPAddress myIP = WiFi.softAPIP();
//Serial.print("AP IP address: ");
//Serial.println(apIP);
//Serial.print("local IP address: ");
//Serial.println(WiFi.localIP());
delay(500);
iplocal = WiFi.localIP();

//if (iplocal == "(IP unset)")iplocal="";

//dns was here
dnsServer.setErrorReplyCode(DNSReplyCode::NoError);
dnsServer.start(DNS_PORT, "", apIP);
/
Setup web pages: root, wifi config pages, SO captive portal detectors and not found. */
// server.on("/", handleRoot);
// server.on("/wifi", handleWifi);
//server.on("/wifisave", handleWifiSave);
server.on("/generate_204", handleRoot);
// servidor.on("/generate_204", handleRooter);//Android captive portal. Maybe not needed. Might be handled by notFound handler.
server.on("/fwlink", handleRoot); //Microsoft captive portal. Maybe not needed. Might be handled by notFound handler.
server.onNotFound(handleNotFound);
server.begin();
delay(500);
SPIFFS.begin();
{
Dir dir = SPIFFS.openDir("/");
while (dir.next()) {
String fileName = dir.fileName();
size_t fileSize = dir.fileSize(); // ////Serial.printf("FS File: %s, size: %s\n", fileName.c_str(), formatBytes(fileSize).c_str());
} //Serial.printf("\n");
}
delay(500);
MDNS.begin(host);

Originally created by @sebosfato on GitHub (Dec 15, 2020). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1173 Exception 3: LoadStoreError: Processor internal physical address or data error during load or store PC: 0x40100a9c: umm_malloc_core(size_t) at C:\Users\Fabio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\umm_malloc\umm_malloc.cpp line 433 EXCVADDR: 0x40012121 Decoding stack results 0x4021de8a: String::changeBuffer(unsigned int) at C:\Users\Fabio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\WString.cpp line 182 0x40100c84: malloc(size_t) at C:\Users\Fabio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\umm_malloc\umm_malloc.cpp line 552 0x402213c1: uart_write(uart_t*, char const*, size_t) at C:\Users\Fabio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\uart.cpp line 509 0x401005a0: pvPortMalloc(size_t, char const*, int) at C:\Users\Fabio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\heap.cpp line 271 0x4021c644: HardwareSerial::write(unsigned char) at C:\Users\Fabio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/HardwareSerial.h line 161 0x4021c650: HardwareSerial::write(unsigned char const*, unsigned int) at C:\Users\Fabio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/HardwareSerial.h line 162 0x4020bdc9: ESP8266WiFiGenericClass::mode(WiFiMode, WiFiState*) at C:\Users\Fabio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266WiFi\src\ESP8266WiFiGeneric.cpp line 441 0x4021ccb0: Print::println() at C:\Users\Fabio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\Print.cpp line 184 0x4020c2c4: ESP8266WiFiGenericClass::mode(WiFiMode, WiFiState*) at C:\Users\Fabio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\ESP8266WiFi\src\ESP8266WiFiGeneric.cpp line 415 0x40205a3c: setup() at C:\Users\Fabio\Documents\Arduino\GardenToy\pro4s/pro4s.ino line 487 0x4021f468: loop_wrapper() at C:\Users\Fabio\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\core_esp8266_main.cpp line 192 ### Basic Infos #### Hardware **WiFimanager Branch/Release:** - [ ] Master - [ ] ESP8266 **Hardware: ESP-12e, esp01, esp25** - [ ] ESP12 E/F/S (nodemcu, wemos, feather) **ESP Core Version: 2.4.0, staging** [ ] 2.4.0 ### Description after some time on if reboot unexpectedly it will ran into a sequence of autoreboot... printing the above stack trace... the last lines say is a problem in setup were i declared WiFi.mode(WIFI_STA); line 487 the other indication i dont understand much but i think is related to the wifi manager because if i reset the module with a button i set, it will erase the wifimanager credentials and the module run again but only in ap mode... if i set the password again it keeps reboting and giving this stack so i think is a memory related issue and is conflicting with the wifimanager... im using rtavars spiffs eppron is this a known issue? ### Settings in IDE Module: NodeMcu, Wemos D1 Additional libraries: #include <FS.h> #include <ESP8266WiFi.h> // ja tem no wifi manager #include <WiFiClient.h> // ja tem na libraria abaixo http client #include <ESP8266HTTPClient.h> // httprequest possui arduino.h <memory> #include <ESP8266httpUpdate.h> #include <ESP_EEPROM.h> #include <WiFiUdp.h> //ota #include <WiFiManager.h> // contem esp8266webserver e esp8266WiFi.h #include <ESP8266mDNS.h> #include <ESP8266WebServer.h> #include <DNSServer.h>// wifi manager #include <NTPClient.h> #include <TaskScheduler.h> #include <RTCVars.h> RTCVars state; WiFiClient client; #define TRIGGER_PIN D3 const char* host = "GardenToy"; WiFiManager wm; IPAddress apIP(172, 217, 28, 1); //IPAddress apIP(192, 168, 4, 1);// nao funciona o captive pq ip loca\l IPAddress netMsk(255, 255, 255, 0); DNSServer dnsServer; void RESTART() { wait = millis(); } void t1Callback(); void t2Callback(); void t3Callback(); void t4Callback(); Task t1(65000, TASK_FOREVER, &t1Callback); Task t2(200, TASK_FOREVER, &t2Callback); // original 150 Task t3(100000, TASK_FOREVER, &t3Callback); Task t4(1000, TASK_FOREVER, &t4Callback); Scheduler runner; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// IPAddress iplocal; void setup(void) { pinMode(LED, OUTPUT); // pinMode(rele1, OUTPUT); // pinMode(rele2, OUTPUT); // pinMode(rele3, OUTPUT); // pinMode(rele4, OUTPUT); // pinMode(TRIGGER_PIN, INPUT_PULLUP); // pinMode(sensorPin, INPUT); digitalWrite(LED, HIGH); digitalWrite(rele1, HIGH); digitalWrite(rele2, HIGH); digitalWrite(rele3, HIGH); digitalWrite(rele4, HIGH); Serial.begin(115200); //if serial is used led is not available Serial.println(" "); delay(1000); if (digitalRead(TRIGGER_PIN) == LOW ) { WIFIRESET(); } EEPROM.begin(202); EEPROM.get(50, memoria); if (memoria == false) { EEPROM.put(50, memoria); // long - so 8 bytes (next address would be '12') boolean ok11 = EEPROM.commit(); //Serial.println((ok11) ? "/memoria false commit OK" : "Commit memoria failed"); dat = 99; tempdesj = 30; vezes = 12; seconds = 0; minutes = 0; hour = 0; tempdesj2 = 30; vezes2 = 12; prg1 = 1; prg2 = 1; horin1 = 6; horin2 = 7; horter1 = 18; horter2 = 19; funsta1 = 0; funsta2 = 0; bbtout = tempdesj; bbtout2 = tempdesj2; minin1 = 0; minin2 = 0; minter1 = 0; minter2 = 0; tempdesj3 = 30; vezes3 = 12; tempdesj4 = 30; vezes4 = 12; prg3 = 1; prg4 = 1; horin3 = 6; horin4 = 7; horter3 = 18; horter4 = 19; funsta3 = 0; funsta4 = 0; bbtout3 = tempdesj3; bbtout4 = tempdesj4; minin3 = 0; minin4 = 0; minter3 = 0; minter4 = 0; EEPROM.get(198, versao); EEPROM.get(170, userid); Serial.print("versao instalada memoria nao salva "); Serial.println(versao); vercomp=versao; if ((vercomp >1) && (vercomp <5 ))// EEPROM.get(198, versao); EEPROM.get(174, hourofday); }else { if (memoria == true) { EEPROM.get(0, tempdesj); EEPROM.get(4, vezes); EEPROM.get(8, noite1); EEPROM.get(12, dat); EEPROM.get(16, datmes); EEPROM.get(20, datano); EEPROM.get(24, hour); EEPROM.get(32, minutes); EEPROM.get(40, tempdesj2); EEPROM.get(44, vezes2); EEPROM.get(52, prg1); EEPROM.get(56, prg2); EEPROM.get(60, horin1); EEPROM.get(64, horin2); EEPROM.get(68, horter1); EEPROM.get(72, horter2); EEPROM.get(76, funsta1); EEPROM.get(80, funsta2); EEPROM.get(84, minin1); EEPROM.get(88, minin2); EEPROM.get(92, minter1); EEPROM.get(96, minter2); EEPROM.get(100, noite2); EEPROM.get(102, prg3); EEPROM.get(106, prg4); EEPROM.get(110, horin3); EEPROM.get(114, horin4); EEPROM.get(118, horter3); EEPROM.get(122, horter4); EEPROM.get(126, funsta3); EEPROM.get(130, funsta4); EEPROM.get(134, minin3); EEPROM.get(138, minin4); EEPROM.get(142, minter3); EEPROM.get(146, minter4); EEPROM.get(150, noite4); EEPROM.get(152, noite3); EEPROM.get(154, tempdesj4); EEPROM.get(158, vezes4); EEPROM.get(162, tempdesj3); EEPROM.get(166, vezes3); EEPROM.get(170, userid); EEPROM.get(174, hourofday); EEPROM.get(178, day); EEPROM.get(182, nivelre); EEPROM.get(186, sensormin); EEPROM.get(190, sensormax); EEPROM.get(198, versao); } } if (versao < 1) { versao=1; //if ((versaoupdate > versao)){ //se a versao update no sketch novo que subiu for maior que a versao salva //deixe zero no sketch original e vai subindo conforme as versoes.. //versao = versaofs; //versao update igual versaofs 11 o numero que chama o proximo update EEPROM.put(102, versao); EEPROM.commit(); } state.registerVar( &minutes ); // we send a pointer to each of our variables state.registerVar( &hourofday ); state.registerVar( &countdown ); state.registerVar( &countdown2 ); state.registerVar( &countdown3 ); state.registerVar( &countdown4 ); state.registerVar( &irrigou1 ); state.registerVar( &irrigou2 ); state.registerVar( &irrigou3 ); state.registerVar( &irrigou4 ); state.registerVar( &religou ); if (state.loadFromRTC()) { // we load the values from rtc memory back into the registered variables // reset_counter++; Serial.println("This is reset no. " + (String)religou); state.saveToRTC(); // since we changed a state relevant variable, we store the new values } else { //reset_counter = 0; // cold boot part Serial.println("This seems to be a cold boot. We don't have a valid state on RTC memory"); //program_step = 0; } religou++; variavel="reiniciou"; valor=religou; AddtoString(); variavel="modelo"; valor=modelo; AddtoString(); variavel="versao"; valor=versao; AddtoString(); WiFi.hostname(hostnamed); Serial.println("mac address "+WiFi.macAddress()); String macaddress=WiFi.macAddress(); macaddress.replace(":",""); // Serial.println("user id from hell "+macaddress); userid= macaddress; Serial.println(userid); // WiFi.mode(WIFI_STA); // problem line 487 //WiFi.mode(WIFI_AP_STA); //Serial.setDebugOutput(false); WiFi.softAPConfig(apIP, apIP, netMsk); // subnet FF FF FF 00 if (wm.getWiFiIsSaved()==1){ Serial.println("I have a saved network"); wm.setTimeout(180); wm.setConfigPortalBlocking(false); wm.autoConnect(); delay(500); } WiFi.softAPConfig(apIP, apIP, netMsk); delay(500); WiFi.softAP(ssid); //IPAddress myIP = WiFi.softAPIP(); //Serial.print("AP IP address: "); //Serial.println(apIP); //Serial.print("local IP address: "); //Serial.println(WiFi.localIP()); delay(500); iplocal = WiFi.localIP(); //if (iplocal == "(IP unset)")iplocal=""; //dns was here dnsServer.setErrorReplyCode(DNSReplyCode::NoError); dnsServer.start(DNS_PORT, "*", apIP); /* Setup web pages: root, wifi config pages, SO captive portal detectors and not found. */ // server.on("/", handleRoot); // server.on("/wifi", handleWifi); //server.on("/wifisave", handleWifiSave); server.on("/generate_204", handleRoot); // servidor.on("/generate_204", handleRooter);//Android captive portal. Maybe not needed. Might be handled by notFound handler. server.on("/fwlink", handleRoot); //Microsoft captive portal. Maybe not needed. Might be handled by notFound handler. server.onNotFound(handleNotFound); server.begin(); delay(500); SPIFFS.begin(); { Dir dir = SPIFFS.openDir("/"); while (dir.next()) { String fileName = dir.fileName(); size_t fileSize = dir.fileSize(); // ////Serial.printf("FS File: %s, size: %s\n", fileName.c_str(), formatBytes(fileSize).c_str()); } //Serial.printf("\n"); } delay(500); MDNS.begin(host);
Author
Owner

@sebosfato commented on GitHub (Dec 15, 2020):

relevant lines on unmm maloc ccp line 433
while( cf ) {
blockSize = (UMM_NBLOCK(cf) & UMM_BLOCKNO_MASK) - cf;

DBGLOG_TRACE( "Looking at block %6d size %6d\n", cf, blockSize );

line 552

/* Allocate the memory withing a protected critical section */

UMM_CRITICAL_ENTRY(id_malloc);

ptr = umm_malloc_core( size );

UMM_CRITICAL_EXIT(id_malloc);

return( ptr );
}

wstring line 182
uint16_t oldLen = len();
char *newbuffer = (char *) realloc(isSSO() ? nullptr : wbuffer(), newSize);
if (newbuffer) {
size_t oldSize = capacity() + 1; // include NULL.
if (isSSO()) {
// Copy the SSO buffer into allocated space
memmove_P(newbuffer, sso.buff, sizeof(sso.buff));
}
if (newSize > oldSize)
{
memset(newbuffer + oldSize, 0, newSize - oldSize);
}
setSSO(false);
setCapacity(newSize - 1);
setLen(oldLen); // Needed in case of SSO where len() never existed
setBuffer(newbuffer);
return 1;
}
return 0;
}

theres many lines... but seem to be something in the memory and wifi or hardware serial..

the problem is keep happening since some weeks ago... never had it before...

<!-- gh-comment-id:745081841 --> @sebosfato commented on GitHub (Dec 15, 2020): relevant lines on unmm maloc ccp line 433 while( cf ) { blockSize = (UMM_NBLOCK(cf) & UMM_BLOCKNO_MASK) - cf; DBGLOG_TRACE( "Looking at block %6d size %6d\n", cf, blockSize ); line 552 /* Allocate the memory withing a protected critical section */ UMM_CRITICAL_ENTRY(id_malloc); ptr = umm_malloc_core( size ); UMM_CRITICAL_EXIT(id_malloc); return( ptr ); } wstring line 182 uint16_t oldLen = len(); char *newbuffer = (char *) realloc(isSSO() ? nullptr : wbuffer(), newSize); if (newbuffer) { size_t oldSize = capacity() + 1; // include NULL. if (isSSO()) { // Copy the SSO buffer into allocated space memmove_P(newbuffer, sso.buff, sizeof(sso.buff)); } if (newSize > oldSize) { memset(newbuffer + oldSize, 0, newSize - oldSize); } setSSO(false); setCapacity(newSize - 1); setLen(oldLen); // Needed in case of SSO where len() never existed setBuffer(newbuffer); return 1; } return 0; } theres many lines... but seem to be something in the memory and wifi or hardware serial.. the problem is keep happening since some weeks ago... never had it before...
Author
Owner

@sebosfato commented on GitHub (Dec 15, 2020):

i noticed that when i connect my phone uncharged to the usb of the computer it kind of bugs the usb and the problem is reproduced again...

so if i reset it fisicaly the wifimanager setings it work but when i set the password it keeps reboting over and over with that trace

<!-- gh-comment-id:745082626 --> @sebosfato commented on GitHub (Dec 15, 2020): i noticed that when i connect my phone uncharged to the usb of the computer it kind of bugs the usb and the problem is reproduced again... so if i reset it fisicaly the wifimanager setings it work but when i set the password it keeps reboting over and over with that trace
Author
Owner

@sebosfato commented on GitHub (Dec 15, 2020):

i tried to raise the eppron size to 210 was 202 and took that wifi sta mode out to see if the problem happen again

the last saved value is on position 198 is a string of the version

any ideas please?

something that was not used before in this project when there was not problems is

wificlient
rtcvars

i even thought the problem was related to updates but it seems last time i didnt updated and it happened again...

<!-- gh-comment-id:745086960 --> @sebosfato commented on GitHub (Dec 15, 2020): i tried to raise the eppron size to 210 was 202 and took that wifi sta mode out to see if the problem happen again the last saved value is on position 198 is a string of the version any ideas please? something that was not used before in this project when there was not problems is wificlient rtcvars i even thought the problem was related to updates but it seems last time i didnt updated and it happened again...
Author
Owner

@sebosfato commented on GitHub (Dec 15, 2020):

i found a small error the version that is a float was being recorded on every start to 102 of epprom that was reserved for an int
could it be the error?

<!-- gh-comment-id:745103327 --> @sebosfato commented on GitHub (Dec 15, 2020): i found a small error the version that is a float was being recorded on every start to 102 of epprom that was reserved for an int could it be the error?
Author
Owner

@sebosfato commented on GitHub (Dec 16, 2020):

more info about it... i replicated the error today... just disconected from usb and connected again... now its giving a watchdog reset
after this print of i have a saved network.. i get the parameters from the wifimanager seems to get stuck there

if (wm.getWiFiIsSaved()==1){

Serial.println("I have a saved network");
wm.setTimeout(180);
wm.setConfigPortalBlocking(false);
wm.autoConnect();
delay(500);
}

mac address xxxxxxx
04:35:15.194 -> xxxxxxx
04:35:15.194 -> I have a saved network
04:35:22.191 ->
04:35:22.191 -> ets Jan 8 2013,rst cause:4, boot mode:(3,7)
04:35:22.191 ->
04:35:22.191 -> wdt reset
04:35:22.191 -> load 0x4010f000, len 3584, room 16
04:35:22.191 -> tail 0
04:35:22.191 -> chksum 0xb0
04:35:22.191 -> csum 0xb0
04:35:22.225 -> v2843a5ac
04:35:22.225 -> ~ld

same behavior as before except is not giving a trace anymore.. perhaps that trace record was from the error in the epprom

trying to overwrite the sketck didnt worked... only if i write the whole flash again... however to try to catch the error i tried updating the sketch only but turning on debug and the error stoped...

than i turn off debug and it worked still.. (perhaps this worked only because choosing debug change the size of the sketch and it writes over like if was writing the whole flash.) not sure

trying to figure what is happening.. i cant send this to anyone since it crashs in few days

one thing i noticed is that before trying to use debug for first time in arduino ide i never had this error before...not sure how its related...

<!-- gh-comment-id:745799089 --> @sebosfato commented on GitHub (Dec 16, 2020): more info about it... i replicated the error today... just disconected from usb and connected again... now its giving a watchdog reset after this print of i have a saved network.. i get the parameters from the wifimanager seems to get stuck there if (wm.getWiFiIsSaved()==1){ Serial.println("I have a saved network"); wm.setTimeout(180); wm.setConfigPortalBlocking(false); wm.autoConnect(); delay(500); } mac address xxxxxxx 04:35:15.194 -> xxxxxxx 04:35:15.194 -> I have a saved network 04:35:22.191 -> 04:35:22.191 -> ets Jan 8 2013,rst cause:4, boot mode:(3,7) 04:35:22.191 -> 04:35:22.191 -> wdt reset 04:35:22.191 -> load 0x4010f000, len 3584, room 16 04:35:22.191 -> tail 0 04:35:22.191 -> chksum 0xb0 04:35:22.191 -> csum 0xb0 04:35:22.225 -> v2843a5ac 04:35:22.225 -> ~ld same behavior as before except is not giving a trace anymore.. perhaps that trace record was from the error in the epprom trying to overwrite the sketck didnt worked... only if i write the whole flash again... however to try to catch the error i tried updating the sketch only but turning on debug and the error stoped... than i turn off debug and it worked still.. (perhaps this worked only because choosing debug change the size of the sketch and it writes over like if was writing the whole flash.) not sure trying to figure what is happening.. i cant send this to anyone since it crashs in few days one thing i noticed is that before trying to use debug for first time in arduino ide i never had this error before...not sure how its related...
Author
Owner

@tablatronix commented on GitHub (Dec 18, 2020):

REASON_SOFT_RESTART, means you are doing something in your code to restart
you have a while loop with no delay? or are calling esp.restart()

<!-- gh-comment-id:748185769 --> @tablatronix commented on GitHub (Dec 18, 2020): REASON_SOFT_RESTART, means you are doing something in your code to restart you have a while loop with no delay? or are calling esp.restart()
Author
Owner

@sebosfato commented on GitHub (Dec 18, 2020):

actualy i dont have any while loop.... and was not calling restart.. thats why i thought maybe could be the wifimanager lib since the prints stoped there... i was diging in the net and found somewhere that wificlient should be declared localy instead of globaly i changed this and i also catch an error of my code where i was trying to save a string to eeprom and i think this could be also the cause of the strange results... the last time it happen i could put just the sketch over it and it became alive again so the actuall credentials was not the problem... perhaps trying to save a string to eeprom was ruining it.. or the wificlient.. i call it many times in diferent functions... im trying to replicate the error after last changes...

another thing is i took away the first declaration of ap ip mask etc... i tried to look all the exception was giving me
i never had such problems with memory before

<!-- gh-comment-id:748201295 --> @sebosfato commented on GitHub (Dec 18, 2020): actualy i dont have any while loop.... and was not calling restart.. thats why i thought maybe could be the wifimanager lib since the prints stoped there... i was diging in the net and found somewhere that wificlient should be declared localy instead of globaly i changed this and i also catch an error of my code where i was trying to save a string to eeprom and i think this could be also the cause of the strange results... the last time it happen i could put just the sketch over it and it became alive again so the actuall credentials was not the problem... perhaps trying to save a string to eeprom was ruining it.. or the wificlient.. i call it many times in diferent functions... im trying to replicate the error after last changes... another thing is i took away the first declaration of ap ip mask etc... i tried to look all the exception was giving me i never had such problems with memory before
Author
Owner

@sebosfato commented on GitHub (Dec 18, 2020):

i will be trying the whole week to replicate the error.. basically take it out of usb and plug again if blinks problem if not .. for more than 2 days on probably the problem is solved .. lets hope so...

i was trying to save the mac adress but i realised i didnt needed to

EEPROM only gets floats ints bool etc so far as i know how to implement and is all that is needed most of the times

<!-- gh-comment-id:748203035 --> @sebosfato commented on GitHub (Dec 18, 2020): i will be trying the whole week to replicate the error.. basically take it out of usb and plug again if blinks problem if not .. for more than 2 days on probably the problem is solved .. lets hope so... i was trying to save the mac adress but i realised i didnt needed to EEPROM only gets floats ints bool etc so far as i know how to implement and is all that is needed most of the times
Author
Owner

@tablatronix commented on GitHub (Dec 18, 2020):

you will want to enable the esp debug from more detail

<!-- gh-comment-id:748243022 --> @tablatronix commented on GitHub (Dec 18, 2020): you will want to enable the esp debug from more detail
Author
Owner

@tablatronix commented on GitHub (Dec 18, 2020):

You have to much code to debug also while (dir.next()) { this is a loop ?

<!-- gh-comment-id:748244552 --> @tablatronix commented on GitHub (Dec 18, 2020): You have to much code to debug also `while (dir.next()) {` this is a loop ?
Author
Owner

@sebosfato commented on GitHub (Dec 19, 2020):

You have to much code to debug also while (dir.next()) { this is a loop ?

im not sure if this is usefull for the program it was from the fsbrowser example.... just left untouched ...

i will try to debug more... but i think it was the eeprom the problem or the wificlient declaration being global... so far i could not replicate the error since i changes this two things

<!-- gh-comment-id:748492583 --> @sebosfato commented on GitHub (Dec 19, 2020): > You have to much code to debug also `while (dir.next()) {` this is a loop ? im not sure if this is usefull for the program it was from the fsbrowser example.... just left untouched ... i will try to debug more... but i think it was the eeprom the problem or the wificlient declaration being global... so far i could not replicate the error since i changes this two things
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#1001
No description provided.