QUERY · ISSUE
Various unexpeced errors, if initialized timer is not referenced by pythoncode
proposed-close
When Timer is initialized, but instance is no longer referenced from python code, it's probably subject for GC.
Unfortunatelly after GC there are unexpected errors, when timer should fire.
Most probably underlaying RTOS or c++ code is still trying to reference memory, which was used by python Timer object, which is now gone.
initial topic: https://forum.micropython.org/viewtopic.php?f=2&t=5898&p=33812#p33812
CANDIDATE · ISSUE
RP2: Unexpected behaviour if allocation occurs in ISR
Most platforms raise an exception if an ISR attempts allocation. RP2 fails silently.
from machine import Pin, PWM,Timer
import time
a = 1.0
def ns(_):
global a
a *= 1.1
t1= Timer()
t1.init(freq =8000, mode = Timer.PERIODIC, callback =ns)
while True:
print(a)
time.sleep(1)
Result:
1.0
inf
inf
inf
inf
This behaviour is confusing: arguably an exception should be raised.