cancel
Showing results for 
Search instead for 
Did you mean: 

CoreDebug->DEMCR default value

Luke_abc
Associate III

Hi,

MCU - STM32H7

I have noticed that the CoreDebug_DEMCR_TRCENA bit in the DEMCR register is set by default if a debugger is connected. But, I need to enable it explicitly (as shown below) if the debugger is not connected.

    CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
 
I want to use cyccnt and this is the reason why I want to enable this. Can I please ask why do we need to enable this explicitly if the debugger is not connected ? Also, Is the debugger enabling CoreDebug_DEMCR_TRCENA bit implicitly ?
5 REPLIES 5
TDK
Guru

> Can I please ask why do we need to enable this explicitly if the debugger is not connected ?
Because it's disabled by default.

> Also, Is the debugger enabling CoreDebug_DEMCR_TRCENA bit implicitly ?
Yes.

If you feel a post has answered your question, please click "Accept as Solution".

Thank you for your reply. 

Can I please also ask if there are any disadvantages by keeping this DWT and ITM units enabled on a device on the field ?

Consumes some more power keeping the unit clocking, and having a 32-bit counter clock continously at CPU frequency. 

Debugger initialization turns on things it needs, settings it wants. ie DWT, FPB units etc, GPIO banks for PA and PB pins.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

No disadvantages other than additional modest power consumption. Might interfere with putting it into sleep modes.

If you feel a post has answered your question, please click "Accept as Solution".
Luke_abc
Associate III

Thank you @TDK  and @Tesla DeLorean  for your answers