cancel
Showing results for 
Search instead for 
Did you mean: 

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).

FCola.1
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
Erwan YVIN
ST Employee

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

 

View solution in original post

2 REPLIES 2
Erwan YVIN
ST Employee

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

 

tuananh13
Associate II

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.