Skip to main content
SMoon.2
Associate III
March 23, 2022
Solved

Unable to freeze IWDG during debugging using SEGGER j-link (STM32L053)

  • March 23, 2022
  • 1 reply
  • 1656 views

I've configured IWDG for my application (STM32L053). When I've halted the application during debugging, the IWDG is still triggering resets. I'm using a SEGGER j-link.

I've attempted to use the __HAL_DBGMCU_FREEZE_IWDG() macro, but it doesn't seem to have any affect. I've also tried to write to the register directly:

*((volatile int *)(0xE0042008)) |= (1 << 12);

When I check in the SFR view for APB1_FZ, the DBG_IWDG_STOP value never changes.

I can disable initializing the IWDG when debugging, but that isn't ideal. Any help?

This topic has been closed for replies.
Best answer by SMoon.2

Issue was DBGEN bit 22 in the RCC_APB2ENR register must be set to enable the DBG clock before writing to the DBG_APB1_FZ register.

Once the bit was set I was able to use __HAL_DBGMCU_FREEZE_IWDG() to set the DBG_IWDG_STOP bit and watchdog successfully froze while application was halted.

1 reply

SMoon.2
SMoon.2AuthorBest answer
Associate III
April 5, 2022

Issue was DBGEN bit 22 in the RCC_APB2ENR register must be set to enable the DBG clock before writing to the DBG_APB1_FZ register.

Once the bit was set I was able to use __HAL_DBGMCU_FREEZE_IWDG() to set the DBG_IWDG_STOP bit and watchdog successfully froze while application was halted.