cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U083 Threadx RTC Alarm STOP2 wakeup Hard Fault

bushbum
Associate II

I am looking for any advice to do with running the RTC Alarm as a wakeup source from STOP2 mode under ThreadX.
I have used the Alarm many times before on different STM MCUs without any issues.

1) Setting up the Alarm and using it within a WFI  test loop without Theadx works perfectly, however the moment I use Threadx to wake from WFI I get an immediate hard-fault. No further code is executed, WFI -> hard-fault handler.

2) I have other wakeup sources enabled, EXTI interrupts from GPIOs and that works fine. The problem is solely related to the RTC interrupt when whatever the Threadx wakeup situation is.


3) I configured the Threadx Scheduler in ISR and Tread mode to see if it makes a difference -> Noop.4) I also tried waking from WFE within Threadx, using EXTI line 18 as per RM, had to set the ALARAIE bit but disabled the the RTC interrupt on the NVIC. Still hard-fault. Without setting ALARAIE no wakeup occurred.
Not sure if that is the right way to go, seems counterintuitive to having to enable the ALARAIE while trying to avoid using interrupts... (I have not yet verified this independently in a test loop).

4) Letting the full application run, with the Threadx WFI instruction disabled (e.g. Threadx does not sleep but runs in the idle loop), the Alarm Interrupt works fine too

4) Threadx Setup: Low power, Tickless, using the Sleep Enter and Sleep Exit functions.

5) Also, I have not used Threadx before, only FreeRTOS (including the RTC Alarm).
That is why I think the quirk lies somewhere there in the Threadx setup. 
All the sleep preps have to be made manually like disabling the Systick else its also causing an immediate Hard-fault.

I am definitely ready for some fresh ideas :)  Thank you.

 

   

 

3 REPLIES 3
Sarra.S
ST Employee

Hello @bushbum,

Will you be able to share your project so we can try and reproduce/debug the issue from our side? 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hi @Sarra.S . Thank you for responding. I will make a smaller build and share it with you.

Hi Sarra, I have put together a small demo project which I have attached. Thank you.