cancel
Showing results for 
Search instead for 
Did you mean: 

Live expressions in low power mode

dev_easyli
Associate

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,

dev_easyli_0-1701942065077.png

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. 

dev_easyli_1-1701942462812.png

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.

dev_easyli_2-1701942689694.png

Thanks in advance for your response!  

 

 

1 REPLY 1
InsignificantBit
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.