Bug? ESP8266 Timer stops after 75 minutes

Bert Oudshoorn

Member
Licensed User
The led stops blinking after about 75 minutes, whether 500 or 1000 msec is specified.
Serial and Log statements have been removed temporarily for testing and the physical
tx/rx wires not attached. The usb only attached for power.
Might it be a memory leak? Or a counter limit in C? Or processor setting?
The processor was not dead / in sleep. A button and 2nd led in an other try-out was
still working.

'// ESP8266-01 blinking try-out via a Timer
#Region Project Attributes
#AutoFlushLogs: True
#CheckArrayBounds: True
#StackBufferSize: 300
#End Region

Sub Process_Globals
Private led2 As Pin
Private led2_state As Boolean = False
Private timer1 As Timer
End Sub

Private Sub AppStart
led2.Initialize(2, led2.MODE_OUTPUT) '// on GPIO2
timer1.Initialize("timer1_Tick", 500) '// or 1000
timer1.Enabled = True
End Sub
 

Bert Oudshoorn

Member
Licensed User
Erel, thank you. You give me hope :) What I listed is the full code (without indenting, unfortunately). Weird, what can be the difference? Two libraries attached: rCore 1.10 and rESP8266 1.00 I run on a ESP8266-01 with 512K64, Generic ESP8266 module. The UTC+2 cannot be the problem.
 

Bert Oudshoorn

Member
Licensed User
Oeps, that was missing, I have some problems with embedding/attaching things (Wondows 10 Edge?)
SubTimer1_Tick
led2_state = Not(led2_state)
led2.DigitalWrite(led2_state)
EndSub
 

Bert Oudshoorn

Member
Licensed User
Thank you. The AvailableRAM is more or less constant (swaps between 2 close values), the StackBufferUsage stayes on 0. However, the Timer does not stop, if a Log is specified. It does not matter what is logged. Even each minute a Log(counter) "solves" the problem. Would it be a sleep mode?
 

Cableguy

Expert
Licensed User
Longtime User
could it be a brown-out situation? if the board was running in battery mode, a low voltage could have that effect
 

Bert Oudshoorn

Member
Licensed User
Thank you, no I tested it even with a 2,4 A Apple power supply :) and use a LM1117 for the 3,3 V.
But I tried it now with WeMos D1 mini, the first example from
https://www.b4x.com/android/forum/threads/timers-loopers-and-callsubplus.65989/
Did not change anything. Pin13 = D7, a led with a 220 ohm resistor.
It also stops blinking (without a Log statement in the Timer event).

And this can not be the problem, I guess
#Region Project Attributes
#AutoFlushLogs: True
#CheckArrayBounds: True
#StackBufferSize: 300
#End Region
 

woniol

Active Member
Licensed User
Longtime User
Hi,
I have the same problem with my NODE MCU module.
Any idea how to solve this?

My code:
B4X:
Private Sub AppStart
   Serial1.Initialize(115200)
   Log("AppStart")
   If wifi.Connect2("xxx","yyy") Then 'change to your network SSID (use Connect2 if a password is required).
     Log("Connected to wireless network.")
   Else
     Log("Failed to connect.")
     Return
   End If
   ScanNetworks
   pp.Initialize(p2.D0, pp.MODE_OUTPUT)
   pp.DigitalWrite(True)
   timer1.Initialize("timer1_Tick", 50)
   timer1.Enabled = True
End Sub

Sub Timer1_Tick
    pp.DigitalWrite(Not(pp.DigitalRead))
End Sub
 

woniol

Active Member
Licensed User
Longtime User
I can also confirm that adding Log to the Timer_Tick Sub solves the problem.
 
Top