cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WB HW_TS_RTC_Wakeup_Handler Is Generating Hard Faults Whenever Called

WSher.1
Associate II

Hello! I'm trying to run the BLE Heart Rate application on my STM32WB.

I followed the guides and YT videos, but whenever the HW_TS_RTC_Wakeup_Handler interrupt is triggered, the device goes into a Hard Fault state at ' __HAL_RTC_WRITEPROTECTION_DISABLE( phrtc );'

I've tried several things to get the fault to clear such as replacing '_HAL_RTC_WRITE...' with 'LL_RTC_DisableWriteProtection(RTC); // This works! but then a hard fault is generated at '_HAL_RTC_WAKEUPTIMER_DISABLE'

I'm not quite sure, but I have a sneaky suspicion that that the phrtc pointer may not be correct...

Has anyone run into this issue before? I also tried disabling RTC tamper, but this causes the interrupt to just never be called.

Thanks! 🙂

3 REPLIES 3
TDK
Guru

Debug your program and see where phrtc points when __HAL_RTC_WRITEPROTECTION_DISABLE is called.

If you feel a post has answered your question, please click "Accept as Solution".

Yep, it's an empty pointer... I'm confused as to why though.

Sounds like a bug in your program.
Set up a watchpoint on the pointer location and see what changes it. Ensure it’s initialized correctly in the first place.
If you feel a post has answered your question, please click "Accept as Solution".