AnsweredAssumed Answered

How to generate PWM in OPM with Fast Mode with Independent Timer?

Question asked by Seng Tak Goh on Mar 16, 2018
Latest reply on Mar 17, 2018 by waclawek.jan

Hi Community,


On a STM32F407 MCU, I wish to generate a single pulse with TIM4 PWM when triggered by ADC watchdog interrupt, with least delay possible.


Taken from the reference manual RM0090 One-pulse Mode section, 


  1. Particular case: OCx fast enable:

    In One-pulse mode, the edge detection on TIx input set the CEN bit which enables the counter. Then the comparison between the counter and the compare value makes the output toggle. But several clock cycles are needed for these operations and it limits the minimum delay tDELAY min we can get.

    If you want to output a waveform with the minimum delay, you can set the OCxFE bit in the TIMx_CCMRx register. Then OCxRef (and OCx) is forced in response to the stimulus, without taking in account the comparison. Its new level is the same as if a compare match had occurred. OCxFE acts only if the channel is configured in PWM1 or PWM2 mode.


it seems like to have the OCxFE work I need a trigger from TRGI sources. Is there a way to trigger this with software, as if possible I would want my timer to work independently without a master? Actually the best solution I am looking for is a way to directly trigger the PWM output from the ADC itself without intervention from CPU.


Thanks in advance.