AnsweredAssumed Answered

Stm32L151 wakeup from standby mode, it no longer works correctly

Question asked by cat.tom.002 on Jan 11, 2016
Latest reply on Jan 12, 2016 by FTITI.Walid
I'm using the STM32CUBE to generate codes, HSI is used as chip's PLL clock source and the LSI is used as RTC's clock source. RTC is configured to wakeup the chip every 60 seconds. 
When the chip powered up, it entered into standby mode.
The next, RTC wakeup the chip, but it won't enter into standby mode again. It seems nothing is works correctly except GPIO. What should I do after it wakeup from standby mode?

/* RTC init function */
void MX_RTC_Init(void)
{


  RTC_TimeTypeDef sTime;
  RTC_DateTypeDef sDate;


    /**Initialize RTC and set the Time and Date 
    */
  hrtc.Instance = RTC;
  hrtc.Init.HourFormat = RTC_HOURFORMAT_24;
  hrtc.Init.AsynchPrediv = 127;
  hrtc.Init.SynchPrediv = 255;
  hrtc.Init.OutPut = RTC_OUTPUT_DISABLE;
  hrtc.Init.OutPutPolarity = RTC_OUTPUT_POLARITY_HIGH;
  hrtc.Init.OutPutType = RTC_OUTPUT_TYPE_OPENDRAIN;
  HAL_RTC_Init(&hrtc);


  sTime.Hours = 0x0;
  sTime.Minutes = 0x0;
  sTime.Seconds = 0x0;
  sTime.TimeFormat = RTC_HOURFORMAT12_AM;
  sTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE;
  sTime.StoreOperation = RTC_STOREOPERATION_RESET;
  HAL_RTC_SetTime(&hrtc, &sTime, FORMAT_BCD);


  sDate.WeekDay = RTC_WEEKDAY_MONDAY;
  sDate.Month = RTC_MONTH_JANUARY;
  sDate.Date = 0x1;
  sDate.Year = 0x15;


  HAL_RTC_SetDate(&hrtc, &sDate, FORMAT_BCD);


    /**Enable the WakeUp 
    */
  HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, RTC_WAKEUP_COUNTER, RTC_WAKEUPCLOCK_CK_SPRE_16BITS);
     RTC->ISR &= (~RTC_ISR_WUTF);
}

void EnterStopMode(void){
     #if !defined( BASE_STATION )
     if((MainState & (MainState_AcOk | MainState_Charging)) == 0){
          MainState = (MainState_TypeDef)((MainState & 0xff00) | MainState_Stop);
          key_exti();          
          HAL_PWR_EnterSTANDBYMode();
     }
     #endif
}

Outcomes