cancel
Showing results for 
Search instead for 
Did you mean: 

WWDG_IRQHandler Doesn't Seem To Be Reached

vindicator
Associate II

I started learning about it while playing with WWDG_Example from STM32446E_EVAL.

I can enable WWDG and tie it to my EXTI button on my Discovery board.

The board will reset when the button is pressed and __HAL_RCC_GET_FLAG(RCC_FLAG_WWDGRST) == RESET.

What I have NOT been able to do is preempt the reset even though I also set WwdgHandle.Init.EWIMode = WWDG_EWI_ENABLE;

I added

void WWDG_IRQHandler(void)

{

HAL_WWDG_IRQHandler(&WwdgHandle);

}

to my stm32f4xx_it.c file and set breaks at various locations, but the handler never seems to be reached, but rather it goes straight to Reset_Handler:

I'm using the HAL in v1.24.

4 REPLIES 4
Jack Peacock_2
Senior III

If the WWDG counter is already below the reset threshold when enabled you won't get the early warning interrupt. Make sure the count is above 0x40 before enabling WWDG.

Jack Peacock

vindicator
Associate II

I've been thinking about what you said and it's not registering for me...

When the MCU is started, the HAL is initialized, then the SystemClock is configured.

THEN I initialize the WDG.

If I set WwdgHandle.Init.Counter = 127; which is above 64, that should be fine. ("This parameter must be a number between Min_Data = 0x40 and Max_Data = 0x7F ").

If It was BEYOND either range, assert_param(IS_WWDG_COUNTER(hwwdg->Init.Counter)); would throw I would think.

Even if it didn't throw and was beyond that range, I'd think the MCU would reset immediately. In other words, I never get a chance to blink any LED or press the EXTI0 button.

Am I wrong in my thinking?

Let's assume you are correct in your assumption and that I didn't set my counter in the range, where could I get the downcount value from the WWDG in progress?

EDIT0:

Ugh, I didn't hit "reply" to Jack Peacock_2.

But I figured out the cause, which appears to be the HAL never enables the WDG_IRQn.

I find it odd that void BSP_PB_Init makes a call to HAL_NVIC_EnableIRQ, but HAL_WWDG_Init does not. Bug?

vindicator
Associate II

Now I'm stuck at if (__HAL_WWDG_GET_IT_SOURCE(hwwdg, WWDG_IT_EWI) != RESET) called from

void WWDG_IRQHandler(void)
{
  // HAL_WWDG_Refresh(&WwdgHandle);
  __HAL_RCC_CLEAR_RESET_FLAGS();
  __HAL_RCC_WWDG_CLK_DISABLE();
  // __HAL_DBGMCU_FREEZE_WWDG();
  HAL_WWDG_IRQHandler(&WwdgHandle);
}

You can see I'm trying a bunch of things to get the WDG to stop while I'm stepping through, but the stack keeps looping through:

HAL_WWDG_IRQHandler(WWDG_HandleTypeDef * hwwdg) STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_wwdg.c:356) //__HAL_WWDG_GET_IT_SOURCE where I'm stuck and it never progresses down to HAL_WWDG_EarlyWakeupCallback.
<signal handler called> (Unknown Source:0) //don't know
HAL_GetTick() STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c:325) //from the next main.c loop cycle
<function called from gdb> (Unknown Source:0) //don't know
HAL_Delay(uint32_t Delay) STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c:390) //that call from my EXTI callback method.
HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin) STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c:500 //called my HAL_GPIO_EXTI_Callback where I call HAL_Delay to trip the WDG.
<signal handler called> (Unknown Source:0) //don't know
HAL_GetTick() STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c:325 //called from the main loop for that time range.
main() main.c:102 //the while loop where HAL_WWDG_Refresh gets called when in the time range.

Thanks for pointing the wrong isr signature and the missing enableIRQ out. Was facing the same problem - 5 years later...