cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L0 STOP and STANDBY mode.

Xenon02
Senior

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. 

 
 

 

 

13 REPLIES 13

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. 

Also look what I've found :

Xenon02_0-1730581467496.png

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 

Xenon02_1-1730581667683.png

While Sleep mode has a table when RAM is off

Xenon02_2-1730581721175.png

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. 

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.