ESP32F crashes with Wifi Library + Websocket

Findus LeChat
Posts: 1
Joined: Mon Apr 13, 2020 6:33 pm

ESP32F crashes with Wifi Library + Websocket

Postby Findus LeChat » Mon Apr 13, 2020 8:25 pm

Dear community,
I am fighting crashes on my IoT devices without being able to solve the problem.
The devices are connecting to Wifi and send and receive Websockets request that are Json-Encoded.
I use the following libraries:
-ArduinoWebsockets
-ArduinoJSON
Coding in Arduino IDE with ESP8266 tools installed (Version 2.6.3)
The debug logs (decoded with the Arduino plugin) give the below output:
I am not sure how to locate the error and how to read these stack results. Is it the last executed commands in backwards order?
Thank you very much for your help!
  1. Exception 29: StoreProhibited: A store referenced a page mapped with an attribute that does not permit stores
  2. PC: 0x4000e1b2
  3. EXCVADDR: 0x00000000
  4.  
  5. Decoding stack results
  6. 0x40222678: mem_malloc at core/mem.c line 210
  7. 0x40218a85: do_memp_malloc_pool at core/memp.c line 255
  8. 0x40218ac4: memp_malloc at core/memp.c line 356
  9. 0x4021a2d9: sys_timeout_abs at core/timeouts.c line 189
  10. 0x4021a4dc: sys_check_timeouts at core/timeouts.c line 390
  11. 0x4020cda7: loop_task(ETSEvent*) at esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_main.cpp line 188
  12. 0x401003e0: ets_post(uint8, ETSSignal, ETSParam) at esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_main.cpp line 160
  13. 0x4020b744: Print::print(__FlashStringHelper const*) at esp8266\hardware\esp8266\2.6.3\cores\esp8266/Print.h line 63
  14. 0x4021838d: glue2esp_linkoutput at glue-esp/lwip-esp.c line 301
  15. 0x402110d0: WebSocketsClient::runCbEvent(WStype_t, unsigned char*, unsigned int) at X:\Nextcloud\Uncrypted\Programmation\Arduino\libraries\WebSockets\src/WebSocketsClient.h line 139
  16. 0x40209eb0: WebSocketsClient::messageReceived(WSclient_t*, WSopcode_t, unsigned char*, unsigned int, bool) at X:\Nextcloud\Uncrypted\Programmation\Arduino\libraries\WebSockets\src\WebSocketsClient.cpp line 374
  17. 0x40218616: new_linkoutput at glue-lwip/lwip-git.c line 260
  18. 0x40218a30: ethernet_output at netif/ethernet.c line 312
  19. 0x40202d07: ArduinoJson6141_0000010::JsonDeserializer  , ArduinoJson6141_0000010::StringMover>::parseVariant(ArduinoJson6141_0000010::VariantData&) at X:\Nextcloud\Uncrypted\Programmation\Arduino\libraries\arduino_602693\src/ArduinoJson/Json/JsonDeserializer.hpp line 185
  20. 0x401003e0: ets_post(uint8, ETSSignal, ETSParam) at esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_main.cpp line 160
  21. 0x40202fb3: ArduinoJson6141_0000010::JsonDeserializer  , ArduinoJson6141_0000010::StringMover>::parseObject(ArduinoJson6141_0000010::CollectionData&) at X:\Nextcloud\Uncrypted\Programmation\Arduino\libraries\arduino_602693\src/ArduinoJson/Json/JsonDeserializer.hpp line 162
  22. 0x401003e0: ets_post(uint8, ETSSignal, ETSParam) at esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_main.cpp line 160
  23. 0x4020de25: uart_write(uart_t*, char const*, size_t) at esp8266\hardware\esp8266\2.6.3\cores\esp8266\uart.cpp line 509
  24. 0x401003bc: ets_intr_unlock() at esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_main.cpp line 146
  25. 0x4020b460: HardwareSerial::write(unsigned char const*, unsigned int) at esp8266\hardware\esp8266\2.6.3\cores\esp8266/HardwareSerial.h line 165
  26. 0x4020b751: Print::print(__FlashStringHelper const*) at esp8266\hardware\esp8266\2.6.3\cores\esp8266\Print.cpp line 114
  27. 0x4020de25: uart_write(uart_t*, char const*, size_t) at esp8266\hardware\esp8266\2.6.3\cores\esp8266\uart.cpp line 509
  28. 0x401004d8: millis() at esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_wiring.cpp line 188
  29. 0x4020b454: HardwareSerial::write(unsigned char const*, unsigned int) at esp8266\hardware\esp8266\2.6.3\cores\esp8266/HardwareSerial.h line 164
  30. 0x4020b460: HardwareSerial::write(unsigned char const*, unsigned int) at esp8266\hardware\esp8266\2.6.3\cores\esp8266/HardwareSerial.h line 165
  31. 0x4020b454: HardwareSerial::write(unsigned char const*, unsigned int) at esp8266\hardware\esp8266\2.6.3\cores\esp8266/HardwareSerial.h line 164
  32. 0x4020af45: Print::write(char const*) at esp8266\hardware\esp8266\2.6.3\cores\esp8266/Print.h line 60
  33. 0x4020b7e0: Print::println() at esp8266\hardware\esp8266\2.6.3\cores\esp8266\Print.cpp line 186
  34. 0x401003e0: ets_post(uint8, ETSSignal, ETSParam) at esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_main.cpp line 160
  35. 0x401003e0: ets_post(uint8, ETSSignal, ETSParam) at esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_main.cpp line 160
  36. 0x401003e0: ets_post(uint8, ETSSignal, ETSParam) at esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_main.cpp line 160
  37. 0x401003e0: ets_post(uint8, ETSSignal, ETSParam) at esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_main.cpp line 160
  38. 0x401003e0: ets_post(uint8, ETSSignal, ETSParam) at esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_main.cpp line 160
  39. 0x401003bc: ets_intr_unlock() at esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_main.cpp line 146
  40. 0x40100334: ClocklessController14, 20, 50, 30, (EOrder)66, 0, false, 5>::showRGBInternal(PixelController(EOrder)66, 1, 4294967295u>) at X:\Nextcloud\Uncrypted\Programmation\Arduino\libraries\LS_FastLED-3.1.8/platforms/esp/8266/clockless_esp8266.h line 13
  41. 0x401003e0: ets_post(uint8, ETSSignal, ETSParam) at esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_main.cpp line 160
  42. 0x401003e0: ets_post(uint8, ETSSignal, ETSParam) at esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_main.cpp line 160
  43. 0x401003e0: ets_post(uint8, ETSSignal, ETSParam) at esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_main.cpp line 160
  44. 0x40201311: animate() at temp_compile_Arduino\sketch\TET_Animations.cpp line 30
  45. 0x402012cb: animate() at temp_compile_Arduino\sketch\TET_Animations.cpp line 13
  46. 0x402066a8: ClocklessController14, 20, 50, 30, (EOrder)66, 0, false, 5>::showPixels(PixelController(EOrder)66, 1, 4294967295u>&) at X:\Nextcloud\Uncrypted\Programmation\Arduino\libraries\LS_FastLED-3.1.8/platforms/esp/8266/clockless_esp8266.h line 41
  47. 0x402067c0: CPixelLEDController(EOrder)66, 1, 4294967295u>::show(CRGB const*, int, CRGB) at X:\Nextcloud\Uncrypted\Programmation\Arduino\libraries\LS_FastLED-3.1.8/controller.h line 398
  48. 0x4020b0aa: CFastLED::countFPS(int) at X:\Nextcloud\Uncrypted\Programmation\Arduino\libraries\LS_FastLED-3.1.8\FastLED.cpp line 215
  49. 0x4020b138: CFastLED::show(unsigned char) at X:\Nextcloud\Uncrypted\Programmation\Arduino\libraries\LS_FastLED-3.1.8\FastLED.cpp line 64
  50. 0x4020675c: CPixelLEDController(EOrder)66, 1, 4294967295u>::show(CRGB const*, int, CRGB) at X:\Nextcloud\Uncrypted\Programmation\Arduino\libraries\LS_FastLED-3.1.8/controller.h line 395
  51. 0x401004d8: millis() at esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_wiring.cpp line 188
  52. 0x401004d8: millis() at esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_wiring.cpp line 188
  53. 0x4020132e: animate() at temp_compile_Arduino\sketch\TET_Animations.cpp line 37
  54. 0x401003e0: ets_post(uint8, ETSSignal, ETSParam) at esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_main.cpp line 160
  55. 0x40100401: esp_schedule() at esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_main.cpp line 113
  56. 0x4020cf19: loop_wrapper() at esp8266\hardware\esp8266\2.6.3\cores\esp8266\core_esp8266_main.cpp line 182

