cancel
Showing results for 
Search instead for 
Did you mean: 

Use rising/failling edge to start PWM

FightKol
Associate II

Hello,

I work on STM32F407.

I want to start the PWM 1 on the rising edge of the main PWM and start the PWM 2 on the failling edge of the main PWM. But I don't know how I can detect the rising/failling edge...

Can you help me please ?

Thanks a lot.

4 REPLIES 4

So you want to use TRGO sourced from one of the OCxREF of "master" timer to start two slave timers (i.e. the slave timers have the slave-mode controller set in Trigger mode, TIMx_SMCR.SMS=0b110, set up for PWM but disabled, i.e. TIMx_CR1.CEN=0), but you want to start them on opposite edges of TRGO.

Unfortunately, you can't achieve that simply using the internal interconnections.

One workaround which comes into my mind is - at the cost of two pins - to connect externally the master PWM to one of the slave's CH1 or CH2, and use that as TRGI. The other slave would be started through the internal interconnection.

Another workaround could use a DMA triggered at the appropriate edge of the master timer, to write a value to one of the slave's timer's CR1 which would set CEN thus start that timer.

JW

FightKol
Associate II

Thanks for your answer.

In fact I want to phase out 2 PWM signals (on TIM 1 and TIM8) but i can't find a solution... I tried to use "Output compare" and that didn't work either ...

What do you mean by "phase out"?

JW

FightKol
Associate II

I wanted to phase shift my 2 PWM signals.

Finally i find a solution, I use channel 2 as "Output Compare" of my firts timer (PWM 1) as a trigger for the second timer (PWM 2) !