2023-03-30 12:06 AM
I want to generate phase shifted PWM for 3 channels of Timer 1 of STM32G474.
How to generate, please let me know?
2023-03-30 12:23 AM
Read the Asymmetric PWM mode subchapter of TIM chapter in Reference Manual (RM).
JW
2023-03-30 01:14 AM
Hello Waclawek,
Thanks for sharing info. could you please share some example code so as to enable me to proceed further.
Thanks in advance.
2023-03-30 02:15 AM
Hello @Sairaj1987,
I recommend you checking the "TIM_PWMOutput" example developed on the NUCLEO-G474RE board from the STM32CubeG4. It will certainly help you with your request, you can download the it from the ST official website or through the GitHub repository.
The example is under the following root: "STM32Cube\Repository\STM32Cube_FW_G4_V.XX\Projects\NUCLEO-G474RE\Examples\TIM\TIM_PWMOutput".
I hope my answer has helped you, please mark it as best by clicking on the "Select as Best" button if it fully answered your question. This will help other users find this solution faster.
Thank you.
Chahinez.
2023-03-30 02:38 AM
Hello ChahinezC ,
Thank you.
The given example shows to generate 4 PWM signals under one timer i.e. TIM1. My application is to generate the same with phase shift of 60 degrees between each channel.
i.e. Channel 1 : 0 Degree
Channel 2: 60 degree
Channel 3 120 degree
Channel 4 180 degree
So, my obstacle is to provide phase shift between each channel under same timer i.e. TIM1.
Thank you
Sairaj
2023-03-30 02:59 AM
Hello @Sairaj1987,
Based on the readme file, the example provided is based on Timer1 with the following :
TIM1 Channel1 duty cycle = 50%
TIM1 Channel2 duty cycle = 37.5%
TIM1 Channel3 duty cycle = 25%
TIM1 Channel4 duty cycle = 12.5%
Thank you.
Chahinez.
2023-03-30 03:16 AM
Hello ChahinezC ,
I agree with the duty cycle. But all the channels will start at 0 degree whereas, My application is to provide phase shift between all the channels.
Thanks
Sairaj
2023-03-30 04:26 AM
3 phases PWM output seems not possible with 1 timer, see https://community.st.com/s/question/0D53W00000esa2XSAQ/is-it-possible-to-create-120-degrees-3-phase-shifted-pwm-with-controllable-duty-cycle try synchronizing 2 timers.
hth
KnarfB
2023-03-30 04:44 AM
Hi @KnarfB ,
> 3 phases PWM output seems not possible with 1 timer
That thread deals with 'F303. The 'G4 have a new and shiny TIM, which has Asynchronous mode and also provision to combine CH5 with some of the other channels (which is obviously an afterthough so is set up differently than Asynchronous mode.
I haven't tried personally but I am confident that 3 different phases are possible in 'G4's TIM1. For 4th phase, indeed, a different timer has to be used, through the master-slave synchronization.
JW