Obtain a PWM with 3 outputs having 120 degress phase shift (STM32G070CB)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-04-13 2:07 AM
Hi,
I need to obtain the attached behavior at the output pins with minimal MCU cycles.
I also need interrupts at the beginning of each periods, because I need to do different stuff at each period.
I'm using STM32G070CB which has 64MHz clock frequency and one advanced timer.
Thanks in advance.
Cheers,
Ogulcan
- Labels:
-
STM32G0 Series
-
TIM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-04-13 2:15 AM
Read Asymmetric PWM mode subchapter of TIM chapter in RM.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-04-13 11:05 PM
Thanks for the reply.
"Asymmetric mode allows two center-aligned PWM signals to be generated with a programmable phase shift."
I need 3 PWM signals, and preferably I want to use TIM15_CH1, TIM16_CH1 and TIM17_CH1 output pins as my hardware is designed accordingly (but we can change the design later on if necessary)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-04-14 12:46 AM
Look at master-slave interconnection. Set the "PWM-generating" timers as slaves and choose a fourth timer which connects to all 3 of them as a "timing master" (I don't know if there is such possibility, check yourself. There may be a different way, where you daisy-chain the timers, it any other topology). Set the "timing" timer TRGO in TIMx_CR2.MMS to one of the Output Compare, set that channel for the required phase for first "generating" timer, set that timer's period but don't enable it, set it up as slave Trigger and wait until it gets enabled automatically. Then change the phase in "timing" timer and repeat for second "generating" timer. Then the third.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-04-14 12:46 AM
Look at master-slave interconnection. Set the "PWM-generating" timers as slaves and choose a fourth timer which connects to all 3 of them as a "timing master" (I don't know if there is such possibility, check yourself. There may be a different way, where you daisy-chain the timers, it any other topology). Set the "timing" timer TRGO in TIMx_CR2.MMS to one of the Output Compare, set that channel for the required phase for first "generating" timer, set that timer's period but don't enable it, set it up as slave Trigger and wait until it gets enabled automatically. Then change the phase in "timing" timer and repeat for second "generating" timer. Then the third.
JW
