STM32G474 – TIM_ETR to tim_trgo
Hello,
I may have made a *** of myself on a prototype, and need a bit of help with a work-around. I have an external clock signal on TIM20_ETR (PG5) for some pulse counting stuff. This works.
However, I intended to use the same clock signal to trigger TIM2 one-pulse (and later TIM5 one-pulse as well), and thought that I could use tim_trgo from TIM20 to clock them. My problem is that, now I have the prototype PCBs in hand, I cannot figure out how to pass the TIM20_ETR clock signal on to tim_trgo – or if it is even possible.
My best guess is that I can set TIM20_CR2 MMS to 0010 (Update), and set PSC and ARR to 0. I have already set TIM20_SMCR to use TIM20_ETR as the trigger source. If I understand the timer functionality correctly, this should give me an update event for each clock pulse.
This work-around will make me lose the TIM20 counter feature, but if I can just get the external trigger signal out on tim_trgo, then I can use that to clock TIM1 or TIM8, which can then be used for the actual counting.
I have also wondered if I can instead make the PG5 input generate an event, and use that for something. However, I have no experience with GPIO-generated events, and it doesn't look like TIM2 and TIM5 can be triggered by such events anyway.
Using interrupts to start the TIM2 one-pulse is out of the question, as this will certainly create unwanted jitter.
What do you think of my work-around? Doable or rubbish?
Are there better solutions that I just haven't thought of? Any help will be greatly appreciated.
