2024-07-04 04:37 AM
Hi,
I am trying to make a program in which in the micro stm32u5 is stored in ram memory some data after activating the Sleep Mode. For this I have defined in the flash file the SRAM2 memory which is the one that is supposed to be in charge of this:
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 768K
SRAM4 (xrw) : ORIGIN = 0x28000000, LENGTH = 16K
SRAM2 (xrw) : ORIGIN = 0x20030000, LENGTH = 64K
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K
}
.ram2 (NOLOAD):
{
_sram2 = .;
*(.ram2*)
. = ALIGN(4);
_eram2 = .;
} >SRAM2
Once SRAM2 is defined, what I want to do is to save a structure that I have defined as follows:
NODEconf_TypeDef NODE_conf __attribute__((section(".ram2")));
When I run the code I can see in Memory that this structure is well stored in memory, but when I run the Standby Mode and it is awakened by the RTC alarm, all the parameters of the structure are erased.
void SLEEP_mode(void)
{
HAL_PWREx_EnableSRAM2ContentStandbyRetention(PWR_SRAM2_PAGE1_STANDBY);
HAL_PWR_EnableWakeUpPin(PWR_WAKEUP_PIN7_HIGH_3);
HAL_PWR_EnterSTANDBYMode();
}
Does anyone know if I have forgotten to configure something to keep the variable as it was?
Thanks!
2024-08-08 07:52 AM
Hello @Ifer, welcome to ST Community,
Could you check if PWR_CR1.RRSB1 bit is set?
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.