Hello Ruben Jonsson:
The ARM register DHCSR should help you to achieve what you need. See the next discussion about the same topic:
Flag Status: SRS1_JTAG
Best regards!
Jorge Gonzalez
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------