AnsweredAssumed Answered

Wakeup Standby from WKUP pin AND RTC Timer

Question asked by yoann.guerin on Jul 22, 2016
Hello,
I have problem to wake up from standby mode.
I ma working on STM32L162, WKUP2 is on PC13
I succeed to wake from RTC timer or with the WKUP2 pin individually on my board, but when i want to be wake from one or the other i have problem.
I can be wake from WKUP pin when i am in standby but not with the RTC. After the delay of RTC timer passed i can't be wakeup from WKUP it's seems that there a conflict maybe on the interrupt...
My code is below, i comment "HAL_RTCEx_SetWakeUpTimer_IT" to be wake from WKUP and "HAL_PWR_EnableWakeUpPin" to be wake from RTC timer (timeout is 10s)

void enter_standby_mode(void)
{
    /* RTC configuration */ 
    RTCHandle.Instance = RTC; 
    RTCHandle.Init.HourFormat = RTC_HOURFORMAT_24;
    RTCHandle.Init.AsynchPrediv =0x7F;   // LSE as RTC clock: RTC_ASYNCH_PREDIV
    RTCHandle.Init.SynchPrediv =  0x00FF; // LSE as RTC clock: RTC_SYNCH_PREDIV;
    RTCHandle.Init.OutPut = RTC_OUTPUT_DISABLE;
    RTCHandle.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
    RTCHandle.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
     
    /* Disable Wake-up timer */
    HAL_RTCEx_DeactivateWakeUpTimer(&RTCHandle);
   
    /* Clear PWR wake up Flag */
    __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
 
    /* Clear RTC Wake Up timer Flag */
    __HAL_RTC_WAKEUPTIMER_CLEAR_FLAG(&RTCHandle, RTC_FLAG_WUTF);
 
    /* Setting the Wake up time */
    HAL_RTCEx_SetWakeUpTimer_IT(&RTCHandle, 0x000A, RTC_WAKEUPCLOCK_CK_SPRE_16BITS);
     
    /* Set WKUP2 as Wake Up pin */
    HAL_PWR_EnableWakeUpPin(0x0200);
     
    __HAL_PWR_CLEAR_FLAG(PWR_FLAG_WU);
     
    /* Request to enter STANDBY mode */
    HAL_PWR_EnterSTANDBYMode();    
}

Did someone already succeed to be wake from different potential source ?
Thanks

Outcomes