cancel
Showing results for 
Search instead for 
Did you mean: 

Generate two 50% duty PWM signals with 90° phase shift using a single timer

Coccodrillo19
Visitor

Hi everyone,
I’m trying to generate two PWM signals with 50% duty cycle and a 90° phase shift, to simulate an A/B type output.I managed to achieve this using two different timers and adjusting the compare values, but I’d like to know if it’s possible to do it with a single timer, specifically TIM1.
I noticed there are Asymmetric PWM1 and Asymmetric PWM2 modes, but I don’t really understand how they work and whether they can be used to get this kind of phase shift between two channels.
Has anyone tried something similar or knows how to configure TIM1 to produce two PWM outputs in quadrature (90° out of phase) without relying on a second timer?

 

Thanks!

1 REPLY 1
waclawek.jan
Super User

A simple way is to use two outputs of a single timer in Toggle mode.

Changing polarity in TIMx_CCER.CCxP then allows to simulate reversing direction of "rotation".

JW