Showing results for 
Search instead for 
Did you mean: 

Hard Fault inside a RTC_Alarm_IRQ_Handler

Associate II


I'm dealing with a problem in a STM32WB55, but the doubt is general about STM32 and FreeRTOS.

Among the different tasks initialised in my program, I have a task running that puts the MCU in STOP2 mode. In parallel there is an RTC Alarm programmed every 30 seconds, with a higher priority than the FreeRTOS one. When the MCU is in stop mode (inside the task mentioned before) and the RTC Alarm Handler jumps, sometimes I get a Hard Fault.

The question is, could it be a problem related to the task stack memory? I've read about it, and when there is a system interruption (independent of the FreeRTOS), the RAM utilisation is taken from the memory reserved to the main initialisation, is it true? Should I increase the stack size of any task?

Thank you in advance.


Is there code up at 0x084xxxxx addresses?

Look at what's actually faulting, the code and the registers. Check callbacks and pointers.​

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

The code ends at address 0x08079000, so there shouldn't be code at this address, why do you ask it?

As for the callback, it works most of the times when leaving the stop2 mode, and it never fails at the same time after power-on the device, it can be hours without failing. That's why I suspect about the stack overflow.