Showing posts from May, 2020

It's dead[time], TIM

Just discovered another interesting features of the "Advanced Timers" in the STM32G4: 3-phase combined PWM. Essentially it takes timer channels 1, 2, and 3 and ANDs them together with channel 5. On the one hand this sounds like it's kinda useless: why would you want to modify your PWM waveform during 3-phase commutation?
Top three traces: PWM for CH1-3, bottom channel shows output from CH5 (well, CH4 since CH5 doesn't have pin-mapped output)
Turns out, it's a really interesting way to add deadtime to a PWM signal without worrying about maximum duty cycle limits. In fact, you can crank the duty cycle all the way up to 100% and you'll still get center-aligned deadtime!

CH3 is "100% duty cycle" according to its the timer configuration, but it still has deadtime to do ADC sampling.
That's *super* useful for ADC sampling, which, as it turns out, is my next target. Stay tuned...