Hello Mark,
in debug mode, we can detect clock on SWD_CLK pin. while in run mode there is not.
so one idea is to use a free GPIO connect SWD_CLK, set this GPIO as input. use this GPIO detect if SWD_CLK has clock. if yes, it's debug mode. otherwise, it's run mode.
Have a great day,
Zhang Jun
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------