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?
@dmytrokorseko518
Жыл бұрын
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.
@bobshiskabob
7 ай бұрын
THANK YOU SO MUCH!!!!! This drove me crazy for two days until I found this comment. Tim2 initialized before Tim1
@tisserandstephane7845
Жыл бұрын
Thanks for this great tutorial : all is clear with good explanation !
@dingkuncai4004
Жыл бұрын
Thank you and happy new year!
@siddharthmali5841
Жыл бұрын
Great tutorial.
@TheEmbeddedHobbyist
Жыл бұрын
Nice video, well explained in that great disjointed voice. May have to find a controller to play with.
@Zurenio
6 ай бұрын
You are the best...!!!
@singhman1026
7 ай бұрын
Really good tutorial.... 👍
@egar1956
17 күн бұрын
It is not possible to control the phase between the timers in runtime. Is there some mthod for this ? Thanks
@abdoulayebodian3583
Жыл бұрын
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.
@ahmadsayuti7937
7 ай бұрын
Thank you for the tutorial, Can you measure time difference phase shift between TIM1 and TIM2 with stm32?
@ControllersTech
7 ай бұрын
I am not sure but I think there is no dedicated feature for it. You can manually do it by using 2 input pins with external interrupt on rising edge. Then start the timer once you get the first trigger and stop the timer on second trigger.
@botak333
5 ай бұрын
@@ControllersTechhi sir i have question, i used acin 220v for ipm igbt module ( after rectifier i get 310v dc) the ipm can handle till 600v, but my motor only acept 200v. Now how ti reduce duty cycle for HIN and lin input sir?? If i used 50%duty cycle i will get 155v out from ipm right sir??? I used stm32 g431 and st mc worckbench motor control sir
@mmt1024
Жыл бұрын
Great video
@prabuddhajadhav2933
6 ай бұрын
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
@chinmaykulkarni7835
Жыл бұрын
Very good explanation. One question i have can we convert the 3 phase pwm to 3 phase spwm by CCP register
@iliasmatz3922
Жыл бұрын
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?
@ControllersTech
Жыл бұрын
Isn't it shown in the video ?
@iliasmatz3922
Жыл бұрын
As I can see the application of this video is generating phase shifted signals between different timers using master/slave configuration (timer synchronization). I am trying to achieve phase shifted signals at a single timer but different channels. I can see that TIM1 OC2 is used to trigger the TIM2. Mby if I choose Output Compare CH2 (instead of output compare no output) and Toggle on match mode (instead of Active level), will it make it possible?
@iliasmatz3922
Жыл бұрын
I am sorry if something doesn't makes sense, I am a beginner to STM32. Thank you very much for your immediate response!!!
@ControllersTech
Жыл бұрын
I don't thik it works like that. The second timer needs to be in slave mode for the synchronization to work. Individual channels can't be configured i. Slave mode. You can try manually though. Start the different channels after some delay. It won't be precise, but if you adjust things properly you might be able to achieve it.
@davidm6967
Жыл бұрын
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)
@alexandrev.3332
Жыл бұрын
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.3332
Жыл бұрын
Anybody can help me? I tryed everything but only way to change is in the beggining on the boxes, I want to phase shift in a while the value that i want to put and change again and so on
@andrerodrigues4318
Жыл бұрын
@@alexandrev.3332 Were you able to do so? I am also having that problem and need to phase sift from one value to another at a certain time while code is running
@osenson98
Жыл бұрын
How can get these 3 pwms with just one tim1?
@ControllersTech
Жыл бұрын
You can use 3 channels of tim1 but you have to manually sync them..
@deveshshevde-cp8xq
2 ай бұрын
@@ControllersTech how to mannually sync them?
@alirezam1
Жыл бұрын
Thanks. but with Subtitle would be perfect...........
@ControllersTech
Жыл бұрын
Generally youtube generates the cc. I don't know why it's not doing for this video yet.
@ahmedrefaie8671
Жыл бұрын
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
Пікірлер: 32