cancel
Showing results for 
Search instead for 
Did you mean: 

Enter and Exit from stop mode for stm32f103

JHemb.1
Associate II

Hello,

For my project, I would like to enter and exit from stop mode. My intended application would be something like, the processor should wait for 1 or 2 minutes with RTC Alarm and it should wakeup if ther is any external interrupt or if there is no external interrupt then it should come out of RTC alarm handler.

If anybody is facing the similar issue, please write me on this issue as soon as possible.

3 REPLIES 3
Bouraoui Chemli
ST Employee

Hi @JHemb.1​ 

You can refer to RTC alarm example provided in STM32CubeF1 firmware via this path STM32Cube\Repository\STM32Cube_FW_F1_V1.8.3\Projects\STM32F103RB-Nucleo\Examples\RTC

Also, you can refer to application note AN2629 "STM32F101xx, STM32F102xx and STM32F103xx low-power modes"

Bouraoui

JHemb.1
Associate II

Hello Mr. Chemli,

Thank you so much for your quick reply. I have seen the application note, AN2629 and I feel I am implementing similar. If possible, could you please help me to solve my problem, my code looks like this :

     HAL_SuspendTick();

     __HAL_RCC_PWR_CLK_ENABLE();

     /*** enable sleep on exit for interrupt only operations ****/

     HAL_PWR_EnableSleepOnExit();

    /*** ENTER THE STOP MODE ****/

    HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);

Inside, this function, there is another funciton called __WFI(); and when the compiler reaches this point, it gives me Hardfault_Handler(), could you please tell me what could be the error ?

https://community.st.com/s/question/0D53W00000etLsfSAE/fix-stm32f103-wfi-function-gives-hardfaulthandler

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..