1
\$\begingroup\$

I am using Mosfets as switches in half bridge application. I use STM32F407VG as PWM generator. I used TIM1(TIM1 CH1 and TIM1 CH1N) in order to generate two complementary PWM signals to switch Mosfets. I wanted to control duty cycle from %10 to %50 to control output power. I managed to control duty cycle with buttons(+,- buttons).

My first problem was that i wanted same duty cycle in both PWM signals. I could not do it using only TIM1 because when i adjust duty cycle to %10, only one of the PWM had %10 other PWM had much more which is completely normal. I decided to have two different timers to have same duty cycle.

So i used TIM1 and TIM8 which are advanced timers. I choose them because i wanted to have dead time insertion. I enabled TIM1 CH1 CH1N and TIM8 CH1 CH1N but i only wired CH1 pins so i would have same duty cycles.

i succeeded to have same duty cycles but this time i am having another struggle. PWM signals are not complementary.

enter image description here

enter image description here

My signals are like in the picture above when the duty cycle is %50. Two PWMs are intersecting. I want to have two complementary PWMs with adjustable duty cycle and frequency.

How can i deal with this situation ?

\$\endgroup\$
18
  • \$\begingroup\$ hasanyavuz.ozderya.net/?p=437 \$\endgroup\$ Sep 17 '21 at 8:00
  • \$\begingroup\$ @BruceAbbott I know this website. I already did what he had done. As i told in my question i could not have same duty cycles when i tried to adjust duty cycyle. \$\endgroup\$
    – Kırambor
    Sep 17 '21 at 8:10
  • \$\begingroup\$ there are vids on that on yt. Usually you also want some dead zone (both mosfets not conducting) between controlling signals to prevent accidentally shorting the power rail to gnd by opening both mosfets at the same time. Maybe even official stmicroelectronics yt channels covers that, but I've definitely seen it somewhere else too. Complementary and with safe dead zone \$\endgroup\$
    – Ilya
    Sep 17 '21 at 8:11
  • \$\begingroup\$ @Ilya I am sorry. I think i did not tell my problem clearly. I already have two complementary PWMs with dead time. But im struggling to adjust their duty cycle. When the duty cycle is %10, only of the PWM's duty cycle is %10. Other one has much more. But i want to have same duty cycle like. I will control output power by changing duty cycle from %10-%50. So i want to have %10-%10, %20-%20, %30-%30, %40-%40 and %50-%50 duty cycles on both PWMs. \$\endgroup\$
    – Kırambor
    Sep 17 '21 at 8:14
  • \$\begingroup\$ You need to draw pictures of when you want the 2nd output to become active relative to the first output. A picture will help solve this. You only need to show a 10% duty cycle picture. \$\endgroup\$
    – Andy aka
    Sep 17 '21 at 8:16
1
\$\begingroup\$

If I understood correctly, you need another approach for making complementary output with dead zones.

If you configure timer CC modules as opposite polarity PWM, you will have synchronized complementary outputs. If you configure the timer with center aligned mode, you will have the ability to make dead zone with manual intervention.

\$\endgroup\$
1
\$\begingroup\$

Inspired by this source video: https://www.youtube.com/watch?v=QMAgD9SS5_E

I needed two out of phase PWMs with complementary PWMNs (plus dead time). I used TIM1 and TIM8 as well, TIM1 is master, TIM1-CH1 has PWM & PWMN output, TIM1-CH2 as a trigger source, to trigger TIM8 as slave. TIM8-CH3 has another pair of PWM & PWMN output.

By updating the ARR of TIM1 & TIM8, the frequency of both PWMs can be adjusted.

By updating the TIM1-CCR1 & TIM8-CCR3, the % duty cycle of both PWMs can be adjusted.

By kept TIM1-CNT constant (e.g. 1), and updating the TIM8-CNT, the phase shift between the two PWMs can be adjusted.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.