2024-03-30 01:56 PM
I am using TIM1 for medium-frequency PWM and TIM8 for high speed ADC sampling with a STM32F765VIT6. TIM8 triggers ADC1, ADC2, and ADC3 where DMA streams collect the data. The frequency of TIM8 is a multiple of TIM1 so once it is started it will remain synchronized, but it does need to start a particular phase of TIM1.
Currently I am starting TIM8 the "dumb" way: during initialization I start TIM1, loop until the TIM1 timer value is the appropriate value for starting TIM8, and then start TIM8. It feels I should be able to use the synchronization capabilities of the timers to make an elegant solution.
I'm looking into the synchronization capabilities of the timers in section 25.3.25 of rm0410 and it seems like using TIM8 in Slave Mode: Trigger Mode has promise. It seems after it is triggered I would either 1) make sure the trigger source from TIM1 is always active or 2) turn off TIM8 Slave Mode.
I'd appreciate if anyone could tell me if I'm on the wrong path before I go too far into this, or if there is a better way that I'm not seeing.
2024-03-30 02:36 PM
Why not using a (extra) channel of TIM1 to trigger TIM8 ?
Just look, what Cube shows you - to trigger it. (CCMx -> TIM8 trigger source)
2024-03-30 04:40 PM
Using CH5 or CH6 of TIM1 to trigger TIM8 is what I'm looking at, but I only want to do it once and after that I want TIM8 to run freely.
If I use TIM1 to trigger TIM8 once, it seems I'd need to then turn off TIM8 to unconfigure the trigger?