Skip to main content
gil_dobjanschi
Associate II
April 23, 2026
Solved

Is there a way in MX2 to enable/disable timer freezing during debugging?

  • April 23, 2026
  • 3 replies
  • 121 views

Hello,

 

Is there a setting in MX2 to enable/disable timer freezing during debugging? If not, what HAL APIs can be used for this purpose?

 

Thank you,

Gil

Best answer by STackPointer64

Hello,

It is not available in MX2. It needs to be configured manually in the debug register, DBGMCU_APB1LFZR, in particular. I invite you to check the reference manual, page 2543.

STackPointer64_0-1776951981484.png

Best regards,

3 replies

STackPointer64Best answer
Technical Moderator
April 23, 2026

Hello,

It is not available in MX2. It needs to be configured manually in the debug register, DBGMCU_APB1LFZR, in particular. I invite you to check the reference manual, page 2543.

STackPointer64_0-1776951981484.png

Best regards,

To improve visibility of answered topics, please click 'Accept as Solution' on the reply that resolved your issue or answered your question.
gil_dobjanschi
Associate II
April 23, 2026

Thank you @STackPointer64,

Much appreciated!

-Gil

mƎALLEm
Technical Moderator
April 23, 2026

Hello,

You need to use DBGMCU block and call call __HAL_DBGMCU_FREEZE_TIMx() to freeze the timer during the debug.

If you re using TIM1 so call  __HAL_DBGMCU_FREEZE_TIM1().

DBGMCU_APBxy register:

mALLEm_0-1776952815071.png

mALLEm_1-1776952888323.png

Edit:

For HAL2 use HAL_DBGMCU_TIMx_Freeze() where x is the timer number.

 

"To give better visibility on the answered topics, please click on ""Accept as Solution"" on the reply which solved your issue or answered your question."