Check if debugger is connected | S32K14x

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Check if debugger is connected | S32K14x

1,736件の閲覧回数
prasanna_rawke
Contributor II

Hello guys,

I am using semihosting on S32K144 for debugging (using printf statements) in my project. I observed that when the debugger is detached, code gets stuck at 'printf'.

I want to know how to check if the debugger is connected in-code, so that i can bypass/redirect the printf to some empty function when debugger is not connected.

Regards,

Prasanna

タグ(3)
0 件の賞賛
返信
2 返答(返信)

1,630件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hello prasanna.rawke@carnot.co.in,

The debugger writes to the ARM Debug system registers

Arm®v7-M Architecture Reference Manual | Arm®v7-M Architecture Reference Manual – Arm Developer 

C1.6 Debug system registers

But as far as I know, when the debugger gets disconnected, none of them reflects that.

However, when the debugger is active, you can see it on the bus.

pastedImage_3.png

JTAG_TDI pin (PTC5) has a pullup enabled by default. 

So, when the debugger is disconnected, PTC_PDIR[5] should read high constantly. 

BR, Daniel

0 件の賞賛
返信

1,631件の閲覧回数
prasanna_rawke
Contributor II

Hi Daniel, Thanks for the solution. It worked for evaluation kit, where it uses OpenSDA for debugging. I noticed that the status of this pin does not change while debugging via SWD protocol.

With SWD debugger, I am reading the DHCSR register to check if the debugger is connected. LSB indicates if the debug mode is ON or OFF.

0 件の賞賛
返信