Check if debugger is connected | S32K14x

cancel
Showing results for 
Search instead for 
Did you mean: 

Check if debugger is connected | S32K14x

139 Views
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

0 Kudos
2 Replies

34 Views
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 Kudos

34 Views
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 Kudos