Skip to main content
WSher.1
Associate III
Dec 12, 2021 5:29 PM UTC
Question

STM32WB HW_TS_RTC_Wakeup_Handler Is Generating Hard Faults Whenever Called

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! :)

This topic has been closed for replies.

3 replies

TDK
Dec 12, 2021 5:41 PM UTC

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""."
WSher.1
WSher.1Author
Associate III
Dec 12, 2021 7:52 PM UTC

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

TDK
Dec 12, 2021 8:09 PM UTC
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""."