AnsweredAssumed Answered

STM32F10x entering standby mode fails occasionally

Question asked by mukartihal.sandesh on Oct 28, 2016
Latest reply on Nov 17, 2016 by mukartihal.sandesh
We use PWR_EnterSTANDBYMode library function to enter the standby mode. I have added line to enable WKUP pin. The STM32 enters standby mode most of times. But, sometimes(once in 25 or so times), it just reaches the printf statement and prints the message on debug port. Any ideas as to what might be causing this?

I do not de-initialize the UART, I2C, ADC or SPI modules before calling enter_standby_mode function. should I be disabling the clock to these peripherals? 


//enter standby mode
void enter_standby_mode(void)
{
        PWR_EnterSTANDBYMode();
        printf("ENTERING STANDBY MODE WENT WRONG!!!\n\r"); 
}

/**
  * @brief  Enters STANDBY mode.
  * @param  None
  * @retval None
  */
void PWR_EnterSTANDBYMode(void)
{
  /* Clear Wake-up flag */
  PWR->CR |= PWR_CR_CWUF;
  /* Select STANDBY mode */
  PWR->CR |= PWR_CR_PDDS;
  /* enable WKUP pin - Added by Sandesh : 15/6/2016*/
  PWR->CSR |= PWR_CSR_EWUP;  
  /* Set SLEEPDEEP bit of Cortex System Control Register */
  SCB->SCR |= SCB_SCR_SLEEPDEEP;
/* This option is used to ensure that store operations are completed */
#if defined ( __CC_ARM   )
  __force_stores();
#endif
  /* Request Wait For Interrupt */
  __WFI();
}

Outcomes