How to reset when a hardfault is triggered?

Since the Watchdog timer cannot be triggered in the case of some errors such as hardfault.
Is there a way to reset bw16 when entering a hardfault?

Hi @AlanWL ,

By default, once program enter hardfault handler, there is no way to reset it via software, it has to be reset via hardware.

However, if you wish to alter how hardfault handler works, then you have to move on to Realtek standard SDK and edit the standard hardfault handler, probably adding a software reset code inside the handler, so that next time it hardfault, program will automatically reset it self, after printing out the error msg.

Hi @xidameng ,
May I ask you which file of the standard SDK the hardfault handler is modified in?
Thank you.

You probably can not access that file using the open-source SDKs

Hi @xidameng ,
How can I get permission to modify?
Thank you.

Normally, it requires signing of a NDA with the vendor(Realtek), for more information, check out this link,