0

I have to enable IWDG on my STM32 based project. It doesn't work properly as I expect to. Below is the code which CubeMX created.

  hiwdg.Instance = IWDG;
  hiwdg.Init.Prescaler = IWDG_PRESCALER_8;
  hiwdg.Init.Window = 4095;
  hiwdg.Init.Reload = 49;
  if (HAL_IWDG_Init(&hiwdg) != HAL_OK)
  {
    Error_Handler();
  }

I'm using STM32F030K6T6 for this project and when I don't refresh the timer, I expect a reset after a timeout, right?

But I don't even put the Refresh function line in the code and there is no reset on my board. I put a delay at the beginning to notice the reset but there is no one.

Do you guys guess it can be a bug in STM32CubeIDE? (As I am using this IDE)

I would appreciate your help.

K3IV4N
  • 3
  • 3
  • Are you trying to use window functionality or not? Window functionality is the one where if you reset the countdown too early, it will also reset the system. – Ilya Jul 13 '23 at 09:04
  • @Ilya No I don't. The reference manual suggested setting it to the maximum value if we don't use it. Besides, I don't reset the timer at all. I leave the code as it is to see if the watchdog resets the system, but there is no reset by the watchdog. (At the end, the watchdog doesn't work) – K3IV4N Jul 13 '23 at 10:18
  • Are you running with the debugger? That can (optionally) pause the watchdog if you are sitting stopped at a breakpoint or such like. – pmacfarlane Jul 13 '23 at 14:52
  • @pmacfarlane No I don't use debugger. I just program the microcontroller and sit to see the results. Nothing happens. – K3IV4N Jul 14 '23 at 15:05
  • Is your code (or the autogenerated code) enabling the LSI clock, using the `LSION` bit of `RCC_CSR`? – pmacfarlane Jul 14 '23 at 16:14
  • Yes, @pmacfarlane. Unfortunately it turns on the LSION bit. – K3IV4N Jul 14 '23 at 16:59
  • There is a "Key Register" in IWDG, and when I write to it, (0x0000AAAA or other values) the value doesn't stay in it, and it shows empty. When writing on the other registers they stay, and we can see the changed value but this one gets nothing. Is it supposed to be like this? – K3IV4N Jul 14 '23 at 17:08
  • Yes. From the reference manual: "Bits 15:0 KEY[15:0]: Key value (write only, read 0x0000)" – pmacfarlane Jul 14 '23 at 17:34

0 Answers0