2023-12-04 10:59 AM
So, this is a weird one. We're attempting to bring up watchdog timers on both cores of our product.
We're not seeing the CM4 WWDG watchdog fire when we intentionally lock the CM4 in a while loop with no refreshes to the watchdog timer. (I haven't tried the CM7 core yet with similar code).
I understand that each core has a watchdog timer (well, two, the WWDG and the IWDG). Right now to begin with we are enabling the watchdog on only a single core, the CM4 core, like so:
We enter the while loop on one screen of our application, using just a
while (true) {}
I've verified with the debugger that we're both entering the watchdog initialization code, as well as the while loop, and let let it sit for well over ten minutes.
On a lark, I enabled the EWIMode and put a breakpoint in WWDG_IRQHandler(), and don't see that entered either.
This seems very, very weird. Am I missing something?
Solved! Go to Solution.
2023-12-04 03:06 PM - edited 2023-12-04 03:08 PM
Thanks to both of you for the suggestions!
It was actually a much dumber mistake on my part --- I was trying to enable the CM7 watchdog on the CM4 core. For the next person on the internet who runs into this, here's some code that works:
__HAL_RCC_WWDG2_CLK_ENABLE(); /* Clear reset flags in any case */ __HAL_RCC_CLEAR_RESET_FLAGS(); /* Enable system wide reset */ HAL_RCCEx_WWDGxSysResetConfig(RCC_WWDG2); // These numbers result in a timeout of about 300ms g_watchDogHandle.Instance = WWDG2; g_watchDogHandle.Init.Prescaler = WWDG_PRESCALER_128; g_watchDogHandle.Init.Counter = 0x7F; g_watchDogHandle.Init.Window = 0x7F; g_watchDogHandle.Init.EWIMode = WWDG_EWI_DISABLE; #ifdef DEBUG return; #endif HAL_WWDG_Init(&g_watchDogHandle);
2023-12-04 11:18 AM
Does the WWDG_CR register indicate that it's active? Is the counter counting down?
2023-12-04 12:22 PM
What are you doing with the NRST pin?
What's it connected too? Driven High, or driven by some other device or circuit?
2023-12-04 03:06 PM - edited 2023-12-04 03:08 PM
Thanks to both of you for the suggestions!
It was actually a much dumber mistake on my part --- I was trying to enable the CM7 watchdog on the CM4 core. For the next person on the internet who runs into this, here's some code that works:
__HAL_RCC_WWDG2_CLK_ENABLE(); /* Clear reset flags in any case */ __HAL_RCC_CLEAR_RESET_FLAGS(); /* Enable system wide reset */ HAL_RCCEx_WWDGxSysResetConfig(RCC_WWDG2); // These numbers result in a timeout of about 300ms g_watchDogHandle.Instance = WWDG2; g_watchDogHandle.Init.Prescaler = WWDG_PRESCALER_128; g_watchDogHandle.Init.Counter = 0x7F; g_watchDogHandle.Init.Window = 0x7F; g_watchDogHandle.Init.EWIMode = WWDG_EWI_DISABLE; #ifdef DEBUG return; #endif HAL_WWDG_Init(&g_watchDogHandle);