2023-04-20 02:18 AM
Here is what I've done:
When my microcontrollers receives a sleep request from CAN, it goes on StandbyMode as shown below:
can_lld_stop(&CANDRIVER1);
can_lld_stop(&CANDRIVER2);
SPC5_PIT0_DISABLE_CLOCK();
SPC5_CAN_SUB_0_M_CAN_1_DISABLE_CLOCK();
......
irqIsrDisable();
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
Solved! Go to Solution.
2023-09-04 01:09 AM
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
2023-09-04 01:09 AM
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
2024-06-27 06:51 PM
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.