Correct way to clear TIM_SR_UIF after setting TIM_EGR_UG?
Hello,
to update e,g. PSC before starting a timer, an update event has to be generated. This update event will set UIF and to avoid an interrupt from the update event, the UIF flag needs to be cleared. A sequence
TIM1->EGR = TIM_EGR_UG;
TIM1->SR = 0;
TIM1->DIER = TIM_DIER_UIE;
will still immediate generate an interrupt. Having some more commands between event generation and flag clearing fixes the situation.
What is the timing relation between generating an update event and resetting the flag?
Is it enough to have some commands between setting UP and resetting UIF.?
Or is it needed to wait for UIF before resetting it?
