cancel
Showing results for 
Search instead for 
Did you mean: 

Using TIM1 used for PWM to start TIM8 used for ADC sampling with one trigger

BobbyBeta
Associate III

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. 

2 REPLIES 2
AScha.3
Chief

Why not using a (extra) channel of TIM1 to trigger TIM8 ?

Just look, what Cube shows you - to trigger it. (CCMx -> TIM8 trigger source)

If you feel a post has answered your question, please click "Accept as Solution".

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?