Skip to main content
Yoichi Shinoda
Senior
May 1, 2019
Solved

Forcing timer output state in gated PWM mode when gate goes low?

  • May 1, 2019
  • 1 reply
  • 1182 views

When generating a series of pulses in PWM mode with the series duration controlled by gated slave mode, final state of output depends on the timing the gate signal goes down.

Is there anyway to force the state to low, so that the final pulse is not stretched? Short pulse is okay.

This topic has been closed for replies.
Best answer by waclawek.jan

You did not tell us which STM32 and whcih timer, but generally I don't think there is a simple way to accomplish what you want. Some timers have the option to clear OCxREF upon external event but that's driven usually by the ETR pin, and not many timers have that pin, besides, you would need to externally link the trigger source to ETR, wasting pins (unless ETR is the source of TRGI now, of course).

Other option which comes to my mind is to set up a DMA triggered by TIMx_DIER.TDE, transferring a suitable value (0?) from memory to TIMx_CNT so that the OCxREF comparison results in inactive state.

JW

1 reply

waclawek.jan
waclawek.janBest answer
Super User
May 1, 2019

You did not tell us which STM32 and whcih timer, but generally I don't think there is a simple way to accomplish what you want. Some timers have the option to clear OCxREF upon external event but that's driven usually by the ETR pin, and not many timers have that pin, besides, you would need to externally link the trigger source to ETR, wasting pins (unless ETR is the source of TRGI now, of course).

Other option which comes to my mind is to set up a DMA triggered by TIMx_DIER.TDE, transferring a suitable value (0?) from memory to TIMx_CNT so that the OCxREF comparison results in inactive state.

JW

Yoichi Shinoda
Senior
May 2, 2019

Thanks for the ideas. I understand that there's no easy and generic way.