2026-04-23 6:39 AM - last edited on 2026-04-23 6:54 AM by Sara BEN HADJ YAHYA
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
Solved! Go to Solution.
2026-04-23 6:47 AM
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.
Best regards,
2026-04-23 6:47 AM
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.
Best regards,
2026-04-23 6:53 AM
2026-04-23 6:54 AM - edited 2026-04-23 7:08 AM
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:
Edit:
For HAL2 use HAL_DBGMCU_TIMx_Freeze() where x is the timer number.