Debug works at first, but fails after a few debug cycles

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

Debug works at first, but fails after a few debug cycles

跳至解决方案
975 次查看
deniscollis
Contributor V

Setup:

  • MCUXpresso IDE v11.7.1 [Build 9221] [2023-03-28]
  • Custom Kinetis K82 board
  • Segger J-Link Base

Debug works after freshly powering up my workstation and board, connecting the debug probe, launching MCUXpresso with my project, and hitting 'Debug' in the Quickstart panel.

However, the debug environment fails after a few debug cycles. (Powering everything down and starting up again fixes it.)

Symptom 1:  Breakpoints are no longer honored, including the auto-breakpoint at the first executable statement in main().

Symptom 2: Some unnamed thread is running, and file 'startup_mk82f25615.c' pops into focus, positioned at function RsetISR()

deniscollis_0-1683309811585.png

Symptom 3: The application is not running (Its blinking LED remains off). If terminate the debug session the application remains stalled. But if I reset the board the application runs normally.

I normally have Semihosting active, but deactivating it does not fix the issue.

Can anyone cast some light onto this?

Denis

0 项奖励
回复
1 解答
954 次查看
deniscollis
Contributor V

Resetting the board and clicking on [Clean Up Debug] after each debug cycle seems to work, but see the Deeper Dive below for the real reason.

deniscollis_1-1683563889454.png

 

Edit: Deeper dive.

This device has a PN5190 NFC that uses PTA4 NMI for its IRQ.  However, this pin's state is integral to the default system reset and startup, as defined in the Flash Config in startup_mk82F25615.c. 

Startup execution after reset fails because of misconfigured FOPT config in the Flash Config. The SDK's template startup_mk82f25615.c Flash Config FOPT config has 'NMI reset enabled', and 'boot source ROM'.  Change this to 'NMI reset blocked' and 'boot source internal flash' will return the board to a stable, debuggable state.  

The reason it works after a POR reset is that at POR the FOPT to 0xFFFF, before the is has been set by the Flash Config in the startup code.

 

 

在原帖中查看解决方案

0 项奖励
回复
1 回复
955 次查看
deniscollis
Contributor V

Resetting the board and clicking on [Clean Up Debug] after each debug cycle seems to work, but see the Deeper Dive below for the real reason.

deniscollis_1-1683563889454.png

 

Edit: Deeper dive.

This device has a PN5190 NFC that uses PTA4 NMI for its IRQ.  However, this pin's state is integral to the default system reset and startup, as defined in the Flash Config in startup_mk82F25615.c. 

Startup execution after reset fails because of misconfigured FOPT config in the Flash Config. The SDK's template startup_mk82f25615.c Flash Config FOPT config has 'NMI reset enabled', and 'boot source ROM'.  Change this to 'NMI reset blocked' and 'boot source internal flash' will return the board to a stable, debuggable state.  

The reason it works after a POR reset is that at POR the FOPT to 0xFFFF, before the is has been set by the Flash Config in the startup code.

 

 

0 项奖励
回复