several restarts with different reasons.

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
chromo23
Normal user
Posts: 821
Joined: 10 Sep 2020, 16:02
Location: germany

several restarts with different reasons.

#1 Post by chromo23 » 19 Oct 2021, 12:39

I have a wemos d1 mini here with a relay a rotary encoder and an oled attached.
(ESP_Easy_mega_20211005_normal_ESP8266_4M1M)
It restarts from time to time with at least three different reasons.
I already tried a different power supply but this shouldn’t be the cause.

I need help narrowing down the possible causes.

here the restart infos:

Boot: External Watchdog (16)
Reset Reason: Hardware Watchdog
Last Action before Reboot: Const Interval: TIMER_100MSEC

Boot: Exception (33)
Reset Reason: Exception
Last Action before Reboot: Const Interval: TIMER_20MSEC

Boot: Exception (28)
Reset Reason: Exception
Last Action before Reboot: Const Interval: TIMER_10MSEC

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: several restarts with different reasons.

#2 Post by TD-er » 19 Oct 2021, 13:45

Can you try to run it on USB with a terminal application connected to it to fetch serial output?
For example using Putty via the comport Windows assigns to it. Baudrate = 115200.

Given you're see exceptions, I guess it may be related to the rotary encoder.
Can you describe a bit more what is configured on the node?
For example, what type of controller is configured? MQTT?
What do you do with the output of the rotary encoder?
For example, do you act on events from that task? If so, please post the rules too.

User avatar
chromo23
Normal user
Posts: 821
Joined: 10 Sep 2020, 16:02
Location: germany

Re: several restarts with different reasons.

#3 Post by chromo23 » 19 Oct 2021, 15:30

Strange thing is, that it restarts usually when nothing happens.
I don´t use any controller except P2P.
Since it happens every 8 to 12 hours it will take a while with an external log but i´ll do so. :)

Rules:

Code: Select all

