Skip to content

alarm.exit_and_deep_sleep_until_alarms(pin_alarm) fails to deep sleep on Xiao ESP32 C6 #10224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
timshac opened this issue Apr 5, 2025 · 2 comments

Comments

@timshac
Copy link

timshac commented Apr 5, 2025

CircuitPython version and board name

Adafruit CircuitPython 9.2.6 on 2025-03-23; Seeed Xiao ESP32-C6 4MB Flash 512KB SRAM with ESP32-C6FH4

Code/REPL

import board
import alarm
import microcontroller
import digitalio

# LED pin for observing if deep sleep was reached (LED will go out)
LED_PIN = microcontroller.pin.GPIO15
led = digitalio.DigitalInOut(LED_PIN)
led.direction = digitalio.Direction.OUTPUT
led.value = False  # turn on LED

pin_alarm = alarm.pin.PinAlarm(pin=board.D9, value=True, pull=False)
alarm.exit_and_deep_sleep_until_alarms(pin_alarm)
# board does not deep sleep here (above)
# this code (below) will correctly sleep, forever:
# alarm.exit_and_deep_sleep_until_alarms()

Behavior

With the pin_alarm, the board will not sleep:

alarm.exit_and_deep_sleep_until_alarms(pin_alarm)

The device will not deep sleep.

With no alarms, the board will sleep forever:

alarm.exit_and_deep_sleep_until_alarms()

This code will correctly deep sleep.

Deep sleeping correctly works with a time alarm:

time_alarm = alarm.time.TimeAlarm(monotonic_time=time.monotonic() + 10)
alarm.exit_and_deep_sleep_until_alarms(time_alarm)

This code will correctly deep sleep, and wake up 10s later.

Description

No response

Additional information

No response

@timshac timshac added the bug label Apr 5, 2025
@dhalbert
Copy link
Collaborator

dhalbert commented Apr 7, 2025

If you jumper D9 (GPIO20) to ground, does it sleep? Is anything connected to D9?

@dhalbert dhalbert added this to the 10.0.0 milestone Apr 7, 2025
@timshac
Copy link
Author

timshac commented Apr 7, 2025

Good point.

If I strap D9 to ground or 3V3, the board still does not sleep.

I tried with the following alarms individually, all which failed to sleep:

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

Thanks for having a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants