cancel
Showing results for 
Search instead for 
Did you mean: 

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

Yali Mobilities
Associate III

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 ( ; ; )
{
 
}
}

 

1 ACCEPTED SOLUTION

Accepted Solutions
Giuseppe DI-GIORE
ST Employee

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.

View solution in original post

1 REPLY 1
Giuseppe DI-GIORE
ST Employee

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.