arendst / Tasmota

Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at
https://tasmota.github.io/docs
GNU General Public License v3.0
22.26k stars 4.81k forks source link

Fatal exception while using counter and rule #4286

Closed kajmaj closed 6 years ago

kajmaj commented 6 years ago

I am using Wemos D1 UNO with switch connected and used as counter. Tamota version: 6.3.0.1, Core/SDK Version | 2_3_0/1.5.3 Counter causes repeatedly fatal error: 17:35:12 MQT: tele/wemos_3/INFO3 = {"RestartReason":"Fatal exception:0 flag:2 (EXCEPTION) epc1:0x402180d8 epc2:0x00000000 epc3:0x00000000 excvaddr:0x00000000 depc:0x00000000"} Currently connected GPIO 14, 10K pull up resistor connected to 3.3V. Rule used: on tele-counter#c1>0 do publish stat/wind/counter1 %value% endon on tele-counter#c1>0 do counter1 0 endon

I´ve tried differend power plugs to eliminate power failure, different GPIOs (with or without pull down resistor 4K7 or 10K) and 2 GPIOs with already installed 10K pull downs

Is it possible to define a cause?

Jason2866 commented 6 years ago

What have you connected and how? Precompiled firmware?

ascillato commented 6 years ago

Please, complete the troubleshooting template in order to have the required information so as to properly help you

ascillato commented 6 years ago

Sometimes an exception is out of memory, so we need the template completed to gather this type of information (features chosen, self compiled or pre compiled, etc)

andrethomas commented 6 years ago

You also need to provide the map file or the firmware used so that we can see where epc1:0x402180d8 is originating from.

kajmaj commented 6 years ago

Sorry for my negligence:

This error is with sonoff.bin (6.3.0) from http://thehackbox.org/tasmota/release/ not modified, flashed OTA: 18:34:07 MQT: tele/wemos_3/INFO3 = {"RestartReason":"Fatal exception:0 flag:2 (EXCEPTION) epc1:0x4020c678 epc2:0x00000000 epc3:0x00000000 excvaddr:0x00000000 depc:0x00000000"}

This one was with development version 6.3.0.1 self compilled using PlatformIO and flashed OTA: 17:35:12 MQT: tele/wemos_3/INFO3 = {"RestartReason":"Fatal exception:0 flag:2 (EXCEPTION) epc1:0x402180d8 epc2:0x00000000 epc3:0x00000000 excvaddr:0x00000000 depc:0x00000000"}

Connected is a wind sensor (a reed switch) by an approx 3 m long shielded wire, connected to wemos by DUPOND connectors

andrethomas commented 6 years ago

According to map file, exception eminates from 4020c678 g F .irom0.text 00000014 _Z14CounterUpdate1v

@ascillato bug?

andrethomas commented 6 years ago

Please try to modify the rule to

on tele-counter#c1>0 do backlog publish stat/wind/counter1 %value%;counter1 0 endon

and report back the outcome

kajmaj commented 6 years ago

Modified, will report back ....

kajmaj commented 6 years ago

Issue persists:

00:00:06 MQT: tele/wemos_3/INFO3 = {"RestartReason":"Fatal exception:0 flag:2 (EXCEPTION) epc1:0x4020c678 epc2:0x00000000 epc3:0x00000000 excvaddr:0x00000000 depc:0x00000000"}

andrethomas commented 6 years ago

please provide output of command

rule

kajmaj commented 6 years ago

18:59:51 RUL: TELE-COUNTER#C1>0 performs "backlog publish stat/wind/counter1 86;counter1 0" 18:59:51 MQT: stat/wind/counter1 = 86 18:59:51 MQT: stat/wemos_3/RESULT = {"Counter1":0}

andrethomas commented 6 years ago

That looks like it worked

Works for me also

19:00:51 RUL: TELE-COUNTER#C1>0 performs "backlog publish stat/wind/counter1 15;counter1 0"
19:00:51 MQT: stat/wind/counter1 = 15
19:00:51 MQT: stat/sonoff/RESULT = {"Counter1":0}

What I meant is the output produced when you send command "rule" on the console - i want to see all the rules

andrethomas commented 6 years ago

And what is the other side of the reed switch connected to, GND ?

kajmaj commented 6 years ago

19:07:19 CMD: Rule1 19:07:19 MQT: stat/wemos_3/RESULT = {"Rule1":"ON","Once":"OFF","StopOnError":"OFF","Free":428,"Rules":"on tele-counter#c1>0 do backlog publish stat/wind/counter1 %value%;counter1 0 endon"}

Your rule works in the same way as mine.

