2023-12-11 06:31 AM - edited 2023-12-11 02:17 PM
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.
2023-12-11 05:48 PM
> 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.
2023-12-12 02:01 AM
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 ?
2023-12-12 02:08 AM
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.
2023-12-12 08:15 AM
No disadvantages other than additional modest power consumption. Might interfere with putting it into sleep modes.
2023-12-12 10:25 AM
Thank you @TDK and @Tesla DeLorean for your answers