On STM32F777 I have configured TIM2 as encoder counter with a period of 8192 (i.e. the CNT will wrap at 8192, see ARR register).
Everything works as expected until I reset the CNT by setting TIM2->CNT=0. In this case the first time CNT doesn't wrap to the expected period value of 8192, it will wrap at (8192 - CNTvalueAtReset): if CNT is 1192 and I reset it, the first time CNT will wrap at 7000 instead than 8192.
After this first time everything works as expected.
Is there some register I can set when resetting the counter to avoid this behaviour?