Reed switch is connected between GND and GPIO 14 on Wemos. Pull up resistor is connected between 3.3V PIN and GPIO 14. Error appears in both cases - with pullup/ without pullup

andrethomas commented 6 years ago

I cannot reproduce the error with a reed switch setup in the same way as you - I do not have a pull-up resistor because I use the internal one. Try disconnect and disable any other inputs you have and see if it can reproduce an error, mine is like this without a pull-up resistor and reed switch between GPIO14 and gnd

image

kajmaj commented 6 years ago

wemos_counter

Just one input connected.

kajmaj commented 6 years ago

Error w/o pullup: 19:24:14 MQT: tele/wemos_3/INFO3 = {"RestartReason":"Fatal exception:0 flag:2 (EXCEPTION) epc1:0x4020c678 epc2:0x00000000 epc3:0x00000000 excvaddr:0x00000000 depc:0x00000000"}

andrethomas commented 6 years ago

I cannot reproduce your exception.

Let's assume there is something else weird in the config.

Do command: reset 5 This will erase the data portion of the flash, restore to defaults from user_config.h and retain your wifi settings and reboot.

Then configure the input pin again and see if you can reproduce.

To make sure we're on the same page please use the binary from http://thehackbox.org/tasmota/release/sonoff.bin (6.3.0 release) so that we know our firmware is the same. If you are currently using a different binary please upgrade OTA first, then reset 5 and reconfigure as above.

If the problem persists, try it on another pin and revert back to us.

kajmaj commented 6 years ago

I will try to reset 5 and report Nonetheless: I am on 6.3.0 => http://thehackbox.org/tasmota/release/sonoff.bin Error appears only if reed switch produces pulses. I've already tested more pins with no difference.

andrethomas commented 6 years ago

Sorry, can't reproduce - you will wait to see if someone else like @ascillato can reproduce the problem.

kajmaj commented 6 years ago

Thanks anyhow :)

ascillato commented 6 years ago

Sorry, I can't reproduce this either. Tasmota 6.3.0 and 6.3.0.3 with NodeMCU.

Have tested in several devices your rule and works fine.

Besides, I'm using a very similar rule for my watering system to measure the water flow and never had issues with that.

Have you done an erase before flash? Seems like a corrupted flashed firmware.

ascillato2 commented 6 years ago

When you have time, please report back if erasing and flashing the firmware again has solved your issue. Please, try the last precompiled bin from development branch. Thanks

Support Information

See Wiki for more information. See Chat for more user experience.

kajmaj commented 6 years ago

Solved !! It seems to be caused by an active Sleep I´ve disabled it (set to 0) and fatal exception with related restart reboots is gone, OK it seems to be gone. At the moment it is working more than 3 hrs w/o problems/reboots. So as result I did not need to reset flash an do full reflash.

andrethomas commented 6 years ago

@kajmaj Very nice find! Thanks for providing the feedback so we will remember it for the future.

When I tested my devices are always pre-compiled for sleep 5 so I did not have issues on sleep 5 - can you confirm that it is only if you go as high as 50 or does it work for you on sleep 5 also?

kajmaj commented 6 years ago

@andrethomas Just retested it. 5, 10 and 50 causes fatal exception, well at leat for my Wemos.

Furthermore while testing device (Wemos D1 UNO) I found that some GPIOs numbers on device WebUI configuration page are connected to another GPIOs in reality. (tested on 2 devices) If anybody is interested ( Theo, Adrian ?) I can share it.

andrethomas commented 6 years ago

Thanks

The GPIO to Dx mapping is for the ESP8266 Generic Module itself - The Chinese manufacturers sometimes choose different D numbers for reasons we will never comprehend.

I have some boards that have two D2 pins, but in reality one of them is D1 ;)

kajmaj commented 6 years ago

OK. Lets forget strange GPIOs mapping :)

kajmaj commented 5 years ago

Small update: I needed to connect INA219 to the related wemos -> I´ve upgraded (clean flash) to sonoff-sensors (6.5.0 2.3.0) , did the same settings as on previous version and Fatal Exception is back. I noticed that (at least in my case) a combination http://thehackbox.org/tasmota/release/sonoff-sensors.bin with counter causes repeated Fatal Exception. If I flashed (OTA) back to sonoff-basic, everything is OK again. Might be there any bug in FW?

Yuriyvp commented 5 years ago

Good day all. I would like to report same problem. Reproduced successfully on sonoff basic r1 and r2. GPIO1 and GPIO3 connected to hall water flow sensors. With counters enable - restart by Fatal Exception. Fix by command <sleep 0>