STM32 MCUs contain a feature called debug freeze. You can stop several peripheral devices, including I2C, RTC timeouts and, of course, a watchdog timer.
For STM32 Reference Manual, see 38.16.4ff.
IWDG runs on the APB1 bus. Therefore, you need to change DBGMCU_APB1_FZ , most specifically approve the DBG_IWDG_STOP bit in this register.
The POR value (= default value) for this register is 0x0, i.e. if you don't disable it actively, IWDG will still work.
int main() {
Please note that when you do not enable the watchdog timer in the software, it can still be enabled at the hardware level if the WDG_SW bit is reset in the flash option bytes.
If you use ST HAL (not included in ChibiOS, see STM32CubeF4 ), you can also use this macro:
__HAL_DBGMCU_FREEZE_IWDG()
(which basically does the same as we above)
In addition, you need to enable the DBGMCU clock on APB2.
__HAL_RCC_DBGMCU_CLK_ENABLE();
source share