On System#Boot do
TimerSet,4,5
if [dummy#bootstate] = 0
 Taskvalueset,6,1,18
 Taskvalueset,6,4,18
endif
Taskvalueset,7,2,1
endon

//------nightmode------
On Clock#Output do
If [Clock#Output]=1
 Taskvalueset,6,4,[count#Dummy]
 Taskvalueset,6,1,19
else
 Taskvalueset,6,1,[count#Old]
endif
TimerSet,2,10
endon

//---------Temp-control---------
On Rules#Timer=4 do
if [dummy#boost] = 0
  if [var#2] = 1  
  oledframedcmd,1,"Soll: [count#Dummy]°C"
  oledframedcmd,2,"Ist: [Sensor#Temperature]°C"
  endif
 if [count#Set] - [Sensor#Temperature] > 0.6
  gpio,15,1
 elseif [Sensor#Temperature] >= [count#Set]  
  gpio,15,0
 endif
TimerSet,4,5
endif
endon 

//---------------Button---------
On Button#State=1 do
 oledframedcmd,display,on
 TimerSet,1,1
 TimerSet,2,10
 Let,2,1
endon

On Rules#Timer=1 do
 if [Button#State] = 1
    event,boost
 endif
endon

//---------------Boosttimerend---------
On Rules#Timer=3 do
 TimerSet,5,0
 Taskvalueset,7,1,0
 TimerSet,4,1
endon

//-------Rotary-------
On Rotary#Counter do
 oledframedcmd,display,on
 if [Rotary#Counter] > [count#Value] and [count#Dummy] < 30
  Taskvalueset,6,1,[count#Dummy]+0.5
 elseif [Rotary#Counter] < [count#Value] and [count#Dummy] > 15
  Taskvalueset,6,1,[count#Dummy]-0.5
 endif
 Taskvalueset,6,2,[Rotary#Counter]
 oledframedcmd,1,"Soll: [count#Dummy]°C"
  oledframedcmd,2,"Ist: [Sensor#Temperature]°C"
 TimerSet,2,10
 Let,2,1
endon

On up do
 TimerSet,2,10
 Let,2,1
oledframedcmd,1,"Soll: [count#Dummy]°C"
oledframedcmd,2,"Ist: [Sensor#Temperature]°C"
if [count#Dummy] < 30
 Taskvalueset,6,1,[count#Dummy]+0.5
endif
endon

On down do
 TimerSet,2,10
 Let,2,1
oledframedcmd,1,"Soll: [count#Dummy]°C"
oledframedcmd,2,"Ist: [Sensor#Temperature]°C"
if [count#Dummy] > 10
Taskvalueset,6,1,[count#Dummy]-0.5
endif
endon

//------BOOSTER-----------
On boost do
if [dummy#boost]=0
    Let,1,600
    oledframedcmd,1,"BOOST [Sensor#Temperature]°C" 
    oledframedcmd,2,[var#1]
    TimerSet,5,1
    TimerSet,3,600  //20minuten boost
    Taskvalueset,7,1,1
    TimerSet,7,10 
  TimerSet,5,0
  oledframedcmd,1,"Soll: [count#Dummy]°C"
  oledframedcmd,2,"Ist: [Sensor#Temperature]°C" 
  Taskvalueset,7,1,0
  TimerSet,4,1
  TimerSet,3,0
  TimerSet,7,0
endif
endon

On Rules#Timer=5 do  //for displaying a countdown when the boosttimer ends
 Let,1,[var#1]-1
 if [var#2] = 1
   oledframedcmd,1,"BOOST [Sensor#Temperature]°C" 
   oledframedcmd,2,[var#1]
 endif
 TimerSet_ms,5,900 //since the timing deviates after a while i tried to compensate with a shorter cycle (it works....somehow)
endon

On Rules#Timer=7 do
 gpio,15,1
endon


//-------Displaytimeout and value handover--------
On Rules#Timer=2 do
Let,2,0
oledframedcmd,display,off
Taskvalueset,6,3,[count#Dummy] 
endon
Bildschirmfoto 2021-10-19 um 15.29.28.png
Bildschirmfoto 2021-10-19 um 15.29.28.png (175.1 KiB) Viewed 8030 times
Bildschirmfoto 2021-10-19 um 15.39.03.png
Bildschirmfoto 2021-10-19 um 15.39.03.png (67.53 KiB) Viewed 8028 times

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: several restarts with different reasons.

#4 Post by TD-er » 19 Oct 2021, 15:46

How long are the cables from the ESP to the rotary encoder?
How is it electrically wired? (pull-up resistors etc.)
Does it sometimes count while there is no motion of the rotary encoder?

I do suspect it may receive noise on either one of the A/B inputs which causes it to trigger the interrupt code quite a lot, but since the other line is held firmly into the same state you will not see the noise as there cannot be a state change.
So the solution is probably to add stronger pull-up resistors and/or twist the cables from/to the encoder.

User avatar
chromo23
Normal user
Posts: 821
Joined: 10 Sep 2020, 16:02
Location: germany

Re: several restarts with different reasons.

#5 Post by chromo23 » 19 Oct 2021, 16:03

The rotary encoder is a module and i wired excactly the same way i did for another project.
I doesn't do ghost inputs as far as i can tell.

The hole thing is a drop in replacement für a heating controller.
IMG_9947.JPG
IMG_9947.JPG (106.51 KiB) Viewed 8024 times
IMG_9946.JPG
IMG_9946.JPG (133.6 KiB) Viewed 8024 times
Could it also be because i have misused it for my css and dashboard experiments :)
Therefore i uploaded files at least 50 times.

User avatar
chromo23
Normal user
Posts: 821
Joined: 10 Sep 2020, 16:02
Location: germany

Re: several restarts with different reasons.

#6 Post by chromo23 » 19 Oct 2021, 16:09

TD-er wrote: 19 Oct 2021, 15:46 I do suspect it may receive noise on either one of the A/B inputs which causes it to trigger the interrupt code quite a lot, but since the other line is held firmly into the same state you will not see the noise as there cannot be a state change.
would i see this in the debug loglevel?

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: several restarts with different reasons.

#7 Post by TD-er » 19 Oct 2021, 16:13

Not sure.
Maybe you can somehow deduct it from the timing stats (which have to be manually enabled in the tools->advanced page, if included in the build anyway)

User avatar
chromo23
Normal user
Posts: 821
Joined: 10 Sep 2020, 16:02
Location: germany

Re: several restarts with different reasons.

#8 Post by chromo23 » 28 Oct 2021, 17:20

I detached all devices and still get this random reboots. i can force them sometimes with uploading files.
Also used a completely new wemos with a different power source and imported only the settings an rules... same thing

This is what i get:

Code: Select all

154361 : Info   : SaveToFile: free stack after: 2848

——————— CUT HERE FOR EXCEPTION DECODER ———————

Exception (29):
epc1=0x4000df64 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

>>>stack>>>

ctx: cont
sp: 3fff28c0 end: 3fff2cc0 offset: 0190
3fff2a50:  40105ebd 00000ad7 3fff472c 4020546a  
3fff2a60:  3ffef800 3fff2f48 00000001 00000b68  
3fff2a70:  00000000 00000b68 3fff851c 402056ed  
3fff2a80:  40278465 00000001 00002612 00002612  
3fff2a90:  00000001 00000002 3fff851c 40205776  
3fff2aa0:  3fff851c 3fff2b00 00000000 40205cdc  
3fff2ab0:  3fff2b3c 3fff2ad0 3fff2b00 00002612  
3fff2ac0:  3fff2b3c 3fff136c 3fff2b00 40270275  
3fff2ad0:  2e707300 00737363 80ff2b60 402620ee  
3fff2ae0:  74616400 80ff0000 80ff2b60 4028277c  
3fff2af0:  3fff136c 00000001 3fff2b60 4027145a  
3fff2b00:  40284068 00000000 000003e8 402759e0  
3fff2b10:  3fff8634 3fff420c 00000000 00000000  
3fff2b20:  3fff306c 302e3200 0022302e 80275d94  
3fff2b30:  67615400 000d0000 80ff2b60 74786574  
3fff2b40:  7373632f 88006e00 80ff7500 4028277c  
3fff2b50:  00000000 3fff13ac 3fff136c 40272fcc  
3fff2b60:  2e707365 00737363 87600000 4023aa00  
3fff2b70:  402b0909 80000000 3fff5d00 3fff018c  
3fff2b80:  80000064 3fff13ac 3fff136c 40282772  
3fff2b90:  70736500 7373632e 80000300 4023e7bd  
3fff2ba0:  40204c8c 80ff0308 3fff9100 0000008f  
3fff2bb0:  8000632e 4bc6a7f0 00025bc9 00000001  
3fff2bc0:  3fff13ac 00000000 4bc6a7f0 00000000  
3fff2bd0:  00000001 3fff8234 40100d1a c624dd2f  
3fff2be0:  00000000 3fff851c 3fff136c 00000001  
3fff2bf0:  00000001 3fff1390 3fff136c 4023e85f  
3fff2c00:  40283c28 00000000 00001388 00000001  
3fff2c10:  00000000 3fff851c 3fff01a0 00000001  
3fff2c20:  3ffe8628 00000000 3fff01a0 4023e939  
3fff2c30:  0000003c 00000000 3fff0308 4023ca54  
3fff2c40:  09368afa 09368a61 402840d0 3fff2d0c  
3fff2c50:  3fffdad0 00000000 3fff1450 00000001  
3fff2c60:  3ffe8628 00000000 3fff1450 4023ecd8  
3fff2c70:  00000000 feefeffe feefeffe feefeffe  
3fff2c80:  00000000 00000000 00000001 3fff2d0c  
3fff2c90:  3fffdad0 00000000 3fff2cc8 40212638  
3fff2ca0:  feefeffe feefeffe feefeffe 4027745f  
3fff2cb0:  feefeffe feefeffe 3ffe8678 40100625  
<<<stack<<<

last failed alloc call: 4020546A(2920)

——————— CUT HERE FOR EXCEPTION DECODER ———————
edit: i´ll try running it with eco mode as well as oled plugin disabled. somehow i suspect the error coming from there
edit2: disabled only the oled framed plugin. It acted a bit strange from the beginning anyway. so far i could not force a reboot but could also be a coincidence....

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: several restarts with different reasons.

#9 Post by TD-er » 28 Oct 2021, 18:23

Can you record the free memory of the device (heap memory) and try to plot it?
The crash indicates you're running out of memory, or somehow some part of the code tries to allocate quite a lot of memory.

Please show the controller settings and which plugins you're using. (also whether you're having multiple instances of the same plugin)

User avatar
chromo23
Normal user
Posts: 821
Joined: 10 Sep 2020, 16:02
Location: germany

Re: several restarts with different reasons.

#10 Post by chromo23 » 28 Oct 2021, 19:20

The plugin overview you can see in on of my previous posts.
and here are the settings of the oled plugin:
Bildschirmfoto 2021-10-28 um 19.07.11.png
Bildschirmfoto 2021-10-28 um 19.07.11.png (72.39 KiB) Viewed 7818 times
Bildschirmfoto 2021-10-28 um 19.07.21.png
Bildschirmfoto 2021-10-28 um 19.07.21.png (39.46 KiB) Viewed 7818 times
I only use the p2p controller.

since i deactivated the oled plugin everything runs much smoother again.
I´ll avtivate it again and try to log the heap memory...

Edit: activated the plugin and with hitting submit button i immediately got a reboot because of an exception.....
which value you need?

Code: Select all

"Heap Max Free Block":4616,
"Heap Fragmentation":24,
"Free RAM":6128,
"Free Stack":3488,
Edit2: Every submit on the oled plugin causes a reboot

User avatar
chromo23
Normal user
Posts: 821
Joined: 10 Sep 2020, 16:02
Location: germany

Re: several restarts with different reasons.

#11 Post by chromo23 » 28 Oct 2021, 19:41

did a systematical test.

and.....

nooooooooooooo...... it is my css file.... :o

:shock:
:cry:

why? :oops:

and i don´t get why it is only in combination with the oled plugin :?:

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: several restarts with different reasons.

#12 Post by TD-er » 28 Oct 2021, 19:43

Can you log over a longer time the values for the free heap?
Do it with the OLED Framed plugin disabled for now.
I think your typical free memory is already low, so having that plugin enabled may tip it over the edge.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: several restarts with different reasons.

#13 Post by TD-er » 28 Oct 2021, 19:45

Ah, the CSS is being served by loading it in RAM.
You can try to reduce the css by using some (online) minify tool to reduce the CSS size.

I have to see how we can serve the CSS directly from the flash without loading it in RAM.

User avatar
chromo23
Normal user
Posts: 821
Joined: 10 Sep 2020, 16:02
Location: germany

Re: several restarts with different reasons.

#14 Post by chromo23 » 28 Oct 2021, 20:04

ahhh... that makes sense
i used the dynamic one... i´ll try to use the one-mode-only one for now or drop it entirely for this device.
thanks!
can you give me a small explanation about these memory values?

Heap Max Free Block":4616,
Heap Fragmentation":24,
Free RAM":6128,
Free Stack":3488,

Edit: but it is still getting really low without the css and the oled plugin enabled

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: several restarts with different reasons.

#15 Post by TD-er » 28 Oct 2021, 21:09

"really low" is not a bad thing.
N.B. I mean the "Free RAM" value.

But the combination of "really low" + a larger fragmentation is funest for stability, especially when serving web pages.
There is a number of checks in the web serving code to try to free up memory where possible (or simply not serving the page) when free memory is low.
However I doubt it is also taking into account when serving the CSS file too from the file system.
I have to look into the code for that.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: several restarts with different reasons.

#16 Post by TD-er » 28 Oct 2021, 21:11

Oh and the OLED framed plugin does have some "issues" with the code in the library.
I have looked at it a while ago and there is lots of room for optimization as there is a number of functions where data is being copied instead of just handing over a pointer.
So running OLED framed when already low on memory is not the most stable combination.

User avatar
chromo23
Normal user
Posts: 821
Joined: 10 Sep 2020, 16:02
Location: germany

Re: several restarts with different reasons.

#17 Post by chromo23 » 28 Oct 2021, 22:07

I changed to the normal oled plugin because i can not live without my own css anymore :)
And the oled framed plugin also just threw an error even without custom css...

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: several restarts with different reasons.

#18 Post by TD-er » 28 Oct 2021, 22:12

If you compile your CSS in the build, it will probably use less memory to serve the page.

User avatar
chromo23
Normal user
Posts: 821
Joined: 10 Sep 2020, 16:02
Location: germany

Re: several restarts with different reasons.

#19 Post by chromo23 » 29 Oct 2021, 20:52

Since i switched to the "simple" oled-plugin the system is running fine now for almost a day.
no reboots anymore. and i could keep my custom css (now minified...after all 2kb less). memory looks good...
today i added a window open detection and a emergency shutdown.... i am really happy with this project and especially with the firmware that makes such projects easy to build.

only downside now is the standard micromini font of the display plugin but therefore a have my custom dashboard :)

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: several restarts with different reasons.

#20 Post by Ath » 29 Oct 2021, 20:55

Could you re-enable the FramedOLED plugin again to see if it still crashes the ESP, or maybe the downsizing of the CSS actually fixed the issue?
/Ton (PayPal.me)

User avatar
chromo23
Normal user
Posts: 821
Joined: 10 Sep 2020, 16:02
Location: germany

Re: several restarts with different reasons.

#21 Post by chromo23 » 29 Oct 2021, 20:59

it also crashed without the css file...
not as often but it did
Especially when i was hitting the submit button of the plugin

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: several restarts with different reasons.

#22 Post by TD-er » 29 Oct 2021, 21:23

Just checking, you are using the latest build?
Or even the latest code base?

Here are builds based on the code base of a few days ago https://td-er.nl/ESPEasy/

User avatar
chromo23
Normal user
Posts: 821
Joined: 10 Sep 2020, 16:02
Location: germany

Re: several restarts with different reasons.

#23 Post by chromo23 » 29 Oct 2021, 21:28

I use the latest build.
Did something changed regarding the oled framed plugin in the last days? then i will test it...

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: several restarts with different reasons.

#24 Post by Ath » 29 Oct 2021, 21:53

FramedOLED hasn't been updated for the last several months.
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 31 guests