0

I've faced the problem with WWDG on STM32F405 (the same problem described here, but with no no solution): After enabling WWDG interrupt occurs immediately, despite the fact, that counter is far from the value 0x3F and I update counter before it is enabled. My initialization:

LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_WWDG);
LL_WWDG_SetPrescaler(WWDG, LL_WWDG_PRESCALER_8);
LL_WWDG_SetWindow(WWDG, 0x7e);

LL_WWDG_EnableIT_EWKUP(WWDG);
LL_WWDG_ClearFlag_EWKUP(WWDG);
NVIC_ClearPendingIRQ(WWDG_IRQn);
NVIC_EnableIRQ(WWDG_IRQn);

LL_WWDG_SetCounter(WWDG, 0x7d);
LL_WWDG_Enable(WWDG);

I deliberately set counter value less than window value to have possibility update timer any time. So does anyone know why interrupt occurs immediately after enabling?

MatTab
  • 11
  • 2

1 Answers1

1

I think I've figured out the problem: I thought that if I set counter value less than window value, I will have opportunity to reload counter any time, but with this setup EWKUP flag was not cleared. So I put window value equal to counter and problem disappeared.

MatTab
  • 11
  • 2