Showing results for 
Search instead for 
Did you mean: 

WWDG RESET Due to osDelay

Associate II

Behaviour of WWDG on STM32L071KZUx.

  • We are trying to read and write 256bytes from the Slave. In a specific case the Slave needs delay of 120ms to process the data when we add 120ms of delay in the MCU, the void HAL_WWDG_EarlyWakeupCallback(WWDG_HandleTypeDef* hwwdg) callback is triggered and it will reset the MCU.
  • we are using osDelay() to give 120ms delay,
  • What are all the possible cases to trigger this HAL_WWDG_EarlyWakeupCallback callback ?
  • How to fix this issue ?



> How to fix this issue ?

Set the watchdog to a longer-than-120ms period?

Split the wait to several shorter waits and refresh the watchdog in between?


ST Employee

Hello @VSoun.1 ,

If the Early Wakeup Callback is triggered, that means you aren't refreshing the WWDG in the right window. You must set the WWDG with the following formulas :

  • WWDG clock (Hz) = PCLK1 / (4096 * Prescaler)
  • WWDG timeout (mS) = 1000 * (T[5;0] + 1) / WWDG clock (Hz) where T[5;0] are the lowest 6 bits of
  • WWDG Counter refresh is allowed between the following limits :
    * min time (mS) = 1000 * (Counter - Window) / WWDG clock
    * max time (mS) = 1000 * (Counter - 0x40) / WWDG clock

You can use the HAL & Low-layer drivers, here is the user manual for the STM32L0.

The "Getting started with WDG" on the MCU wiki is available here for additional information.

You can also find details in the chapter 21 named "System window watchdog" in the reference manual here.

Best Regards,


To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.