cancel
Showing results for 
Search instead for 
Did you mean: 

how to generate N pulses using One pulse mode without an external trigger?

TJagd
Associate

Hello,

I am using STM32 CubeMX tool for code generation and using Keil IDE with STM32F479NI Eval board.

For my application I want to generate N pulses on PWM channel using One pulse Mode (OPM).

observed that , current example firmware uses OPM with one input channel ( input trigger ) and one output channel (PWM output). but I have only output channel for output pulses.

According to "Application note: General-purpose timer cookbook for STM32 microcontrollers"

this can be possible. But, I couldn't get expected results and also confused with cubeMX settings for the same. Could you please help me for the same?

2 REPLIES 2

Just set up the timer for PWM as usually, set the RCR register for required number of pulses, set the OPM bit in CR1 for One-pulse mode, and simply enable the timer by setting CR1.CEN (the last step replaces the external trigger).

I don't use Cube/CubeMX.

JW

The Advanced TIM have a repetition count so a triggered OPM generates multiple pulses.​

Can be triggered manually when no input available/desired​

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