cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F1 pwm mode and center aligned question

JJeba.1
Associate II

Hello

I'm very new to the STM world (just came from arduino) and I'm learning about timers and PWM.

I have some questions about some settings that I cannot seem to find any answers.

What is the difference between PWM mode 1 and 2

And what is the difference between center aligned 1 and 2 and 3

I'm making a 3 phase inverter and i'm using STM32CubeIDE

Thank you

2 REPLIES 2

> What is the difference between PWM mode 1 and 2

Polarity of OCxREF.

The same net effect could be achieved in the vast majority of the cases by simply inverting OCx/OCxN by setting TIMx_CCER.OCxP/OCxNP.

Difference is only where OCxREF is used directly instead of (or in addition to) being used directly as output into OCx/OCxN, e.g. in the assymetric/combined modes (not available in 'F1 only in some newer STM32 families), or in using OCxREF as TRGO, when compared to OCx generated with deadtime. These are minor differences you probably will never come accross, and if you do, you will probably already be familiar enough with the STM32 timer so that it won't cause any surprise.

> And what is the difference between center aligned 1 and 2 and 3

Only the way how the CCxIF signal is generated (causing interrupt/DMA request, according to respective enable bits in TIMx_DIER). See figure in PWM center-aligned mode subchapter of the TIM chapter in RM.

JW

JJeba.1
Associate II

Thank you for the explanation.. I am slowly getting there.

So for a simple 3 phase inverter it doesn't really matter if I use mode1 for pwm and mode 1 for enter aligned? I have tested with the scope all the possible combination and I really don't see a difference..

I have tried to generate an output pulse so I could sync the scope with the center of the PWM but I wasn't successful