2024-11-02 05:30 AM - last edited on 2024-11-02 07:34 AM by Andrew Neil
I have some questions.
I read that STOP mode has a "RAM retention", so when it wakes up it the whole data is still intact (not cleared).
When the RAM retention is off then the data is gone when it goes to STOP mode. So when it Wakes up does it restart the whole program and starts from the beginning ? Initializes all GPIO, peripherals, basically starts the program from includes down to the main loop.
Standby mode is similar to no Ram retention STOP mode as I interpreted it correctly. That is start the whole program again.
I have a problem understanding what STOP and STANDBY modes do when STOP mode has no RAM retention on.
And what each of these STOP modes does because I don't know which one is without RAM retention.
2024-11-02 11:29 AM
Try reference manual Ultra-low-power STM32L0x1 advanced Arm®-based 32-bit MCUs - Reference manual
all important info
2024-11-02 12:10 PM
Then why in the website it was said that RAM retention can be turned off ?
And if some STOP mode can disable RAM then what happens if EXTI want's to do the callback and there is a variable that was cleared and uninitialized ?
Lastly does HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI); does it also turn off BOR and PVD ? or do I have to do it on my own ? And also turn it on, on my own ?
I'll give your solution as the answer.
2024-11-02 02:15 PM
Also look what I've found :
It says about Flash memory and RAM being stopped. So if RAM is turned off then all the data in RAM is cleared in SLEEP mode ?
How it works when it wakes up ? It should start from where it Sleep mode was turned on, but RAM is cleared, there is no variables initialized there are no stack which says where we ended in the code, if there was a callback how it works when RAM is cleared ?
I am completely a newbie but I am curious.
PS.
The STOP mode only contains this data without LP
While Sleep mode has a table when RAM is off
Can the code work not knowing when it ended ? So it must start from the beginning without the restart like in STANDBY.
I am confused how no RAM works in practice. When variables are cleared, stack is cleared (stack has the what part of the code is now executing or where it ended). it is all in RAM.
There is also an option to turn off only FLASH and this either I don't know what will result if I turn it off and then I wake up from SLEEP mode. What happens then.
2024-11-03 01:24 AM
Forget for RAM is cleared in any mode except STANDBY and SHUTDOWN .
Your red text is two sentence 1. code run from RAM 2. FLASH is off
For example you have batery app and require run som code at low power, then you place code in RAM and switch FLASH off. In this state your code can switch between RUN SLEEP usw.
After wake RAM is ok and have variables and stack...
You seems missunderstand RTC with 8k retention, but this is sentence when MCU is only on Vbat and STOP ...
For newbie this is advanced lessons.