Skip to main content
X_15
Associate
April 4, 2019
Question

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

  • April 4, 2019
  • 4 replies
  • 973 views

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,

This topic has been closed for replies.

4 replies

waclawek.jan
Super User
April 4, 2019

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

JW

X_15
X_15Author
Associate
April 4, 2019

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
April 4, 2019

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
X_15Author
Associate
April 8, 2019

Hi,

Thanks.

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

How to be able to start it again ?