2023-02-01 07:52 AM
At startup, I set the watchdog timer to 8 seconds.
IWDG->KR = IWDG_KEY_ENABLE;
IWDG->KR = IWDG_KEY_WRITE_ACCESS_ENABLE;
IWDG->PR = IWDG_PRESCALER_64; // 8 s
IWDG->KR = IWDG_KEY_WRITE_ACCESS_DISABLE;
Further, in the interrupt, when the button is pressed, I want to reconfigure for a shorter duration and reset the processor.
IWDG->KR = IWDG_KEY_WRITE_ACCESS_ENABLE;
IWDG->PR = IWDG_PRESCALER_32;
IWDG->RLR = 429;
while(IWDG->SR){};
IWDG->KR = IWDG_KEY_RELOAD;
while(true){}
Everything works, but sometimes the reset occurs not after 430 ms, but after 4 seconds. In this case, the desired values are written in the IWDG registers. The connected debugger does not affect the result, the same thing is repeated with and without the connected debugger.
2023-02-21 09:04 AM
Hello @Sheller and welcome to the community,
Can you please share your code ?
Aymen