lbernstone
Posts: 828
Joined: Mon Jul 22, 2019 3:20 pm

Re: ESP32F crashes with Wifi Library + Websocket

Postby lbernstone » Tue Apr 14, 2020 3:07 pm

You have an esp8266, not esp32. https://github.com/esp8266/Arduino/issues

raysconcept
Posts: 2
Joined: Wed May 12, 2021 4:30 pm

Re: ESP32F crashes with Wifi Library + Websocket

Postby raysconcept » Wed May 12, 2021 4:56 pm

EDIT (12may2021): I discovered that one problem occurred when parsing the json that came in via websocket. ESP kept running with fastled performing a default function, but ESP got stuck once json was being parsed (done in the main loop when receiving it via websocket). At this time I had defined StaticJsonDocument<200> jsondoc outside of setup() and outside of loop().

The solution was to add StaticJsonDocument<200> jsondoc INSIDE of the main loop, just before the parser, see code below.

QUESTION ADDITIONAL REGARDING STRINGS IN RELATION TO JSON:
I am using String fromIn = jsondoc["from"]; to retrieve the values from the parser. In other posts I read that this should not be done in this manner (using String). Does anybody have a better way to do this? I believe this is bad for memory allocation or so.

=======================================================

// this is an example of data that is comming in:
// {"from":"ESP","msg":"PROBEOKE","mac":"7c-9e-bd-d2-ed-9c-","time":"19326"}

