PWM enhancements in 5.07.06 (undocumented)


Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 11635
Posted: 10:03am 09 Jan 2023      

  Quote  P.S. In my particular switchmode power supply test, I used 100kHz up to 400kHz frequencies, and had very small time offsets. That would require fractions of a microsecond start delay. I guess in that application the "poke" still is needed.


In the margin you are limited by the number of clock pulses in the time period
@400KHz with 1CPU @ 378MHz you have 945 clock periods per cycle so half of that is 472 and therefore a "shorter" pulse must be 470. Either method hits exactly the same limitation.


setpin gp0,pwm
setpin gp2,pwm
pwm 0,400000,50,,1
pwm 1,400000,49.8,,1
pwm sync 0,0.1
pw


gives you a symmetrical pair of pulses with exactly 1 count offset (2.6ns) at each end when the CPU clock is 378MHz.