Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 5 months ago.
Wake up from standby mode in Nucleo L053R8
I need to reduce the comsuption to the minimum when the board is not communicating. For that, I want to use the standby mode from the Nucleo L053R8 board (using the HAL_PWR_EnterSTANDBYMode() function) instead of the default deepsleep fuction.
I was using the WakeUp library from Erik Olieman, and the program works as expected with the deepsleep fuction:
int main() { int i = 0; while(1){ printf("\r\n%d", i); WakeUp::set(5); deepsleep(); i++; } }
The problem is that after replacing the deepsleep fuction with the HAL_PWR_EnterSTANDBYMode() function, the board doesn't work as expected after waking up, because it restarts and the next times doesn't sleep:
int main() { int i = 0; while(1){ printf("\r\n%d", i); WakeUp::set(5); HAL_PWR_EnterSTANDBYMode(); i++; } }
Can anybody explain me how can I wake up from the standby mode with an RTC alarm?
1 Answer
8 years, 4 months ago.
If you check the reference manual of your device, it says:
Quote:
The Standby mode allows to achieve the lowest power consumption. It is based on the Cortex®-M0+ Deepsleep mode, with the voltage regulator disabled. The VCORE domain is consequently powered off. The PLL, the MSI, the HSI16 oscillator and the HSE oscillator are also switched off. SRAM and register contents are lost except for the RTC registers, RTC backup registers and Standby circuitry
So Standby mode powers of also the memory, which means it is supposed to restart after an RTC interrupt. I don't know directly why it only works the first time for you, but in general looking at your program this will not do what you expect it to do: It will not continue running your program and nicely counting. You could make that by writing 'i' to one of the backup registers which are always powered, but in general I would just stick to deepsleep. Assuming deepsleep is properly implemented the absolute difference in supply current is really low. Generally speaking such 32-bit MCUs designed for low-power should be able to roughly be in deepsleep for 10 years on a single coin cell battery.