stm32duino / STM32LowPower

Arduino Low Power library for STM32
187 stars 52 forks source link

Bluepill STM32 doesn't enter sleep mode #45

Closed ghost closed 3 years ago

ghost commented 3 years ago

I'm trying to work out what the default wakeup events are for the STM32.

I tried modifying the timed wakeup example from deepSleep to sleep, and now it does nothing - sleep mode is never started.

#include "STM32LowPower.h"

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  // Configure low power
  LowPower.begin();
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  LowPower.sleep(1000);
  digitalWrite(LED_BUILTIN, LOW);
  LowPower.sleep(1000);
}
FRASTM commented 3 years ago

@QuitButton , you could please detail a bit, did you change the sleeping time (from 1000ms to x) did you find this change caused the system not entering the sleep mode did you check that the WFI in the HAL_PWR_EnterSLEEPMode is not reached or immediately returned

Manolo8888 commented 3 years ago

_#include "STM32LowPower.h" int x=1200;

void setup() { pinMode(LED_BUILTIN, OUTPUT); LowPower.begin(); }

void loop() { digitalWrite(LED_BUILTIN, HIGH); LowPower.sleep(x); delay(200); digitalWrite(LED_BUILTIN, LOW); LowPower.sleep(x); delay(200); }

It doesnt work. Compiled in Arduino platform

fpistm commented 3 years ago

@Manolo8888 I've retest with a BluePill and it works. I close this issue as it is inactive and it works as expected.