AnsweredAssumed Answered

Timer Synchronization Issue

Question asked by pantelis on Jun 25, 2015
Latest reply on Jun 25, 2015 by pantelis
Hello everyone,

I would like to ask your ideas about something I would like to implement. I would like to have a  constant timer at 50KHz (TIM1) and based on this timer, start with some specific offset a second timer at 200KHz (TIM2).

I did it in my code, but what I did will definitely not work once my code becomes heavier, because it is affected by interrupts and stuff.

Therefore I am trying a more efficient and accurate way to do it. A solution I thought would be to use a third Timer (TIM5) in master one pulse mode, and in output compare and once he gets the value of the wanted offset, trigger the second timer (TIM2), which would be in slave mode.

However in order to implement this idea I have one problem. How am I going to start the third timer (TIM5)? I was thinking of starting it in every iteration of TIM1, once the code enter the interrupt generated by TIM1. However that won't be very accurate since there will be some delay between the two Timers. On the other hand I can't find a way to set TIM5 as master and at the same time trigger it using TIM1.

What do you think?
Thank you in advance.