Skip to main content
Visitor II
August 3, 2021
Question

Detect STLink connection

  • August 3, 2021
  • 2 replies
  • 1327 views

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?

    This topic has been closed for replies.

    2 replies

    Graduate II
    August 4, 2021

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

    Ade1Author
    Visitor II
    August 4, 2021

    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