I'm trying to get exact 2048 pulses with TIM4 on Channel 1 at PB6 with a frequency of around 3 MHz after an TRGO from TIM3. Sounds actually quite simple but I've tried already the following which dosn't lead to the correct result:
#1. Timer Cookbook 6.2, Example Part 1: Is not working, here the TIM1 repetition count is used which is only able to generate 256 pulse.
#2. Timer Cookbook 6.3, Example Part 2: Because of the TRGO feedback from TIM1 into TIM2, TIM2 cannot triggered extern via another hardware trigger.
#3. I've tried the following TIM3[Update]---ITR2---->[Trigger] TIM1[OC1REF]---ITR0--->[Gated]TIM4 --->Ch1 PB6. Which is working, but unfortunately TIM1 is tied to APB2 where TIM4 is to ABP1 and therefore the obtained pulses are not correct and they shifting. See the gif.
#4. I've counted with TIM2 the TIM4 counts: TIM3[Update]---ITR2---->[Trigger] TIM4[Update]---ITR3--->[Trigger]TIM2 and triggered an software interrupt after 2048 is reached and manually stopped TIM4. This is not working, because of the delay in the interrupt routine. I got a variation of 2 - 4 counts too much...
Are there any other suggestions how to solve this?
P.S. It would be really a pleasure if the Timer Cookbook examples would be available in HAL-Driver code...