cancel
Showing results for 
Search instead for 
Did you mean: 

How to synchonize 2 PWM on the same clock.

FightKol
Associate II

6 REPLIES 6
FightKol
Associate II

Hello, 

I want to do 2 PWM, 1 on TIM 1 the other one on TIM8 and i'd like to synchronize both on the same clock. How can i do it please ? 

I use CubeMX and keil uvison 5 and HAL functions...

Thanks

Uwe Bonnes
Principal III

Tell first why you want to use two timers for 2 PWMs. One N-Channel Timer can do N-PWM that are synchronized. Otherwise read the timer docs how to start timers synchronous.

S.Ma
Principal

I would guess that both timers should be enabled by a common trigger signal. Dig through the spec (reference manual and datasheet) for more details.

With 2 advanced timers you can have up to 6 PWM plus their negate outputs (dual motor control drive for example)

You didn't tell us which STM32 are you using, but there are ample examples in the Cubes, e.g. for 'F446, [CubeF4]\Projects\STM32446E_EVAL\Examples\TIM\TIM_Synchronization , for yours you'll find it at a similar path, for one of the related devboards.

JW

FightKol
Associate II

I use STM32F4 discovery (STM32F407VG). I've to pilot 4 command that are complementary 2 to 2, for 2 synchronous BOOST.

So i need 4 signals, and i use 2 timers in PWM mode to generate 4 signals (Tim 1 : CH1 and CH1N and Tim 8 : CH1 and CH1N).

I succeeded this step, now I want to phase shift the timers 1 and 8 of pi but i can't put them on a same clock...

I hope u understand what i mean ..

FightKol
Associate II

I show you the code and settings of Cube MX. If you have an idea...

Thanks a lot !0690X000008BM1aQAG.png0690X000008BM1GQAW.png0690X000008BM1BQAW.png