Re: [[RFC] 2/5] Emulates PWM hardware using a high-resolution timer and a GPIO pin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2009/11/18 Bill Gatliff <bgat@xxxxxxxxxxxxxxx>
> The jitter can be quite low (100's of usecs) on a 200 MHz ARM9 chip, in
> fact, but you'll eat your battery alive if it's a portable device.  And
> the jitter will also destroy your waveform at high or low duty cycles.

I agree with both of you, and I have physically tested bit-banged PWM
with an LED, a servo and a speaker. In all cases the jitter is
immediately obvious. The LED flickers noticeably (it is a very good
candle effect and system load indicator), the speaker crackles with
the white(ish) noise of the jitter, and the servo becomes unuseable.

It's pretty easy to do some math to prove it. Assume 100usec jitter.

Say you want to run a speaker at 1kHz. You need a 50% duty cycle PWM
running at a 1ms period. 100usec is a 10% error on 1ms. Therefore the
frequency will shift by 10% or 100Hz. Frequency resolution of the
human ear is 0.36 Hz within the octave of 1,000–2,000 Hz so you will
notice a 100Hz shift. What you end up hearing is 1kHz + noise.  Look
at it musically, C6 is 1046Hz and D6 is 1174Hz. So a jump of about
130Hz is a full 2 semitones! Totally useless for playing any sort of
music or pleasant sounding warning tones.

Servo motors require a 1ms to 2ms pulse to hold a position between
about 0 and 180 degrees. A jitter of 100usec is physically equal to an
error of 100usec/1ms = 10% on the servo output arm which is equal to
10% x 180 degrees = 18degrees of positional error! It is alarming to
watch what happens as the CPU is loaded.

For non-commercial products these artifacts might be acceptable, but I
wouldn't use it for anything that a customer will comment on.

Aras
--
To unsubscribe from this list: send the line "unsubscribe linux-embedded" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Gstreamer Embedded]     [Linux MMC Devel]     [U-Boot V2]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux ARM Kernel]     [Linux OMAP]     [Linux SCSI]

  Powered by Linux