AnsweredAssumed Answered

WWDG

Question asked by schuch.lucas on Jul 17, 2015
Latest reply on Aug 31, 2016 by vural.baycan
Hi,

I am having problems to run the WWDG in a STM32F405.
I am using the HAL Drivers from Cube MX.

The process is the following:

{
__HAL_RCC_WWDG_CLK_ENABLE();
MX_WWDG_Init();
HAL_WWDG_Start(&hwwdg);
HAL_WWDG_Refresh(&hwwdg,127);
}

Where:

void MX_WWDG_Init(void)
{


  hwwdg.Instance = WWDG;
  hwwdg.Init.Prescaler = WWDG_PRESCALER_1;
  hwwdg.Init.Window = 80;
  hwwdg.Init.Counter = 127;
  HAL_WWDG_Init(&hwwdg);


}


The problem is that the program never reaches the refresh function. It resets the micro in the line showed below:

HAL_StatusTypeDef HAL_WWDG_Start(WWDG_HandleTypeDef *hwwdg)
{
  /* Process Locked */
  __HAL_LOCK(hwwdg); 
  
  /* Change WWDG peripheral state */  
  hwwdg->State = HAL_WWDG_STATE_BUSY;


  /* Enable the peripheral */
  __HAL_WWDG_ENABLE(hwwdg);  // THE MICRO RESETS AFTER CALLING THAT FUNCTION!
  
  /* Change WWDG peripheral state */    
  hwwdg->State = HAL_WWDG_STATE_READY; 
  
  /* Process Unlocked */
  __HAL_UNLOCK(hwwdg);
  
  /* Return function status */
  return HAL_OK;
}

Any clues?


Outcomes