Hello,
I try to wake up my board from VLLS2 using RTC, I sart from power demo in SDK :
in main.c I do this:
SystemInit();
CLOCK_SYS_SetRtcOutSrc(kClockRtcoutSrc32kHz);
CLOCK_SYS_EnableRtcClock(0U);
RTC_HAL_Init(RTC_BASE_PTR);
if (!(RTC_HAL_IsOscillatorEnabled(RTC_BASE_PTR)))
{
BOARD_InitRtcOsc();
}
/* Enable the RTC Clock output */
RTC_HAL_SetClockOutCmd(RTC_BASE_PTR, true);
NVIC_ClearPendingIRQ(RTC_Seconds_IRQn);
INT_SYS_EnableIRQ(RTC_Seconds_IRQn);
INT_SYS_EnableIRQ(LLWU_IRQn);
while(1)
{
VLSS2();
}
void VLSS2(void)
{
volatile unsigned int dummyread;
gSecsFlag = false;
/* Write to PMPROT to allow VLLS2 power modes */
SMC_PMPROT = SMC_PMPROT_AVLLS_MASK;
/* Set the VLLSM field to 0b100 for VLLSx(for MC1)
or STOPM field to 0b100 for VLLSx (for MC2)
- Retain state of LPWUI and RUNM */
SMC_PMCTRL &= ~SMC_PMCTRL_STOPM_MASK ;
SMC_PMCTRL |= SMC_PMCTRL_STOPM(0x4) ;
/* set VLLSM = 0b10 in SMC_VLLSCTRL (for MC2) */
SMC_STOPCTRL &= ~SMC_STOPCTRL_LLSM_MASK;
SMC_STOPCTRL |=SMC_STOPCTRL_LLSM(0x2);
dummyread = SMC_STOPCTRL;
/* Set the SLEEPDEEP bit to enable deep sleep mode - enter stop mode*/
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
__WFI();
}
void RTC_Seconds_IRQHandler(void)
{
gSecsFlag = true;
//I try to blink led
}
/*!
* @brief LLW_IRQHandler that would cover the same name's APIs in startup code
*/
void LLWU_IRQHandler(void)
{
if (RTC_HAL_HasAlarmOccured(RTC))
{
RTC_HAL_SetAlarmIntCmd(RTC_BASE_PTR, false);
}
LLWU_HAL_ClearExternalPinWakeupFlag(LLWU_BASE_PTR, (llwu_wakeup_pin_t)BOARD_SW_LLWU_EXT_PIN);
}
The issue is that my board enter in VLLS2 and never wake-up , Could you please tel me about the issue in my handler configuration
Thank you for your support
Nesrine