cancel
Showing results for 
Search instead for 
Did you mean: 

Bug Report: stm32f2xx_hal_wwdg.c

Posted on January 26, 2016 at 14:30

Hello there,

I was trying to activate WWDG using STM32CubeF2 v1.1.1 and got problems when trying to use HAL_WWDG_Start_IT. The handle was kept in lock state.

Comparing with HAL_WWDG_Start I miss a call to __HAL_UNLOCK(hwwdg);

Please have a look at the code sample. Am I missing somthing, or is realy the unlock call missing in the library.

Best regards

Andreas

/**

  * @brief  Starts the WWDG.

  * @param  hwwdg: WWDG handle

  * @retval HAL status

  */

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);  

 

  /* Change WWDG peripheral state */    

  hwwdg->State = HAL_WWDG_STATE_READY;

 

  /* Process Unlocked */

  __HAL_UNLOCK(hwwdg);

 

  /* Return function status */

  return HAL_OK;

}

/**

  * @brief  Starts the WWDG with interrupt enabled.

  * @param  hwwdg: WWDG handle

  * @retval HAL status

  */

HAL_StatusTypeDef HAL_WWDG_Start_IT(WWDG_HandleTypeDef *hwwdg)

{   

  /* Process Locked */

  __HAL_LOCK(hwwdg);

 

  /* Change WWDG peripheral state */  

  hwwdg->State = HAL_WWDG_STATE_BUSY;

 

  /* Enable the Early Wakeup Interrupt */

  __HAL_WWDG_ENABLE_IT(WWDG_IT_EWI);

  /* Enable the peripheral */

  __HAL_WWDG_ENABLE(hwwdg);  

 

  /* Return function status */

  return HAL_OK;

}

5 REPLIES 5
Nesrine M_O
Lead II
Posted on January 26, 2016 at 15:30

Hi Andreas,

Please try to use the latest version of the STM32F2 cube firmware package, there was an issue with the management of the IT macro on the V1.1.0, but it was fixed since the version V1.2.0

-Syrine-
Posted on January 26, 2016 at 16:49

Hi Syrine,

I performed an update of Cube and the firmware packages in use.

The newly generated file seems to contain the same problem.

I attached the file.

Best regards

Andreas

________________

Attachments :

stm32f2xx_hal_wwdg.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Htf1&d=%2Fa%2F0X0000000aVV%2FNwfo8izeCb3Wf0E2t2QxVrc71_5H_9v_cKFPGsOVhiQ&asPdf=false
Nesrine M_O
Lead II
Posted on January 26, 2016 at 17:35

Hi Andreas,

For the WWDG Start with interrupt enabled the Unlock process is added in the WWDG handler ( HAL_WWDG_IRQHandler() ) that should be called in the stm32f2xx_it file 

-Syrine-

Posted on January 26, 2016 at 19:22

Hi Syrine,

so it is not meant to perform a HAL_WWDG_Refresh from outside the the ISR.

That seems strange to me. In that case, I have to wait for the first early wakeup interrupt before being able to trigger the watchdog from my normal application?

Beside that, the lock is taken away at the end of the IRQ_Handler, so not even using HAL_WWDG_WakeupCallback would allow to refresh the watchdog.

Best regards

Andreas

Nesrine M_O
Lead II
Posted on January 27, 2016 at 11:45

Hi Andreas,

I understood your issue, I'll report it to our team for checking. Please be patient when I could get some updated info.

-Syrine-