2012-01-12 12:59 PM
Hello everybody!
In my program I have to start two timers exactly at the same time. In my current code I start them behind one another (just one line of code each) but unfortunately the error with this method is too large. I'm not really into the possibilties a STM32 �C provides, maybe you can give me some tips or even an example code where this problem is solved. Some facts about the timer-settings: Timer1 is in PWM-Mode, triggering the ADC. Timer4 is in OnePulse-Mode. Hope this problem isn't very hard to solve ;) Thank you in advance! #start-two-timers-synchronously2012-01-12 03:50 PM
Could you use different channels on the same timer?
Draw a diagram illustrating the desired relationship the two signals. Or some more specifics.2012-01-13 04:58 AM
I'll give you a short explanation so that you get an overview of what I want to do :)
I want to measure the saturation current of an inductor, so I have to short-circuit the coil for a certain time and sample the voltage over a shunt to get the current-value. Timer4's work is to generate the pulse with its certain length. Timer1's work is to trigger the ADC to get samples every exact interval during the on-pulse. Everything works, except the first sample which is wrong because of the delay resulting of starting the two timers seperately. In the reference manual there's a chapter called ''Starting 2 timers synchronously in response to an external trigger''. I think that's exactly what I want to do. What do you think about that? :) Greetz Christoph2013-06-27 02:02 AM
Hello Clive,
I searched my issue in the forum and found this topic, so I don't open a new topic about my issue.I want to start two timers synchronously. Both of the timers will be used as PWM output mode. One of the timer is 2MHz clock output.(PWM) and another is 8KHz clock output.(also PWM)There are two option for me. First: I can use TIM3_CH1 and TIM3_CH2. But I can set period and prescaler value to 2MHz or 8KHz. I can't set both of two values in one timer.How can I set two different values in one timer?Second: I can use TIM3_CH1 for 2MHz and TIM2_CH4 for 8KHz. When I set both of them, there are right values but they are not synchronous. So this is a problem for the system.How can I set and start two timers synchronously?I'm waiting for your kindly help.