RESET MCU WHEN HARDFAULT

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

RESET MCU WHEN HARDFAULT

Jump to solution
360 Views
QuocHuyUT
Contributor I

Hello, I want my MCU will auto reset when Hardfault for avoid stuck. My mcu is #MCXC144vft ide is @MCUXpresso , any solutions for this? Thanks so much

Labels (1)
0 Kudos
Reply
1 Solution
311 Views
Celeste_Liu
NXP Employee
NXP Employee

Hello @QuocHuyUT ,

Thanks for your post.  You can customize the HardFault_Handler() function in the SDK's startup_mcxc144.c file.

Celeste_Liu_1-1751876023664.png

Add some code to detect the source of the Hard Fault (please refer to Debugging Hard Faults on ARM Cortex-M | MCU on Eclipse and McuLib/src/McuHardFault.c at master · ErichStyger/McuLib · GitHub.), and then add the system reset trigger function NVIC_SystemReset().

Celeste_Liu_0-1751875288880.png

 

 

Hope it can help you.

BRs,

Celeste

 

---------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the "ACCEPT AS SOLUTION" button. Thank you!
---------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
1 Reply
312 Views
Celeste_Liu
NXP Employee
NXP Employee

Hello @QuocHuyUT ,

Thanks for your post.  You can customize the HardFault_Handler() function in the SDK's startup_mcxc144.c file.

Celeste_Liu_1-1751876023664.png

Add some code to detect the source of the Hard Fault (please refer to Debugging Hard Faults on ARM Cortex-M | MCU on Eclipse and McuLib/src/McuHardFault.c at master · ErichStyger/McuLib · GitHub.), and then add the system reset trigger function NVIC_SystemReset().

Celeste_Liu_0-1751875288880.png

 

 

Hope it can help you.

BRs,

Celeste

 

---------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the "ACCEPT AS SOLUTION" button. Thank you!
---------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply