STM32 TIMERS #6. Timer Synchronization || 3 Phase PWM

preview_player
Показать описание
________________________________________________________________________________________

________________________________________________________________________________________

******* SUPPORT US BY DONATING******

*******Join the Membership*******

Рекомендации по теме
Комментарии
Автор

Thank you for your tutorial. I am new to STM controllers and have been following your tutorials to generate PWM signals using STM32.
I'm using an STM32F407 board to generate two PWM signals, and from what I've gathered through online research, I need to use two timers, one in master and another in slave configuration. For the master Timer (Timer 1), I've set up two PWM channels. Channel 1 of Timer 1 is for PWM generation, and Channel 2 of Timer 1 is for triggering Timer 2, which is set to 'output compare no output' mode. I followed your tutorial to configure these channels.

What i actually want is to change the phase shift between two these two PWM signals in run time by modifying the CCR registers in the main. The pulse value set in TIM1 CH2 is supposed to change the phase of the PWM generated by Timer 2. However, I'm unable to change the phase at runtime. I've tried changing the value of the CCR2 register in the main code, but it doesn't affect the phase despite updating CCR2. The phase of TIM2's PWM1 is delayed if I set the pulse of TIM1's CH2 in the Pinout and Configuration section of STM32CubeIDE. However, the phase does not change if I modify "htim1.Instance->CCR2" in the main function. This is the problem I am facing. I want to update "htim1.Instance->CCR2" during runtime.

Could you please point out my mistake and provide the correct syntax? And if possible, could you explain it in simpler terms, as I'm relatively new to this?

shahidalikhan
Автор

Thanks for this great tutorial : all is clear with good explanation !

tisserandstephane
Автор

Nice video, well explained in that great disjointed voice. May have to find a controller to play with.

TheEmbeddedHobbyist
Автор

thank you for this work is it possible to vary the phase shift between the two timer in real time by a potentiometer for example. keeping the same frequency.

abdoulayebodian
Автор

Thank you so much! Little remark. It needs to pay attention to the order of initialization of the master-slave timers in the code. For example, when timer 3 is the master and timer 1 is the slave, when generating the code CubeMX initializes timer 1 first by default. In this case, timer 1 is may starte by itself, asynchronously with the master (timer 3). That is, after the generation of the code, the sequence of initialization of synchronous timers should be adjusted.

dmytrokorseko
Автор

Very good explanation.
One question i have can we convert the 3 phase pwm to 3 phase spwm by CCP register

chinmaykulkarni
Автор

what if i want to read these three signals, these signals are similar to hall sensor data(120 phase shifted). how will i able to read these signals like 011, 101, 110 etc

prabuddhajadhav
Автор

Thank you for the tutorial, Can you measure time difference phase shift between TIM1 and TIM2 with stm32?

ahmadsayuti
Автор

Hello, thank you for your valuable lessons! Is a possible way to implement phase shift between complementary pairs of different channels at the same timer?

iliasmatz
Автор

Thank you so much for yor video, i have a question, i did it for 2 Phase, it works great, but after i stop my Timer Master and Slave in order to have Delay, i mean with HAL_ TIM_PWM_STOP, doesn't work my timer slave any more, can you help me about that?

Here is my code, and my Tim3 works only one time and not permanently

HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_3)
HAL_TIM_OC_Start(&htim2, TIM_CHANNEL_4)
HAL_TIM_PWM_Start(&htim3, TIM_CHANNEL_2)
HAL_Delay(200)
HAL_TIM_PWM_Stop(&htim2, TIM_CHANNEL_3)
HAL_TIM_OC_Stop(&htim2, TIM_CHANNEL_4)
HAL_TIM_PWM_Stop(&htim3, TIM_CHANNEL_2)
HAL_Delay(200)

davidm
Автор

Hello! How can I change in main.c the value of OC2REF in TIM1. I tried to put in while TIM1 -> CCR2 = 3000; but this not change anything. Can you help me?

alexandrev.
Автор

How can get these 3 pwms with just one tim1?

osenson
Автор

Good morning, sir. Where is the translation in Arabic and is it possible to make an explanatory video to make a motor with a pid system

ahmedrefaie