2022-04-11 07:25 PM
Hi all,
I believe I am having a problem with the IWDG in my project. What's happening is that immediately after entering sleep mode the device wakes up again.
From the research I have done, it looks like this is inevitable, and in order to deal with it I need to check the wakeup state at the start of my code, and put it back to sleep if it was woken up by the watchdog instead of the WKUP pin being pulled high.
I am struggling to figure out how to do this within the HAL, I know it can be done, I have seen it in projects at work, but I am not a FW engineer, and that code was written with custom libraries.
Any help would be appreciated.
Cheers,
Luke
Solved! Go to Solution.
2022-04-12 05:26 AM
Check, then clear, the values of RCC->CSR. If IWDG flag was set, go back into low power mode.
int iwdg_reset = RCC->CSR & LL_RCC_CSR_IWDGRSTF;
...
if (iwdg_reset) {
// go to sleep)
}
2022-04-12 05:26 AM
Check, then clear, the values of RCC->CSR. If IWDG flag was set, go back into low power mode.
int iwdg_reset = RCC->CSR & LL_RCC_CSR_IWDGRSTF;
...
if (iwdg_reset) {
// go to sleep)
}
2022-04-23 01:14 PM