Showing results for 
Search instead for 
Did you mean: 

Live expressions in low power mode


Hi everyone,

I am using a STM32L431 in my project and I am running into an unexpected behavior when debugging it. For context, I have an enum variable (lets say x_state) that represents different states in the logic. I have added this variable to the live expressions window in debug mode to observe the transitions of states. Additionally, the MCU is put in sleep mode when there is no interrupts for a specified duration to optimize power consumption. This is done using the following line in the code,


No matter the value of the x_state variable before entering sleep mode, the value is always reported as 0 when sleeping in the live expressions window. After exiting sleep mode, the value returns to its previous state before entering sleep. From the datasheet, the SRAM is kept on in sleep mode for the STM32L431. 


Why am I observing a 0 when in sleep mode? I am using a STLINK-V3SET as my debugger and I have "Debug in low power modes" enabled in my Debug configurations.


Thanks in advance for your response!  



ST Employee

Please notice the footnote in the table 4 that you have provided a screenshot of. SRAM1 and SRAM2 can be independently gated during runtime and sleep mode.

Please refer to description of AHB1 peripheral clocks enable in Sleep and Stop modes register (RCC_AHB1SMENR) and RCC_AHB2SMENR in the reference manual.