2017-10-12 05:51 AM
Hi,
I am trying to sync two three phase center aligned PWM signals on my STM32F446.
Goal is to habe the center of the two PWM signals to be offset by half of the base frequency.
Is this possbile and if yes how do I configure the master/slave timers?
Currently I have TIM1 and TIM8 in use for the PWM generation, both with three PWM generation channels and the fourth as trigger channel for the ADC.
Thank you for your help!
-sgessler
2017-10-12 08:25 AM
TIM1 and TIM8 run off the same clock, so it's enough to synchronize them once at the beginning and they remain in sync forever.
I'd set both TIM1 and TIM8 to run at the required period, then one channel of TIM1 as output compare and to the half of period (minus some internal synchronization, as ST doesn't specify this has to be tried), set that channel as TRGO source in CR2; set TIM8's SMCR.TS to TIM1 and SMS to reset. Once they run synchronized (i.e. after one period), I'd break the synchronization (i.e. clear SMCR.SMS) and without stopping them I'd configure all PWMs and ADCs as needed.
JW