cancel
Showing results for 
Search instead for 
Did you mean: 

Implementing phase shifted PWM on STM32F302R8 with asymmetric PWM module.

MK_2019
Associate II

Hello,

Iam trying to implement a phase shifted 4 channel PWM on STM32F302R8 .The PWM signals should look like the first picture. I use CH and CHN complementary PWM generation with deadtime insertion. PWM mode ist asymmetric PWM Mode 1 for both channels.. But I cant create an overlap of channel 1 and 3. Turn on time of all pwms should be equal I just want to adjust the phase shift. Right now PWM looks like the second picture. I use the following compare values:

 TIM1->CCR1 = 0

 TIM1->CCR2 = 800

 TIM1->CCR3 = 500

 TIM1->CCR4 = 300

thanks!

7 REPLIES 7

Same question, different part

https://community.st.com/s/question/0D50X0000AFqMcKSQV/what-whould-be-the-ideal-mode-to-generate-a-shifted-4channel-pwm-for-a-phaseshift-converter

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
MK_2019
Associate II

Thank you for your answer. Can you explain your answer more detailed ? Would this lead to multiple Timer Interrupts ?

There are only 3 complementary channels in TIM1, and using asymmetric (or combined) PWM cuts them down to 2, so you probably can't escape using several timers, possibly in master-slave arrangement.

What's the value of TIM1_CCMRx?

JW

MK_2019
Associate II

Iam not sure what you mean with cutting them down to 2. I always thought I could handle CH1 and CH1N asymmetrical and a second channel CH2 and CH2N asymmetrical. I refer to p. 488 of the RM0365 Reference manual where the attached picture is from.

After debugging TIM1_CCMR1 contains 1000000010110100001101000.

Thanks for your help!

MK

> Iam not sure what you mean with cutting them down to 2.

That you have only 2 (complementary) channels if you want them to be asymmetrical, i.e. CH1+CH1N and CH3+CH3N - CH1N and CH3N are not standalone channels, you can't offset them independently, they are only the inverted copy of CH1 and CH3 (plusminus some small deadtime).

CCMR1 looks good. Are you running bidirectional? Post content of all TIM registers.

JW

MK_2019
Associate II

Now its a bit clearer to me. But still I think it would be sufficient to have CH1 and CH3 phase shifted. I only need to adjust this shifting. CH1N and CH3N will result. I only use TIM1. The registers of TIM1 are in the attached file.

Still I am in doubt about this part in p488 of reference manual...

"Figure 168 represents an example of signals that can be generated using Asymmetric PWM

mode (channels 1 to 4 are configured in Asymmetric PWM mode 1). Together with the

deadtime generator, this allows a full-bridge phase-shifted DC to DC converter to be

controlled".

So do they recommend to use 2 complementary pwm with dead time insertion or 4 independent channels in asymmetric PWM mode 1 ?

Thanks again for replying!

MK

The asymmetric (and combined) modes are afterthought to overcome the limitation I've been talking about previously, i.e. that one edge of the channel pulse is always aligned to the moment of overflow (update), So, these new modes combine two adjacent channels (1&2 and 3&4) to produce one output waveform.

The register settings you've sent are not related to the oscilloscope picture you provided above, are they?

There is no point in setting 0 and 800 to CRR if ARR=800. This results in constant level output. Use numbers in between.

JW