Eisbaeeer / Ferraris_MQTT_Energy_Counter_Meter_TCRT5000

Ferraris energy counter with TCRT5000 infrared sensors
MIT License
59 stars 17 forks source link

Exception on NodeMcu v3 when opening captive portal in browser #24

Closed phija closed 1 year ago

phija commented 1 year ago

Hi,

I try to make this project run on my NodeMcu v3 and can build and deploy it using PlatformIO without any issues. My goal is to have later 2 TCRT5000 connected to measure on a single Ferraris counter but with 2 directional detection.

The problem starts when opening the captive portal in the browser to enter my personal Wifi connection data.

My steps to reproduce

  1. restart the NodeMcu and start Serial Monitor (in VS Code): message says "Opened a captive portal", blue LED is on.
  2. connect to wifi "Ferraris MQTT": browser opens automatically the 192.168.4.1 with showing the Wifi settings

when the page has loaded, immediately the serial monitor shows an unhandled C++ exception and the whole NodeMcu crashes and restarts:

The exception starts like this:

Opened a captive portal
192.168.4.1

User exception (panic/abort/assert)
--------------- CUT HERE FOR EXCEPTION DECODER ---------------

Unhandled C++ exception: OOM

>>>stack>>>

ctx: sys
sp: 3fffedf0 end: 3fffffb0 offset: 0010
3fffee00:  3fffb05c 4021993c 00000144 4022e896  
3fffee10:  00000000 3fff1684 3fffb05c 4021993c
...

and the bottom of the stack trace shows the beginning always like this:

...
0x4027fef0 in pm_wakeup_init at ??:?
0x4021164c in WiFiUDP::parsePacket() at C:\Users\***\.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi\src/WiFiUdp.cpp:198
0x40233dec in PubSubClient::connected() at .pio\libdeps\nodemcuv2\PubSubClient\src/PubSubClient.cpp:689
0x402299d9 in PubSubClient::loop() at .pio\libdeps\nodemcuv2\PubSubClient\src/PubSubClient.cpp:371
0x402069f5 in WifiManager::loop() at .pio\libdeps\nodemcuv2\ESP8266 IoT Framework\src/WiFiManager.cpp:245
0x4020aef9 in loop at src/main.cpp:370 (discriminator 2)
0x4020b0ab in setup at src/main.cpp:306
0x40100680 in ets_post at C:\Users\***\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/core_esp8266_main.cpp:238
0x401006a1 in esp_schedule at C:\Users\***\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/core_esp8266_main.cpp:136
0x4022ecca in loop_wrapper() at C:\Users\***\.platformio\packages\framework-arduinoespressif8266\cores\esp8266/core_esp8266_main.cpp:264

last failed alloc call: 40219778(324)

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

last failed alloc caller: 0x40219778

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 3424, room 16
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8
tail 0
chksum 0x2b
csum 0x2b
v000f1190
~ld

How can I make it run without crashing? Any help is appreciated!

Eisbaeeer commented 1 year ago

You have to debug the dump to find the error. There are several how to in web to debug the dump. Greets LarsVon meinem/meiner Galaxy gesendet -------- Ursprüngliche Nachricht --------Von: phija @.> Datum: 13.10.23 13:27 (GMT+01:00) An: Eisbaeeer/Ferraris_MQTT_Energy_Counter_Meter_TCRT5000 @.> Cc: Subscribed @.***> Betreff: [Eisbaeeer/Ferraris_MQTT_Energy_Counter_Meter_TCRT5000] Exception on NodeMcu v3 when opening captive portal in browser (Issue #24) Hi, I try to make this project run on my NodeMcu v3 and can build and deploy it using PlatformIO without any issues. My goal is to have later 2 TCRT5000 connected to measure on a single Ferraris counter but with 2 directional detection. The problem starts when opening the captive portal in the browser to enter my personal Wifi connection data. My steps to reproduce

restart the NodeMcu and start Serial Monitor (in VS Code): message says "Opened a captive portal", blue LED is on. connect to wifi "Ferraris MQTT": browser opens automatically the 192.168.4.1 with showing the Wifi settings

when the page has loaded, immediately the serial monitor shows an unhandled C++ exception and the whole NodeMcu crashes and restarts: The exception starts like this: Opened a captive portal 192.168.4.1

User exception (panic/abort/assert) --------------- CUT HERE FOR EXCEPTION DECODER ---------------

Unhandled C++ exception: OOM

stack>>>

ctx: sys sp: 3fffedf0 end: 3fffffb0 offset: 0010 3fffee00: 3fffb05c 4021993c 00000144 4022e896
3fffee10: 00000000 3fff1684 3fffb05c 4021993c ...

and the bottom of the stack trace shows the beginning always like this: 0x4027fef0 in pm_wakeup_init at ??:? 0x4021164c in WiFiUDP::parsePacket() at C:\Users\jarvers.platformio\packages\framework-arduinoespressif8266\libraries\ESP8266WiFi\src/WiFiUdp.cpp:198 0x40233dec in PubSubClient::connected() at .pio\libdeps\nodemcuv2\PubSubClient\src/PubSubClient.cpp:689 0x402299d9 in PubSubClient::loop() at .pio\libdeps\nodemcuv2\PubSubClient\src/PubSubClient.cpp:371 0x402069f5 in WifiManager::loop() at .pio\libdeps\nodemcuv2\ESP8266 IoT Framework\src/WiFiManager.cpp:245 0x4020aef9 in loop at src/main.cpp:370 (discriminator 2) 0x4020b0ab in setup at src/main.cpp:306 0x40100680 in ets_post at C:\Users\jarvers.platformio\packages\framework-arduinoespressif8266\cores\esp8266/core_esp8266_main.cpp:238 0x401006a1 in esp_schedule at C:\Users\jarvers.platformio\packages\framework-arduinoespressif8266\cores\esp8266/core_esp8266_main.cpp:136 0x4022ecca in loop_wrapper() at C:\Users\jarvers.platformio\packages\framework-arduinoespressif8266\cores\esp8266/core_esp8266_main.cpp:264

last failed alloc call: 40219778(324)

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

last failed alloc caller: 0x40219778

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 3424, room 16 tail 0 chksum 0x2e load 0x3fff20b8, len 40, room 8 tail 0 chksum 0x2b csum 0x2b v000f1190 ~ld

How can I make it run without crashing? Any help is appreciated!

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

phija commented 1 year ago

Thanks for the hint. It seems to be the MQTT configuration which I didn't take care. If I comment out that parts in the setup() it works until the next mqtt methods are called in the loop(). Funny, this is the part I wanted us come around with by using a datalogger shield anyway because my Ferraris counter has no private wifi available. So I need to rewrite some parts in my fork. Good enough for me then!

For anybody else: without having things setup and configured correctly (like MQTT), it might be crashing...