Skip to main content
gil_dobjanschi
Senior
Apr 23, 2026 1:39 PM UTC
Solved

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

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

STackPointer64Best answer
ST Employee
Apr 23, 2026 1:47 PM UTC

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.

3 replies

STackPointer64Best answer
ST Employee
Apr 23, 2026 1:47 PM UTC

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
Senior
Apr 23, 2026 1:53 PM UTC

Thank you @STackPointer64,

Much appreciated!

-Gil

mƎALLEm
ST Technical Moderator
Apr 23, 2026 1:54 PM UTC

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 "Best answer" on the reply which solved your issue or answered your question.