2019-05-02 12:33 AM
I have initialized TIM1 timer with:
TIM1_DeInit();
TIM1_TimeBaseInit(16, TIM1_COUNTERMODE_UP, 1000, 0);
TIM1_SetCounter(0);
TIM1_ITConfig(TIM1_IT_UPDATE, ENABLE);
TIM1_Cmd(ENABLE);
But calls to TIM1_GetCounter(); return the value 2. I can see the counter interrupt running and can increment a variable which provides an accurate enough timer, but I want to use the value of the counter, why does it always return 2? What am I missing?