AnsweredAssumed Answered

I can't make timer stop while debuging

Question asked by Carlos Zelayeta on Jan 9, 2017
Latest reply on Jun 19, 2017 by Valentin

Hello.

I have a problem trying to stop a timer in debug mode.

I am using a NUCLEO-F072RB. I use timer 7, one of the basic timers, to generate an interrupt.

In order to be able to stop the timer in debug, mannually with breakpoint, I set the DBGMCU_APB1_FZ as stated in the reference manual (RM0091, 32.9.4).

My code is the following:

int main(void){ 
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init(); 
/* Configure the system clock */ 
SystemClock_Config(); 
/* Initialize all configured peripherals */
MX_TIM7_Init();
/* USER CODE BEGIN 2 */
HAL_DBGMCU_EnableDBGStandbyMode();    
HAL_DBGMCU_EnableDBGStopMode();
DBGMCU->APB1FZ |= DBGMCU_APB1_FZ_DBG_TIM7_STOP;  
while (1) 
  { 
  }
}

 

When I run the debugger, none of the DBG registers changes its values and the timer doesn't stop when stopping execution.

I would like to know where the DBGMCU configuration lines should be placed, or if there is something else that needs to be configured.

 

Thanks in advance,

Carlos

Outcomes