Skip to main content
Visitor II
September 22, 2024
Question

STM32U083 Threadx RTC Alarm STOP2 wakeup Hard Fault

  • September 22, 2024
  • 2 replies
  • 1624 views

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.

 

   

 

    This topic has been closed for replies.

    2 replies

    ST Employee
    September 24, 2024

    Hello @bushbum,

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

    bushbumAuthor
    Visitor II
    September 24, 2024

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

    Visitor II
    December 17, 2024

    Hi, I am having the same issue, and i discovered it's not related to ThreadX itself, rather to the process of disabling interrupts before entering STOP2 mode (which is what ThreadX does). If you try a bare metal project without ThreadX but disabling the interrupts before entering STOP2 mode, it will HardFault as well. I Confirm that with a STM32L433 the issue does not happen in the same exact conditions. It's probabably related to a silicon issue of the U0.