cancel
Showing results for 
Search instead for 
Did you mean: 

Timer Synchronization with Offset

pant
Associate II
Posted on June 29, 2015 at 20:43

Hello everyone,

Excuse me for creating a discussion similar to one that I have already created, but I decided to give it a last try, because I could really use some help.

What I want to do precisely is this:

Timer1 (Produces 3 PWM pulses at Ch1,2 and 3)-> 50KHz

Timer2 (Used to trigger ADC in tripple mode)->200KHz (Not a standard number, I need to be able to change it to various frequencies)

I want to define some offset and then trigger Timer 2 periodically in every period of Timer1, get 4 samples and then stop. (The 4 samples is not a standard number, it depends on the frequency)

Attached you will find an oscilloscope image of what I need exactly. I did it, but through software, which is not stable. I would like to implement it through hardware, but unfortunately it seems a lot harder than I thought.

One idea I had was to use Timer1 Channel 4 and trigger Timer2 at the desired time offset, but unfortunately I am probably missing something because I can't make it work.

Another idea is by using a third Timer, which will trigger Timer2 after the time offset. However I don't know how to synchronize the third timer exactly with Timer 1. Even if I enable him in Timer1 Interrupt, there will be some clocks delay. Moreover again I will be based on interrupt, which I would like to avoid if possible.

( I maybe could use a 4th in one pulse mode, to trigger Timer 1 and 3 at the beginnign simultaneously, but I think there must be an simpler way to do that, without using 4 timers)

And finally, even if I do that, is there any way to stop after a specific number of ADC captures?

Thank you in advance.

Regards,

Pantelis

#adc #stm32f4 #timer #sync
0 REPLIES 0