cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F767 Window Watchdog Initialize Problem (System Always Get Reset)

emirhan37
Associate II

Hi for everyone,

I try to implement window watchdog to my system. I got reset every single time during enabling watchdog in HAL_WWDG_Init() function and exactly WRITE_REG(hwwdg->Instance->CR, (WWDG_CR_WDGA | hwwdg->Init.Counter)); here.

 

These are my watchdog configuration

 

  hwwdg.Instance = WWDG;
  hwwdg.Init.Prescaler = WWDG_PRESCALER_8;
  hwwdg.Init.Window = 64;
  hwwdg.Init.Counter = 127;
  hwwdg.Init.EWIMode = WWDG_EWI_DISABLE;

 


I want to start watchdog and feed periodically but now, I just got reset and even dont even initialize successfully. It is default init function of library as you know. What should I do to successfully initialize Watchdog, feed it periodically, and ensure it runs properly?

I will be grateful for your help.

2 REPLIES 2
TDK
Guru

Here is an example WWDG usage. I'd recommend getting that up and running.

STM32CubeF7/Projects/STM32F722ZE-Nucleo/Examples/WWDG/WWDG_Example/Src/main.c at 18642033f376dead4f28f09f21b5ae75abb4020e · STMicroelectronics/STM32CubeF7

 

Unlike the IWDG, the WWDG requires you to refresh it within a particular window. If you refresh outside of that window, it will reset. In your program, how do you ensure you're refreshing within that window?

 

The code presented looks fine.

If you feel a post has answered your question, please click "Accept as Solution".

Thanks for reply.

I tried the example already but I am facing a problem in init function

 

HAL_StatusTypeDef HAL_WWDG_Init(WWDG_HandleTypeDef *hwwdg)
{
  /* Check the WWDG handle allocation */
  if (hwwdg == NULL)
  {
    return HAL_ERROR;
  }

  /* Check the parameters */
  assert_param(IS_WWDG_ALL_INSTANCE(hwwdg->Instance));
  assert_param(IS_WWDG_PRESCALER(hwwdg->Init.Prescaler));
  assert_param(IS_WWDG_WINDOW(hwwdg->Init.Window));
  assert_param(IS_WWDG_COUNTER(hwwdg->Init.Counter));
  assert_param(IS_WWDG_EWI_MODE(hwwdg->Init.EWIMode));

#if (USE_HAL_WWDG_REGISTER_CALLBACKS == 1)
  /* Reset Callback pointers */
  if (hwwdg->EwiCallback == NULL)
  {
    hwwdg->EwiCallback = HAL_WWDG_EarlyWakeupCallback;
  }

  if (hwwdg->MspInitCallback == NULL)
  {
    hwwdg->MspInitCallback = HAL_WWDG_MspInit;
  }

  /* Init the low level hardware */
  hwwdg->MspInitCallback(hwwdg);
#else
  /* Init the low level hardware */
  HAL_WWDG_MspInit(hwwdg);
#endif /* USE_HAL_WWDG_REGISTER_CALLBACKS */

  /* Set WWDG Counter */
  WRITE_REG(hwwdg->Instance->CR, (WWDG_CR_WDGA | hwwdg->Init.Counter));

  /* Set WWDG Prescaler and Window */
  WRITE_REG(hwwdg->Instance->CFR, (hwwdg->Init.EWIMode | hwwdg->Init.Prescaler | hwwdg->Init.Window));

  /* Return function status */
  return HAL_OK;
}

 

WRITE_REG(hwwdg->Instance->CR, (WWDG_CR_WDGA | hwwdg->Init.Counter)); line reset the system.

I created a timer to periodically refresh the watchdog every 20 seconds, but the main problem is I cannot skip wwdg_init successfully. I get reset just after enabling watchdog. My APB1 peripheral clock is 54 MHz. (maximum speed)

  hwwdg.Instance = WWDG;
  hwwdg.Init.Prescaler = WWDG_PRESCALER_8;
  hwwdg.Init.Window = 64;
  hwwdg.Init.Counter = 127;
  hwwdg.Init.EWIMode = WWDG_EWI_DISABLE;


and there is my watchdog configuration. What can I do now in this situation? Waiting for your answers.