ESP32-C3 PinAlarm not firing in light_sleep on level high

Abierto
#11,680 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
52/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
c, embedded-iot, python
Área
embedded-iot

Línea de trabajo

Start by tracing ESP32-C3 light-sleep PinAlarm handling and how it configures the pin for a high-level wake condition; the issue does not name source files or tests. Compare the low-level alarm behavior with the reported high-level case and the three short-sleep workaround. Done when releasing the button wakes light sleep promptly without requiring the workaround.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

alarms and sleep bug esp32-c3
CircuitPython version and board name
Adafruit CircuitPython 10.3.1 on 2026-09-14; Maker Go ESP32C3 Supermini with ESP32-C3
Board ID:makergo_esp32c3_supermini
Code/REPL
...
wake = alarm.light_sleep_until_alarms(
    alarm.time.TimeAlarm(monotonic_time=deadline),
    alarm.pin.PinAlarm(
          pin=board.IO21,
            value=True,
            pull=False,
        )
    )
Behavior

When the (active-low) button is not pressed, I add the alarm:

alarm.pin.PinAlarm(
          pin=board.IO21,
            value=False,
            pull=True,
        )

Then the light_sleep returns immediately with the PinAlarm as soon as the button is pressed.

But after that, I call the light sleep again, this time adding:

alarm.pin.PinAlarm(
          pin=board.IO21,
            value=True,
            pull=False,
        )

But this time, releasing the button has no effect, and the sleep returns later with a TimerAlarm once the time_monotonic deadline is reached.

I have a workaround: call the light_sleep 3 times with very short deadlines (time_monotonic 10ms in future). After this, I call light_sleep with a much longer timer expiry, and releasing the button has immediate effect.

The electrical wiring has the button pulling the pin to earth, with no other components such as pull-ups.

This issue is asymmetrical, because a PinAlarm waiting for a logic low (button pressed) always returns instantly from the sleep. It's just waiting for logic high that's giving me problems.

Fortunately the workaround has proven effective. But I'd like to find a cleaner solution.

For context, I'm executing the light_sleep in a scheduler run loop, where the scheduler is feeding off a jobs queue, executing jobs that are due to run, and otherwise light_sleeping until the next job is due.

Description

No response

Additional information

No response

Lenguaje dominante
C
Estrellas
4.6k
Forks
1.4k
Merge medio
1 d 18 h
PR fusionados (30 d)
161

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de adafruit/circuitpython

Todos los issues de adafruit/circuitpython

Issues similares

Más issues de C

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.