2021-08-03 06:38 AM
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?
2021-08-04 05:02 AM
You can look at the Cortex CTRLSTAT register and the SYSPWRUPACK and CDBGPWRUPACK bits.
2021-08-04 07:30 AM
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