Why is the flag not cleared when __HAL_TIM_CLEAR_IT is run?
Using the CubeMX generated code, the timer interrupt goes to HAL_TIM_IRQHandler(TIM_HandleTypeDef *htim) where the source of the interrupt is checked. It then calls the correct callback function depending on the source. Problem is that both the OC and the UPDATE flags always are set because these lines do nothing:
__HAL_TIM_CLEAR_IT(htim, TIM_IT_CC1);
....
__HAL_TIM_CLEAR_IT(htim, TIM_IT_UPDATE);
Checking the timer registers with the debugger I can see that the bits don't change. I can also see that the counter is at a random value every time the interrupt routine is called: void TIM1_BRK_TIM15_IRQHandler(void)
