Question
STM32F10x entering standby mode fails occasionally
Posted on October 28, 2016 at 02:11
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 modevoid 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 */&sharpif defined ( __CC_ARM ) __force_stores();&sharpendif /* Request Wait For Interrupt */ __WFI();} #stm32f10x #standbymode