Skip to content
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

SWAN R5: Sleep modes are broken #8977

Open
bablokb opened this issue Feb 24, 2024 · 0 comments
Open

SWAN R5: Sleep modes are broken #8977

bablokb opened this issue Feb 24, 2024 · 0 comments

Comments

@bablokb
Copy link

bablokb commented Feb 24, 2024

CircuitPython version

Adafruit CircuitPython 8.2.9 on 2023-12-06; Swan R5 with STM32L4R5ZIY6

Code/REPL

def work():
  led.value = 1
  time.sleep(LED_TIME)
  led.value = 0

while True:
  # do some work
  work()

  # sleep
  if MODE == SPIN:
    next = time.monotonic() + INT_TIME
    while time.monotonic() < next:
      continue
  elif MODE == SLEEP:
    print(f"(normal) sleep for {INT_TIME}s")
    time.sleep(INT_TIME)
  elif MODE == LIGHT_SLEEP:
    print(f"(light) sleep for {INT_TIME}s")
    time_alarm = alarm.time.TimeAlarm(monotonic_time=time.monotonic()+INT_TIME)
    alarm.light_sleep_until_alarms(time_alarm)
  elif MODE == DEEP_SLEEP:
    print(f"(deep) sleep for {INT_TIME}s")
    time_alarm = alarm.time.TimeAlarm(monotonic_time=time.monotonic()+INT_TIME)
    alarm.exit_and_deep_sleep_until_alarms(time_alarm)

Behavior

With light-sleep, I can see the following current (at 3.6V):
swan-timer-light-sleep

So in light-sleep mode, the SWAN needs about 30mA. When the LED is on and the device sleeps normally (during work()), current is only about 16mA.

Deep-sleep is even more broken:
swan-timer-deep-sleep

You can see that the device tries to switch to deep-sleep, but it wakes up again without actually sleeping (note that this is not fake deep-sleep, there was no USB connection). After wake up, you can see the 16mA during work() again, then the try-to-go-to-deep-sleep-and-fail cycle starts over.

Description

No response

Additional information

No response

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

2 participants