Are all of the PWM outputs synchronized? Say, I set 4 differnt PWMs duty cycles, do all 4 pulses begin at the same time? Can this relation be adjusted?
Can some of the PWM’s be at a different freq?
i see many examples with just 1 PWM signal, but not more than one
PWMs run off the same clock/timer (however it’s done internally on the chip). You can only set one frequency, and the frequency dictates the rising edges which will always be in alignment.
[quote]You can only set one frequency, and the frequency dictates the rising edges which will always be in alignment.
[/quote]
I hate to say it but I have two freqs going at once & they are not locked together (PWM0 & PWM1).
PWM pwm0 = new PWM(GHIElectronics.NETMF.Hardware.PWM.Pin.PWM0);
pwm0.SetPulse(71420, 35714);
PWM pwm1 = new PWM(GHIElectronics.NETMF.Hardware.PWM.Pin.PWM1);
pwm1.SetPulse(7142, 2000);
I’d expect these to be locked, since one is 10x of the other freq
If I make both periods 71420, then they are locked, but the narrow pulse begins about 3/4 of the way into the wider pwm. If it make the two periods 71420 & 71430 they stay locked, which is impossible! These pulse are still out of alignment. They may have the same freq due to some truncation of 714xx.
If I do:
PWM pwm0 = new PWM(GHIElectronics.NETMF.Hardware.PWM.Pin.PWM0);
pwm0.SetPulse(1000000, 500000);
PWM pwm1 = new PWM(GHIElectronics.NETMF.Hardware.PWM.Pin.PWM1);
pwm1.SetPulse(500000, 250000);
I get two freqs, but the two pwms creep slowly against each other,as though the freq are not exact multiples…maybe each has +/-1 errors ,so then they are not exact multiples (ex: 20/40 vs 21/41)
Is there any reliable detailed timing description of using these PWM signals?
Note that GHI also provides “Register” class and through it, you can write your own PWM to fit any specific needs.
[/quote] (from http://www.tinyclr.com/forum/2/2415/) so you can always refer back to the datasheet and get more info.
[quote]All PWM signals share the same clock frequency. You can have different duty cycle though.
[/quote]
which i now assume means that is explicitly on USBizi and doesn’t apply to EMX
PWM signals are not guaranteed to be in sync. Some chips have one timers, others have more. You can test this by changing the frequency on one and seeing if it effects the other.
You may want to use register access to make your own PWM drivers to fit your needs.
[quote]USBizi
All PWM pins share the same timer. Changing one PWM frequency will affect the others.
EMX
Some PWM pins share the same timer. Changing one PWM frequency will affect the others.
PWM0 and PWM 2 share the same timer.
PWM1, PWM3, PWM4 and PWM5 share the same timer.
ChipworkX
Only one channel is available (0) with four frequencies: 391 KHz, 195 KHz, 98 KHz and 49 KHz.
[/quote]
If there are pwms on 3,4,5 they should all be in sync, coming from the same timer, but what is the timing between them? how is it set, or is the timing between them just luck of the draw?
I looked at the datasheet & think I can do som ethings I need just by manually setting some values in the timer & pwm registers, without any custom asm code needed. Then the chip will d o as I commnd :)I believe I can just send these register values from normal managed code, without needing RLP, correct?
Are there any gotchas to be worried about or on the lookout for?