-->
Page 1 of 1

Esp8266 0.9 - Exception 9 when call return string funcion

PostPosted: Sat Dec 12, 2020 1:40 pm
by Difesagrande
Hello everyone and congratulations to the community.

I am a programming lover, when I have a little free time I enjoy using the esp8266 cards.
For some days I have been working on two esp8266 client server boards under wifi home, asynchronous webserver, with functions that return string of temperature, humidity and pressure.

What happen?
when I call the pressure function it goes into exception and the server is restarted, through serial the pressure is read without problems

the part of code :

String readTemp(){
return String(dht.readTemperature()); // funzione che ritorna stringa con valore della temperatura
}
String readUmid(){
return String(dht.readHumidity()); // funzione che ritorna stringa con valore dell'umidità
}
String readIndex(){
return String (dht.computeHeatIndex(dht.readTemperature(),dht.readHumidity(),false));
}
String readPress() {
sensors_event_t event;
bmp.getEvent(&event);
return String ( event.pressure );
}


and

server.on("/pressure", HTTP_GET, [](AsyncWebServerRequest *request){
request->send(200, "text/plain", readPress().c_str());
});
server.on("/temperature", HTTP_GET, [](AsyncWebServerRequest *request){
request->send_P(200, "text/plain",readTemp().c_str());
});
server.on("/humidity", HTTP_GET, [](AsyncWebServerRequest *request){
request->send_P(200, "text/plain",readUmid().c_str());
});
server.on("/index", HTTP_GET,[](AsyncWebServerRequest *request){
request->send_P(200,"text/plain",readIndex().c_str());
});

whit BMP (API v2)

when, via browser, I call the pressure function, this problem comes up

--------------- CUT HERE FOR EXCEPTION DECODER ---------------
19:16:57.255 ->
19:16:57.255 -> Exception (9):
19:16:57.255 -> epc1=0x401053f5 epc2=0x00000000 epc3=0x00000000 excvaddr=0xffffffff depc=0x00000000
19:16:57.397 ->
19:16:57.397 -> >>>stack>>>
19:16:57.397 ->
19:16:57.397 -> ctx: sys
19:16:57.397 -> sp: 3fffed70 end: 3fffffb0 offset: 0190
19:16:57.443 -> 3fffef00: 000000ca 00000000 3fff09d4 402147b4
19:16:57.489 -> 3fffef10: 4022f488 00000001 00000000 402347bd
19:16:57.537 -> 3fffef20: 4022fd9b 00000042 00000000 4022fd04
19:16:57.588 -> 3fffef30: 3ffeca08 4022f622 3fffdab0 00000000
19:16:57.635 -> 3fffef40: 3fffdcc0 3ffe9320 00000001 00000001
19:16:57.729 -> 3fffef50: 3ffe9320 40000f49 3fffdab0 40000f49
19:16:57.729 -> 3fffef60: 40000e19 00000005 0004d248 00000000
19:16:57.823 -> 3fffef70: 00000000 aa55aa55 000000c9 40104c9d
19:16:57.823 -> 3fffef80: 40104ca3 0004d248 00000000 3ffe8f6a
19:16:57.917 -> 3fffef90: 4010000d 3ffe8f66 3ffe8f64 3ffe8f62
19:16:57.963 -> 3fffefa0: 4022e654 3fffef3c 4022e60d 3fffff38
19:16:58.010 -> 3fffefb0: 3fffffc0 00000000 00000000 feefeffe
19:16:58.057 -> 3fffefc0: feefeffe feefeffe feefeffe feefeffe
19:16:58.104 -> 3fffefd0: feefeffe feefeffe feefeffe feefeffe
19:16:58.205 -> 3fffefe0: feefeffe feefeffe feefeffe feefeffe

output from exception decoder

Exception 9: LoadStoreAlignmentCause: Load or store to an unaligned address
PC: 0x401053f5
EXCVADDR: 0xffffffff

Decoding stack results
0x40100cfb: free(void*) at C:\Users\Pasquale\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266\umm_malloc\umm_malloc.cpp line 398
0x40214a85: ethernet_input_LWIP2 at netif/ethernet.c line 188