ESP32: Timer and sleep cause hang
Port, board and/or hardware
ESP32_GENERIC-20250809-v1.26.0, NodeMCU ESP32-WROOM-32
MicroPython version
MicroPython v1.26.0 on 2025-08-09; Generic ESP32 module with ESP32
Reproduction
The following code causes the sleep() to hang consistently on iteration 254 on both esp32 boards I tested this on. After this hang any other call to sleep() will hang too, a hard reset is needed to recover.
from machine import Pin, Timer
import time
LED = Pin(2, Pin.OUT)
TIMER = Timer(0)
def blink():
LED.on()
TIMER.init(mode=Timer.ONE_SHOT, period=5, callback=lambda timer: LED.off())
i = 0
while True:
blink()
i += 1
print(f"Loop {i}")
time.sleep(0.01)
This code does not hang on v1.25.0.
Expected behaviour
The loop should run indefinitely
Observed behaviour
Hang on iteration 254
Additional Information
No, I've provided everything above.
Code of Conduct
Yes, I agree
ESP32-C6 timers not working on custom build
Port, board and/or hardware
esp32-c6 custorm pcb
MicroPython version
MicroPython v1.25.0 on 2025-06-28; ESP32C6 module with ESP32C6
built with espidf v5.3.2 or 5.4.1, trying v1.26 preview form master branch gives same result
Reproduction
- create a timer ( 0 or 1)
- init it and set a callback
- wait for callback result
def mycallback(t):
print('timer')
tim = Timer(0)
tim.init(period=100, callback=mycallback)
Expected behaviour
Expected print "timer"
Observed behaviour
nothing happens, working fine on espidf 5.2.5
Additional Information
No, I've provided everything above.
Code of Conduct
Yes, I agree