cancel
Showing results for 
Search instead for 
Did you mean: 

Can input capture on one timer be triggered by output capture events on an other timer on STM32G4?

KHarb.1
Senior

I'm using CubeIDE and I want to have an output compare event on TIM1 CH1 trigger an input capture event on TIM8. It doesn’t seem like there is a way to do this with normal timer functions and CubeIDE. Is it possible if I work outside CubeIDE?

As a backup, I believe I can also use a DMA transfer triggered by TIM1 CH1 output compare to save TIM8->CNT to memory. Is this a viable solution?

1 ACCEPTED SOLUTION

Accepted Solutions

If I remember correctly, the only "regular" way is the one described by Waclawek.Jan. You can use DMA to read CNT register, but you have to count with some jitter. It can be few ticks (of core clock), but in case another DMA channels running it can be more. If you do not need "single tick" precision, then it is viable.

But you can also start another timer synchronously with TIM8 and perform capture on it.

View solution in original post

4 REPLIES 4

> I want to have an output compare event on TIM1 CH1 trigger an input capture event on TIM8.

In TIM1_CR2.MMS, select OC1REF as TRGO source. In TIM8_SMCR.TS, select  appropriate ITR value for TIM1 to be TIM8's TRGI. In TIM8_CCMRx.CCxS set to 0b11 for TRC to be the capture trigger source.

JW

I forgot to mention that TIM8 is being reset via ITR9 from TIM20, so the trigger is already in use.  If there isn't another way, I'm back to attempting the DMA implementation above.

 

If I remember correctly, the only "regular" way is the one described by Waclawek.Jan. You can use DMA to read CNT register, but you have to count with some jitter. It can be few ticks (of core clock), but in case another DMA channels running it can be more. If you do not need "single tick" precision, then it is viable.

But you can also start another timer synchronously with TIM8 and perform capture on it.

You can also interconnect TIM1_CH1 and TIM8_CH1 externally, using two pins.

JW