Skip to main content
18650838102
Visitor II
January 11, 2016
Question

Stm32L151 wakeup from standby mode, it no longer works correctly

  • January 11, 2016
  • 1 reply
  • 671 views
Posted on January 11, 2016 at 04:11

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

}
    This topic has been closed for replies.

    1 reply

    Walid FTITI_O
    Visitor II
    January 12, 2016
    Posted on January 12, 2016 at 14:13

    Hi cat.tom.002,

    I recommend that you take a look to this [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32F437%20exiting%20standby%20incorrectly&currentviews=63]discussion which talks about a similar use case.

    As mentioned, you can be inspired form AN4538 ''“Power consumption optimization with STM32F3xx microcontrollers “ at this

    http://www.st.com/web/en/resource/technical/document/application_note/DM00121474.pdf

    which can help you a lot in your hole application. You find AN4538 firmware at this

    http://www.st.com/web/en/catalog/tools/FM147/CL1794/SC961/SS1743/LN1734/PF257872

    .

    -Hannibal-