Skip to main content
TJagd
Visitor II
November 22, 2019
Question

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

  • November 22, 2019
  • 2 replies
  • 1524 views

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?

This topic has been closed for replies.

2 replies

waclawek.jan
Super User
November 22, 2019

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

Tesla DeLorean
Guru
November 22, 2019

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..