cancel
Showing results for 
Search instead for 
Did you mean: 

3 phase PWM Commutation

ajishsaji
Associate II

Hello,

I am using Timer 1 for the generation of 3PWM and their complimentary Signals and I am getting all 6 PWM waveforms.

For six step commutation I need to add phase delay between the channels of the timer. Is it possible using any HAL function? I am not using any motor control library or example code.

 

Can anyone guide me.

 

Regards,

Ajish Saji

12 REPLIES 12
Issamos
Lead II

Hello @ajishsaji 

This video is making the same thing you want to do. I suggest you to use it.

Best regards

II

Hello @Issamos 

I referred to that video but my hardware has been developed and it uses only Timer 1 for PWM generation -> Chanel1,2&3 Please refer the below snap.

 

ajishsaji_0-1694590023370.png

 

Can you please help me in this scenario, I need to start the Timer 1, Channel 2 PWM 120 degree apart

Issamos
Lead II

Hello again @ajishsaji 

It is so easy. Use exactly the same methode of the video but use the ch1,ch2 and ch3 of TIM1 as PWM generator ( he is using ch1 of TIM1,2 and 3 .replace them respectively with ch1,ch2 and ch3 of TIM1) then use TIM2 channels 1 and 2 for the output compare(he is using ch2 of TIM1 and TIM2. Replace them with channel 1 and 2 of TIM2). and do exactly as in the video.

Best regards.

II

Hello @Issamos,

I did the as you said and it worked for only 1st cycle.

Please refer the below snap

ajishsaji_0-1694595784486.png

Do you want me to attach the Project?

Hello @ajishsaji 

I don't now way but can you share your code to verify it.

Best regards.

II

Hello @Issamos 

I have attached the main file for your reference.

Hello @ajishsaji 

I'm sorry but you should use different timer for each pwm. And take care of timers internal trigger connections. As described her.

Best regards.

II

Sarra.S
ST Employee

Hello @ajishsaji welcome to ST Community, 

You need to start your question by stating which stm32 are you using,

One straightforward method is to use the toggle on match mode of the output compare to control the phase shift, but all the signals will have 50% duty cycles

 

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello @Sarra.S & @Issamos,

I am using the microcontroller STM32f030R8T6, and my hardware is fixed and it has been mapped to the pins of the timer 1 because I need 3 PWM signals and their complimentary signals.

I am unclear about the match mode can you please elaborate.