Dear Sir,
According to datasheet of S12G PWM section, "The first PWM cycle after enabling the channel can be irregular."
Do we have workaround to generate a good waveform for the first PWM pulse?
Write PWM CNT register before enable the PWM?
Regards,
Jason Yang
Hi,
The irregularity is caused by synchronization of the PWM module and the output. The PWM starts immediately but its waveform is not available on the associated output until its clock source begins its next cycle. I think there is nothing we could do with it.
Any write to the PWM CNT register only causes the counter to reset to 0. Since the counter is set to 0 after reset, there is no need to write to the register unless you want to re-enable the PWM and clear its previous state.
Regards
Daniel