Skip to main content
FCola.1
Associate II
April 20, 2023
Solved

Hello everyone, I am using SPC584B70E5 microcontroller and I am trying to retain values from SRAM after waking up from Standby Mode. I am using an 8k SRAM which is always powered on (as specified in Reference Manual).

  • April 20, 2023
  • 2 replies
  • 1970 views

Here is what I've done:

When my microcontrollers receives a sleep request from CAN, it goes on StandbyMode as shown below:

  • Fisrt I disable CAN peripherals:

can_lld_stop(&CANDRIVER1);

can_lld_stop(&CANDRIVER2);

  • Then I disable clock and interrupts:

SPC5_PIT0_DISABLE_CLOCK();

SPC5_CAN_SUB_0_M_CAN_1_DISABLE_CLOCK();

......

irqIsrDisable();

  • Finally it enters in STANDBY_MODE:

if(SPCSetRunMode(SPC5_RUNMODE_STANDBY0) == CLOCK_FAILED)

{

SPC5_CLOCK_FAILURE_HOOK()

}

It wakes up when I apply a 5V on wake_up pin.

Before doing all this procedure, I have already written some data to internal SRAM.

Now when my microcontrollers wakes up, all SRAM's data are lost.

I have tried two methods:

1) I modified the linker's file as shown, in order to reserve 4 bytes for my new backupsram :

MEMORY

{

....

ram : org = 0X400A8004, len = 192k - 64k

backupram : org = 0x400A8000, len = 0x04

.....

}

//define size, start, end ( for example __backupram_end__ = ORIGIN(backupram) + LENGTH(backupram);

SECTIONS

{

......

.standbyram: ALIGN(16) SUBALIGN(16)

{

__standbyram_start__ = .;

*(.standbyram)

*(.standbyram.*)

__standbyram_end__ = .;

} > backupram

.......

}

2) I changed the same ld file but this time I tried with ".noinit" attribute:

MEMORY

{

......

NOINIT org: = 0xXXXXXX , len= 0xXXX

.....

}

SECTIONS

{

...

.noinit (NOLOAD):

{

/* place all symbols in input sections that start with .noinit */

KEEP(*(*.noinit*))

} > NOINIT

...

}

__attribute__((section(".noinit"))) volatile uint32_t var;

None of them seems to work. Could someone suggest me some tips in order to make it work.

Thanks in advance

This topic has been closed for replies.
Best answer by Erwan YVIN

Hello ,

there is an example in 56 Family. (HAL)

SPC560Dxx OS-Less STANDBY SRAM Test Application for Discovery

Check the user.ld , main.c and source folder

i think that the effort is not huge to port on 58 Family

         Best regards

                             Erwan

 

2 replies

Erwan YVIN
Erwan YVINBest answer
ST Technical Moderator
September 4, 2023

Hello ,

there is an example in 56 Family. (HAL)

SPC560Dxx OS-Less STANDBY SRAM Test Application for Discovery

Check the user.ld , main.c and source folder

i think that the effort is not huge to port on 58 Family

         Best regards

                             Erwan

 

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
Associate II
June 28, 2024

Can I ask you a few questions? You are supplying 5V to the [WAKE UP] pin. In that case, you are using the rising edge, right? Could I ask which interrupt you are using within INT0-31? I also want to wake up the system with a 5V signal using the rising edge, but I don't know which interrupt source to use.