cancel
Showing results for 
Search instead for 
Did you mean: 

STM32U5 sometimes does not reconfigure IWDG.

Sheller
Associate

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.

This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Mohamed Aymen HZAMI
ST Employee

Hello @Sheller​ and welcome to the community,

Can you please share your code ?

Aymen