Skip to main content
Sheller
Visitor II
February 1, 2023
Question

STM32U5 sometimes does not reconfigure IWDG.

  • February 1, 2023
  • 1 reply
  • 1247 views

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 topic has been closed for replies.

1 reply

Mohamed Aymen HZAMI
ST Employee
February 21, 2023

Hello @Sheller​ and welcome to the community,

Can you please share your code ?

Aymen