cancel
Showing results for 
Search instead for 
Did you mean: 

Detect STLink connection

Ade1
Associate II

Our hardware uses the STM32H745XI. We would like the firmware to be able to detect if it is being debugged, perhaps by detecting the presence of the debugger.

When using a JLink the DBGMCU->CR bits DBGSLPD1, DBGSTPD1 and DBGSTBD1 are set however if I use an STLink those bits are not set.

Is it possible to use DBGMCU->CR to detect the STLink is connected?

Is there another method of detecting a debugger is connected?

2 REPLIES 2
Uwe Bonnes
Principal III

You can look at the Cortex CTRLSTAT register and the SYSPWRUPACK and CDBGPWRUPACK bits.

Ade1
Associate II

Uwe set me in the right direction but it is already answered by Pavel in this question https://community.st.com/s/question/0D53W00000OSJNF/how-to-sense-jtagswd-connected