Skip to main content
Associate
March 12, 2024
Question

Generating variable phase shift between TIM1 and TIM8 advanced control timers

  • March 12, 2024
  • 3 replies
  • 1570 views

I am trying to create variable phase shift between TIM1 and TIM8. Phase shift is generating only one time but i want to change the phase shift while in running. I have set TIM1 channel 1 is for PWM generation, TIM1 Channel 4 is selected as output compare no output mode and slave timer is TIM8 channel 1. I want to create variable phase shift between tim1 channel 1 and tim8 channel 1. While i am changing the counter value of tim1 channel 4 the phase shift is not changing accordingly between tim1 and tim8. please help me in this issue.

Thankyou in advance 

3 replies

TDK
Super User
March 12, 2024

Changing TIM1>CNT or TIM8->CNT will affect the phase shift between the two channels. Doing so precisely take some effect. You can also adjust TIMx->ARR, wait for update, then adjust it back for a precise shift of a known number of counts.

> I want to create variable phase shift between tim1 channel 1 and tim8 channel 1. While i am changing the counter value of tim1 channel 4 the phase shift is not changing accordingly between tim1 and tim8

Not sure I understand why you're changing tim1 channel 4 to adjust tim1 channel1 or tim8 channel 1.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Associate
May 13, 2024

This is indeed a solution. Thank you!

Associate
March 13, 2024

I want constant frequency and PWM of 50% duty for both timers and i want to create phase shift between TIM1 channel 1 and TIM8 ch1. I am using TIM1 CH4 as output compare when i change counter value of this channel the phase shift is changing between tim1 and tim8 but only one time. if i want to change again i want to load complete program into microcontroller. Is there is any way to change phase shift between dynamically between tim1 ch1 and tim8 ch1

waclawek.jan
Super User
March 13, 2024

For 50% duty, you can use Toggle mode, and two channels of the same timer, where difference in their respective TIMx_CCRx determine their mutual or phase shift.

JW