Use timers to measure external clock frequency
I have two external clocks connected to TIM1 and TIM2 of the stm32f746 (disco). I'm basically trying to implement a frequency counter of the clock connected to TIM2. The TIM1 clock will act as window (driven by a TCXO). In my test setup the TIM2 clock is 2500kHz and the TIM1 clock is 78.125KHz (=TIM2 clock/32). So I know what I should expect.
My idea is to create window with the TIM1 using counterPeriod=625. I also check TIM1 with "one pulse mode". I.e. provided that TIM1 will act as a window, I should expect to count 625x32=20000 cycles of the TIM2 clock.
I have attempted to create a master (TIM1)/ slave (TIM2) and enable counting by setting TRGO (cnt_en).
I have also attempted to use compare pulse (OC1) and use "output compare no output" and read compare register. This was described here (however using system clock as window)
Whatever I try the TIM2 clock either does not count at all or count continuously, I'm nowhere near to get '20000'.
I'm mainly reading this document but find it hard to understand..
Any suggestions are most welcome.