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
liaifat85
Senior III

Different STM32 families handle RAM retention in STOP mode differently. For instance: In STM32L4 STOP0 and STOP1 retain all of the RAM, while STOP2 may power down part or all of the RAM to save power. In STM32H7 series has additional configurations with finer control over RAM banks and retention.

And how no RAM retention works ? And how to enable this option to turn of RAM retention ? 
If no RAM retention works the way that when it wakes up it restarts the whole program then it works the same like STANDBY mode which means what is the difference ? 

And the picture of a table I have sent have different STOP modes which I don't understand what effect they give in the program. 

HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

only has two options its either PWR_LOWPOWERREGULATOR_ON or PWR_MAINREGULATOR_ON, they retain the RAM so for the program it gives no difference ? The all peripherals still works the same does not need to initialize again. Only the power source is the difference I guess. 

But how to enter no RAM retention in this HAL function ? 

Xenon02
Senior

Also if STOP mode is in no RAM retention then all GPIOs and peripherals are uninitialized because the programs starts from the beginning, so how it know how to handle EXTI callback or know what EXTI is configured when it is a GPIO ? 

Xenon02
Senior

PS I'm actually using : STM32L031G6U6S
But it doesn't have this table with Voltage Regulator Mode like the one on the Main Post. Which infact doesn't tell me how to turn off RAM retention or what it exactly does.  

You miss here. Primary your table is about time to start code back from STOP...

RAM retention is irelevant here and in normal STOP usage you place requred variables into RAM with retention and all other is lost , but not require reinit or any mcu cycle.

STANDBY after wake always reset MCU by hw, STOP never or sw based. RAM is not managed with same command as STOP start...

And last info after STOP wake some reinit is required based on MCU , but allmost require reinit PLL when used.

For example if I have somewhere int x = 10; then in STOP mode when RAM retention is ON, it puts this variable into RAM by itself ? 

So in STOP mode it never restarts the MCU as I understand, I thought it does because RAM was cleared and clearing the RAM is the cause of the MCU to start over again. 

I know how to Start the STOP mode which is this command : HAL_PWR_EnterSTOPMode(), but I don't know how to turn of RAM retention or how to get the lowest power consumption in STOP mode. Which is desplayed in STM32L031G6 as : 

  • 0.38 μA Stop mode (16 wakeup lines)
  • 0.68 μA Stop mode + RTC + 8 KB RAM retention

So this with 0.38 uA turns off RTC and RAM as I understand. How to Achieve it ? I've been looking into HAL_PWR_EnterSTOPMode() and there are so many registers to set up so I didn't know what to set up and what not. 

Lastly in STOP Mode with no RAM retention when EXTI is waking up the MCU from STOP mode, it does it's EXTI callback, and if there are any variables he want's to check or modify will it be an error ??? Because it firsts do the callback then go back to the main program. 

Getting started with PWR - stm32mcu

And here pdf mistifies ... So this with 0.38 uA turns off RTC and RAM as I understand = No only RTC is off here.


@Xenon02 wrote:

PS I'm actually using : STM32L031G6U6S


That's key information - please remember to always include that from the start!

https://community.st.com/t5/community-guidelines/how-to-write-your-question-to-maximize-your-chances-to-find-a/ta-p/575228

I've added it to your post title, and added the 'STM32L0 Series' label

 

Sorry if I am annoying you because these "..." are giving me the vibe that I should have known it ;D 

So as I understand this info : 

  • 0.38 μA Stop mode (16 wakeup lines) 

Which turns off RTC and RAM is false ? It is on their website. Although if RAM was off it wouldn't make sense, because : when MCU wakes up from EXTI and EXTI has a callback it has to execute it and if there is a variable it would be an error right ? or am I wrong ?

Second thing then, what can I do to achieve 0.38uA ? I've read what you've provided. There are STOP0, STOP1 and STOP2 I don't know why STOP1 which has more peripherals active has less current consumption than STOP0 while LD is disabled in STOP1. Weird ?
Lastly, I have only one STOP mode because I only have this HAL instruction : HAL_PWR_EnterSTOPMode(). Or perhaps I am doing it wrongly because in RM I couldn't find info about STOP0,1,2. 

Thank you again for the info !