RESET MCU WHEN HARDFAULT

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

RESET MCU WHEN HARDFAULT

跳至解决方案
361 次查看
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

标签 (1)
0 项奖励
回复
1 解答
312 次查看
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 项奖励
回复
1 回复
313 次查看
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 项奖励
回复