Closed xvedra closed 1 year ago
Hi @xvedra How did you flash it?
Which Arduino IDE? 1.8.x or 2.0.x? Host OS? upload method? Selected target?
What happen if you manually reset it (not power down)?
Hi @fpistm, IDE 1.8.19 Under Windows 10 pro upload method: SWD (ST-LINK) Target: BluePill F103C8 What happen if you manually reset it (not power down)? The same...
After read this: https://github.com/stm32duino/STM32LowPower/issues/36
Works fine adding HAL_SuspendTick(); before LowPower.deepSleep();
... HAL_SuspendTick(); //Without this the MCU wakes up immediately (My problem) LowPower.deepSleep(); HAL_ResumeTick(); // I don't know if it's necessary ...
Thank you!
You used LSE?
BluePill board has LSE but I have used the simplest example without LSE (supposedly...):
void setup() { pinMode(LED_BUILTIN, OUTPUT); LowPower.begin(); }
void loop() { digitalWrite(LED_BUILTIN, HIGH);
HAL_SuspendTick(); //added LowPower.deepSleep(2000); HAL_ResumeTick(); //added
LowPower.sleep();
digitalWrite(LED_BUILTIN, LOW);
HAL_SuspendTick(); //added LowPower.deepSleep(2000); HAL_ResumeTick(); //added
LowPower.sleep();
}
There was no problem using with LowPower.sleep()
For the problem to occur, must delete the flash or previously use a firmware that does not use deepSleep. Once the power down is done it works. By adding HAL_SuspendTick() it is no longer necessary to power down. It also continues to work on subsequent updates unless deepSleep is not used.
Is it a legacy chip? Not a clone?
I've tested on my side and have no issue.
Ensure to have latest library version, latest core version and latest STM32CubeProgrammer as you used SWD.
I've tested with different setup, USB enabled or not,... all works.
Moreover it seems strange using HAL_SuspendTick
allows to work as the deepSleep
disable the irq before entering in low power.
Is it a legacy chip? Not a clone? My BluePill is from Aliexpress. I don't know if it's a clone. I have a custom board with a legacy (I want to believe it) STM32F108CB with the same result. Ensure to have latest library version, latest core version and latest STM32CubeProgrammer as you used SWD.. Latest versions I've tested with different setup, USB enabled or not,... all works. My test: 1) Run an example with LowPower.sleep(). (it works) 2) Run an example with LowPower.deepSleep(). (Now, this not woks for me...) 3) Reset. (still not working for me) 4) Power down and power on. (Now, it works).
Moreover it seems strange using HAL_SuspendTick allows to work as the deepSleep disable the irq before entering in low power. It's strange, but thank you very much for your support.
I've made the same test than you and it works. I've tested with several BluePill, MapleMini and STM32F103ZE and all works. So I have no more clue except if it is a clone and in that case could explain why it does not work. You could try to ask on the forum maybe someone already met this issue. I close it as it works.
Hi, I am working with deepSleep in a BluePill and I have notice that it takes effect only after a power down. Procedure: 1) BluePill power on from St-Link. 2) Clear flash memory 3) Program deepSleep example and does not take effect. 4) Power down: Switch off and switch on St-link . After that it takes effect. Thank you