cancel
Showing results for 
Search instead for 
Did you mean: 

fix STM32f103 __WFI function gives hardfault_handler

JHemb.1
Associate II

Hello,

I enter stop mode using HAL_PWR_EnterSTOPMode and the processor come out of this function immediately and does not wait for any external interrupt. can someone help me on this?

1 ACCEPTED SOLUTION

Accepted Solutions

I had examples on the F1 a decade ago, kind of moved on since then.

You might want to glance over the assorted examples in the CubeF1 trees

STM32Cube_FW_F1_V1.8.2\Projects\STM32F103RB-Nucleo\Examples\RTC\RTC_Alarm

STM32Cube_FW_F1_V1.8.2\Projects\STM32VL-Discovery\Examples\PWR\PWR_SLEEP

STM32Cube_FW_F1_V1.8.2\Projects\STM32VL-Discovery\Examples\RTC\RTC_LowPower_STANDBY

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

View solution in original post

5 REPLIES 5
Imen.D
ST Employee

Hello @JHemb.1​ ,

Without entering stop mode, does the interrupt trigger?

Make sure to use latest release of STM32CubeF1 MCU package, and have a look to the errata sheet related to the STM32F103 devices, to check if you have the same conditions as described:

0693W000008xZ3eQAE.jpgPlease keep me informed about your progress on this.

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

It doesn't have to be an external interrupt, could be any interrupt, so SysTick or whatever.

Also probably not something you want to single-step in a debugger.

Look at what's actually FAULTING, is it some other interrupt with expectation of structures being set up? A missing handler for a different interrupt, EXTI, RTC, or whatever?

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

Hello ,

Thank you so much for your reply. We are using the stop mode and your solutions works for sleep mode. I want to wait for an interrupt when I enter HAL_PWR_EnterSTOPMode function. But I am not successfull in achieving this.

Hello,

Thank you so much for your reply. In our case it is an external interrupt on pin PA10. My application should be like, When I am waiting for 2 or 3 minutes, then it should goto a Timer/RTC Alarm IRQ handler,

When we press the button on PA10, it should come out of the stop mode and also simultaneously come out of the IRQ handler.

Could you please provide any sample code or any reference which has a sample implementation?

I had examples on the F1 a decade ago, kind of moved on since then.

You might want to glance over the assorted examples in the CubeF1 trees

STM32Cube_FW_F1_V1.8.2\Projects\STM32F103RB-Nucleo\Examples\RTC\RTC_Alarm

STM32Cube_FW_F1_V1.8.2\Projects\STM32VL-Discovery\Examples\PWR\PWR_SLEEP

STM32Cube_FW_F1_V1.8.2\Projects\STM32VL-Discovery\Examples\RTC\RTC_LowPower_STANDBY

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