Skip to main content
Yali Mobilities
Associate III
June 26, 2023
Solved

How to detect wheather MCU is booting from power ON or wakeup from the standby mode?

  • June 26, 2023
  • 1 reply
  • 2340 views

I'm using SPC58EC80 (SPC58EC DISP). I have coded the MCU for standby mode. It's working well but I have program it like wheather the MCU is booting from power ON or from standby wakeup. I have four wakeup intterupts and I want to know which wakeup interrupt is triggered the MCU to wakeup.

#include "components.h"
#include "wkpu_lld_cfg.h"
 
 
 
void int28_irq_cb(WKPUDriver *wkpup)
{
(void)wkpup;
/* Wait the SIUL2 is ready after
the exit from the SPOP0 mode.*/
while (MC_ME.PS0.B.S_SIUL == 0U)
{
;
}
 
pal_lld_clearpad(PORT_F, PF_LED3);
}
 
/*
 * Application entry point.
 */
int main(void)
{
 
uint8_t i;
 
/* Initialization of all the imported components in the order specified in
the application wizard. The function is generated automatically.*/
componentsInit();
 
/* Switch-off all LED's.*/
pal_lld_setpad(PORT_F, PF_LED1);
pal_lld_setpad(PORT_F, PF_LED2);
pal_lld_setpad(PORT_F, PF_LED3);
 
/* Enable Interrupts */
irqIsrEnable();
 
/* Configure WKPU.*/
wkpu_lld_start(&WKPUD1, &wkpu_config_wkpu_cfg);
 
/* Wait 1,5 seconds.*/
for (i = 0 ; i < 3U; i++)
{
pal_lld_togglepad(PORT_F, PF_LED1);
osalThreadDelayMilliseconds(250);
pal_lld_togglepad(PORT_F, PF_LED2);
osalThreadDelayMilliseconds(250);
}
 
/* Move the core in STANDBY0 mode.*/
if (SPCSetRunMode(SPC5_RUNMODE_STANDBY0) == CLOCK_FAILED)
{
SPC5_CLOCK_FAILURE_HOOK();
}
 
 
/* Application main loop.*/
for ( ; ; )
{
 
}
}

 

This topic has been closed for replies.
Best answer by Giuseppe DI-GIORE

ease have a look at RGM module, FES and DES registers.

These registers are used to understand if the device is booting from a Power On Reser of a Functional/Destructive reset or from a Wakeup condition.

Regards.

1 reply

Giuseppe DI-GIORE
ST Employee
July 12, 2023

ease have a look at RGM module, FES and DES registers.

These registers are used to understand if the device is booting from a Power On Reser of a Functional/Destructive reset or from a Wakeup condition.

Regards.