cancel
Showing results for 
Search instead for 
Did you mean: 

Pwm master slave synchronization

lrosadev
Associate II
Posted on December 04, 2015 at 19:07

Hello, I'm working with STM32F4 and I'd like to stop PWM after N periods automatically like explained in this [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Stop%20PWM%20output%20after%20N%20steps&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=2935]post.

In this post TIM3 is the master and TIM1 (PWM, trigger mode) is its slave and is configured in ''one pulse'' mode.

Everything works seamlessly as far as TIM1 and TIM3 start sequentially (i.e. TIM1 first and TIM3 after)

Hence, I would expect that PWM output wave starts after the TIM3 enable occurs, but this does not seem to be true.

In fact, if, for example, I enable PWM by TIM1, wait for a delay and after start TIM3 (I need to make it like this, because I need TIM3 to be a slave of an upper level master), 

I see on the scope one PWM shoot (N periods) before TIM3 is started

So my question is: 

Why do I get an output before TIM3 starts?

I have an idea, but I would like to get your opinion.

regards

#stm32f4 #pwm #discovery #output
2 REPLIES 2
Posted on December 05, 2015 at 03:14

>

In fact, if, for example, I enable PWM by TIM1,

In Trigger mode, you are not supposed to enable the timer ''by hand'', writing into TIM1_CR1.CEN; rather, it's the slave controller which sets it when TRGI arrives.

Read the noe below CEN bit's description.

JW

lrosadev
Associate II
Posted on December 09, 2015 at 09:50

Thank you for reply,

by setting ''Automatic output enable'' bit, now the pwm output is present when  TRGI arrives.

regards