Hi,
light and deep-sleep modes in CircuitPython are broken for the SWAN R5. Light-sleep uses almost twice as much current than a “normal” time.sleep(). Deep-sleep does not work at all, the device wakes up right after entering that low-power state.
I opened an issue with CircuitPython for that:
  
  
    
  
  
    
    
      
        opened 08:13AM - 24 Feb 24 UTC 
      
      
     
    
        
          bug
         
    
   
 
  
    ### CircuitPython version
```python
Adafruit CircuitPython 8.2.9 on 2023-12-06;…  Swan R5 with STM32L4R5ZIY6
```
### Code/REPL
```python
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):

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:

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_ 
   
   
  
    
    
  
  
 
             
            
              1 Like 
            
            
           
          
            
            
              Hi @datalogger ,
Thanks for logging the issue on the CircuitPython repo. We are also investigating this internally.
Rob