Skip to main content
Graduate II
December 11, 2023
Question

CoreDebug->DEMCR default value

  • December 11, 2023
  • 2 replies
  • 2223 views

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 ?
    This topic has been closed for replies.

    2 replies

    Super User
    December 12, 2023

    > 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.

    Luke_abcAuthor
    Graduate II
    December 12, 2023

    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 ?

    Graduate II
    December 12, 2023

    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.

    Luke_abcAuthor
    Graduate II
    December 12, 2023

    Thank you @TDK  and @Tesla DeLorean  for your answers