cancel
Showing results for 
Search instead for 
Did you mean: 

What is the best way to generate a single pulse of length variable (1 or 2 ms) started by SW

X_15
Associate II

Hi,

I need to start a single pulse of 1 or 2 ms from software. The length of the pulse is known when I need to start the pulse.

What is the best way to do that ?

Thanks,

4 REPLIES 4

Using a timer output, and one-pulse mode of a timer.

JW

X_15
Associate II

Do you have an example ? I tried to use a one-pulse mode, but unsuccessfully.

In CubeMX, which output type do I have to select ? And how to configure it (Mode, polarity, ...) ?

Thanks,

S.Ma
Principal

Do you need microsecond accuracy or milisecond accuracy?

Msec maybe use systick to count msec and a global nonzero pulse global countdown to drive any gpio pulse.

Also a one shot output compare with no auto reload. Compare is the first edge, timer max value the falling.

Or use MOSI of slow prescaled SPI to generate a pulse.... If all timers are taken

X_15
Associate II

Hi,

Thanks.

I use an Output Compare. It works properly, but only one time.

How to be able to start it again ?