Phase-correct vs. Fast-PWM - scope images

6 posts / 0 new
Last post
comfychair
comfychair's picture
Offline
Last seen: 6 years 9 months ago
Joined: 01/12/2013 - 05:39
Posts: 6198
Phase-correct vs. Fast-PWM - scope images

I plugged some oddball PWM values into a test firmware, and flashed it to a test mule F6DD driver (FET, momentary switch). Relevant bits of the FW:

// PWM Mode
#define PHASE 0b00000001
#define FAST  0b00000011

/*
 * =========================================================================
 * Settings to modify per driver
 */

#define LOW_TO_HIGH     1  // order in fast-tap mode (long-press will go the opposite direction)
#define VOLTAGE_MON     // Comment out to disable - ramp down and eventual shutoff when battery is low
#define MODES           0,1,1,3,3,12,12,40,40,125,125,254,254,255
#define MODE_PWM        0,PHASE,FAST,PHASE,FAST,PHASE,FAST,PHASE,FAST,PHASE,FAST,PHASE,FAST,PHASE

This is the signal at the FET's gate with those modes...

http://75.65.123.78/scope/phase-vs-fast/pwm1-phase.png

http://75.65.123.78/scope/phase-vs-fast/pwm1-fast.png

 

http://75.65.123.78/scope/phase-vs-fast/pwm3-phase.png

http://75.65.123.78/scope/phase-vs-fast/pwm3-fast.png

 

http://75.65.123.78/scope/phase-vs-fast/pwm12-phase.png

http://75.65.123.78/scope/phase-vs-fast/pwm12-fast.png

The behavior of phase-correct putting out less light than fast-PWM reverses here, actually somewhere between this mode and the last one. After that point where the on-time is long enough for the FET to reach the fully on state, the fast-PWM is the one that puts out slightly less light (it's noticeable by eye, so I guess it's technically more than 'slightly').

http://75.65.123.78/scope/phase-vs-fast/pwm40-phase.png

http://75.65.123.78/scope/phase-vs-fast/pwm40-fast.png

 Phase-correct is starting to get noisy...

http://75.65.123.78/scope/phase-vs-fast/pwm125-phase.png

http://75.65.123.78/scope/phase-vs-fast/pwm125-fast.png

No visible difference at 254.

http://75.65.123.78/scope/phase-vs-fast/pwm254-phase.png

http://75.65.123.78/scope/phase-vs-fast/pwm254-fast.png

Didn't bother with both versions at 255, on is on, it would look and work the same.

http://75.65.123.78/scope/phase-vs-fast/pwm255-phase.png

 

These were all done with exactly the same scope settings, just cycling through the modes and taking screencaps. I'll do some later with different settings that show more detail.

Edited by: comfychair on 10/24/2014 - 08:51
fellfromtree
fellfromtree's picture
Offline
Last seen: 8 years 2 months ago
Joined: 07/25/2014 - 15:14
Posts: 470
Location: spelunking

Ah nice.. So we should switch to phase after 12. Well to keep it simple all you need to do is keep fast and increase the pwm a bit. 254 I haven’t tried that Smile Good stuff comfy

Pulsar13
Pulsar13's picture
Offline
Last seen: 1 month 3 weeks ago
Joined: 02/05/2012 - 10:23
Posts: 1909
Location: Malaysia

Good stuff, as usual. Thanks. Would the effect be similar with 7135s?

comfychair
comfychair's picture
Offline
Last seen: 6 years 9 months ago
Joined: 01/12/2013 - 05:39
Posts: 6198

This is just the output from the MCU on pin 6, different hardware downstream will behave differently. 7135s don't have any problem getting low enough light levels at the minimum, they need at least a PWM of 5 or 6 before they put out enough to even light the LEDs. With a single FET a PWM of 1 will put out more light than the 7135s with a PWM of 5.

CRX
CRX's picture
Offline
Last seen: 1 month 2 days ago
Joined: 04/02/2013 - 15:27
Posts: 4243
Location: Scotland

Interesting to see it this way, thanks.

comfychair
comfychair's picture
Offline
Last seen: 6 years 9 months ago
Joined: 01/12/2013 - 05:39
Posts: 6198

Lower 4 levels, slowed down to 4us scale (others were all at 20us).

Nothing to see between them at PWM=1, which is why they're different. It's all rising/falling slope and no on-time, and the fast-PWM has two events for every one with phase-correct.

http://75.65.123.78/scope/phase-vs-fast/pwm1-phase-4us.png

http://75.65.123.78/scope/phase-vs-fast/pwm1-fast-4us.png

 

http://75.65.123.78/scope/phase-vs-fast/pwm3-phase-4us.png

http://75.65.123.78/scope/phase-vs-fast/pwm3-fast-4us.png

 

Ah... now they start to look different, but there's still twice as many with fast-PWM, here at 12 the two versions look very similar in light output. The shorter length is starting to cancel out the difference in frequency.

http://75.65.123.78/scope/phase-vs-fast/pwm12-phase-4us.png

http://75.65.123.78/scope/phase-vs-fast/pwm12-fast-4us.png

 

And here's what's changed when it gets to where phase-correct is noticeably brighter. The longer pulse more than makes up for there being only half as many.

http://75.65.123.78/scope/phase-vs-fast/pwm40-phase-4us.png

http://75.65.123.78/scope/phase-vs-fast/pwm40-fast-4us.png