cancel
Showing results for 
Search instead for 
Did you mean: 

Generating a fixed number of pulses on trigger

srsinha
Associate II
Posted on August 08, 2013 at 23:31

Hi,

I have what is essentially a timer question. I am interested in using an STM32 F4 (more RAM, higher clock speeds) for an application. My application requires me to generate a pulse every 2ms, pulse length ~100 usec. Every time this pulse goes off, a second timer needs to generate 4096 pulses in ~1.9 msec.

After reviewing the manuals I'm still unclear how to have a timer generate fixed number of pulses (>256) every time it is triggered from another source. Is this possible with an STM32 F4? If it is possible, what are recommended ways of implementing this?

Thanks in advance.
5 REPLIES 5
Posted on August 09, 2013 at 01:05

Can you use a gated mode?

What's the max frequency of the 4096 pulses? The STM32 is not good a generating odd frequencies. How about 3 MHz, 2.21053 MHz ?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
srsinha
Associate II
Posted on August 12, 2013 at 18:17

Hi,

Thanks for the reply. 

Second question first. All 4096 pulses have to be completed in under 2 msec. For this application I can handle emitting all pulses in as little as 1.5 msec (and then wait for 0.5 msec for next trigger) but ideally I will only have 0.05 - 0.2 msec to spare, so all pulses in 1.8 - 1.95 msec.

Perhaps I don't fully understand gated mode. I'll go back and look at it again. Can you please expand on how you'd use it to clock out all the 4096 pulses, every 2 msec?

Thanks for your input

Posted on August 12, 2013 at 18:45

I'd imagine you'd use a slaved timer in gated mode to send a stream of pulses while enabled. The gating pulse being matched with the frequency of the timer so that 4096 pulses are emitted during the time it is enabled, and placed so as to start 100us after the first signal.

So say a clock of 2.7 MHz and a gated time of ~1.5171 ms, should be 4096 pulses.

And no, I'm not looking to implement this for you.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
srsinha
Associate II
Posted on August 13, 2013 at 17:40

Thanks for your comments, but not for the snark. You provided me what I was looking for, a high level approach to tackling the application objective. There was no implicit request to have you do anything else.

Cheers

Posted on August 13, 2013 at 18:03

Sorry, I've had one too many expand/zoom threads that end up there.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..