StaticJsonDocument<200> jsondoc; // <== THIS IS WHAT I ADDED FOR THE SOLUTION
DeserializationError err = deserializeJson(jsondoc, data);
if (err)
{
Serial.println("error deserialization");
Serial.println(err.c_str());
return;
}
if (jsondoc["from"]) // check if not null before dereferencing
{
String fromIn = jsondoc["from"];
String toIn = jsondoc["to"];
String actionIn = jsondoc["action"];
String msgIn = jsondoc["msg"];
}
=======================================================
=======================================================
=======================================================
ORIGINAL POST
=======================================================
I am working with ESP32, Wifi + WebSockets + ArduinoJson + Fastled and experiences crashes also.

It seems to run fine until I implement FastLed. I am sending instructions from nodejs (what leds to turn on etc) via websocket in json-format. It crashes when fastled.show(); is invoked;

=======================================================
just before the error occurs and crashes, the jsonparser stops working (results in null on all values)
then this error pops, and the esp is nonresonsive, the error message is even not completed

Guru Meditation Error: Core 1 panic'ed (StoreProhi
=======================================================
hardware:
board: huzzah32 feather
leds: ws2815
=======================================================
platformio.ini:

[env:huzzah]
platform = espressif32
board = featheresp32
framework = arduino
lib_deps =
bblanchon/ArduinoJson@^6.17.3
ottowinter/ArduinoJson-esphomelib@^6.15.2
fastled/FastLED@^3.4.0

=======================================================
This is the warning message I get when uploading to the board (not sure if it is related to the crash):

In file included from src\main.cpp:38:0:
.pio\libdeps\huzzah\FastLED\src/FastLED.h:14:21: note: #pragma message: FastLED version 3.004.000
# pragma message "FastLED version 3.004.000"
^
In file included from .pio\libdeps\huzzah\FastLED\src/FastLED.h:65:0,
from src\main.cpp:38:
.pio\libdeps\huzzah\FastLED\src/fastspi.h:135:23: note: #pragma message: No hardware SPI pins defined. All SPI access will default to bitbanged output
# pragma message "No hardware SPI pins defined. All SPI access will default to bitbanged output"
=======================================================

Who is online

Users browsing this forum: No registered users and 101 guests