cancel
Showing results for 
Search instead for 
Did you mean: 

Complementary PWM issue

Hari123
Associate

Hi there,

I am generating 250khz PWM signal using STM32f401ccu6 (Blackpill) to drive high side and low side mosfets. I am using Timer 1 channel 1 along with its complementary PWM feature to utilize dead time feature. Currently I have generated the PWM signals at 250khz, but the CHN PWM is not opposite to the CH PWM. Both are starting from HIGH and transitioning to LOW. That means both are interfering by getting HIGH or LOW at same time. I tried to change the CHN polarity to HIGH to LOW in pinout configuration, but it is only inverting the duty cycle. The CHN PWM transition is not happening from LOW to HIGH. Also I tried by changing both CH and CHN polarity, idle state. Please let me know how to approach this. I have attached the images.

 This is the output with CHN polarity as HIGH.

0693W00000UoJxHQAV.pngoutput with CHN polarity as HIGH.

0693W00000UoJxMQAV.pngTImer setup 0693W00000UoJxRQAV.png0693W00000UoJxWQAV.png0693W00000UoJxgQAF.png0693W00000UoJxvQAF.png

This this the PWM I'm expecting with dead time.0693W00000UoJyKQAV.pngThanks in advance.

4 REPLIES 4
gbm
Lead III

Switch the scope mode from Alt to Chop while keeping the setting from the first scope image - you will see the real signals with the same time base, not one after another.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
Javier1
Principal

Thats a weird wave output, ive never had this issue before.

 as @gbm​ said, you oscilloscope might be playing tricks with your time axis. By aligning both signals at the rising flanks thus the time axis having different offsets.

I believe this parameter is telling you how much offset did the oscilloscoe introduced to your signal to align it where it is (units are screen divisions)

  • The first signal was moved to the right 1,72 time divisions.
  • The second signal was moved to the left 2,48 divisions.

so the Real phase beteween them would be 4,2 time divisions , with each division being 500ns---> real phase difference between flanks is 2,1us which is exactly half your period at 237Khz(as we expected).

Your code is fine, your oscilloscope configration isnt.

0693W00000UoVOEQA3.pngBy the way, once you fix your oscilloscope config ,the Dead time should be higher than 0

we dont need to firmware by ourselves, lets talk
Hari123
Associate

Thanks. @gbm​ @Javier Muñoz​ .

@Hari123​ ,

what type of oscilloscope is this?

Thanks,

JW