So I have a project that is going to use audio and need to do some PWM to control a motor. As I understand it (and I could be very wrong here), there are two chips a pi can use to produce PWM. In the documentation, the RPIO library has settings for DELAY_VIA_PCM and DELAY_VIA_PWM the default. Both of those are hardware PWM, right? PCM references the other chip that is not the default audio chip?

The one other reference to DELAY_VIA_PCM I can find on the web claims it is "sw" pwm, which I assume they mean software.

So with RPIO will I be able to use the DELAY_VIA_PCM setting to get hardware pwm, and still leave my audio channels available?


This will be a bit of a guess but will probably be correct.

RPIO.GPIO uses DMA to time PWM (as opposed for instance to RPi.GPIO which uses software timing).

The hardware timing source for RPIO.GPIO can be hardware PWM or hardware PCM. I assume DELAY_VIA_PCM uses hardware PCM and DELAY_VIA_PWM uses hardware PWM.

Hardware timing is much better than software timing but not quite as good as fully hardware PWM.

Software timing

Flexible duty cycle and frequency (up to say 20kHz). Jitter once the system becomes busy. Any GPIO but more than one at a time introduces far more instability.

Hardware timing

Limited duty cycle and frequency. Jitter free (unless the system becomes very busy). Any GPIO, more than one at a time does not introduce instability.

Fully hardware PWM

Flexible duty cycle and frequency. Jitter free. Only works on the GPIO with hardware PWM (12/13/18/19).

  • Can you still clarify for me a bit what Hardware PCM means vs Hardware PWM? The PCM thing is what’s throwing me.
    – Eric G
    Dec 6 '18 at 23:12
  • @EricG I do not understand either, for PWM v PCM perhaps wiki?
    – joan
    Dec 6 '18 at 23:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.