Note that I am the author of pigpio so will be biased in my assessment of the different types of PWM. Actually there are three different types of PWM supported on the Pi.
Fully hardware PWM
- This type of PWM is generated by the Pi's PWM peripheral.
- The timing of the pulses is controlled by the PWM peripheral.
- It is the most accurate and arguably the most flexible.
- It can be generated on GPIO 12/13/18/19.
However there are only two channels, so only two different PWM streams can be generated at a time. GPIO 12/18 are on one channel, GPIO 13/19 on the other.
Suitable for:
- jitter free servos,
- glitch free LED brightness control,
- motor speed control.
DMA timed PWM
- This type of PWM is generated by the Pi's DMA peripheral.
- The timing of the pulses is controlled by DMA.
- This type of PWM may be generated on any GPIO on the expansion header.
- All GPIO may have different settings.
It is not as timing accurate as fully hardware PWM but appreciably more accurate than software timed PWM. Depending on the implementation it is not as flexible as fully hardware PWM, e.g. the number of frequencies is much more limited and the number of steps between on and off is much more limited.
Suitable for:
- jitter free servos,
- glitch free LED brightness control,
- motor speed control.
Software Timed PWM
- This type of PWM is generated by software.
- The timing of the pulses is controlled by the (Linux) scheduler.
- This type of PWM may be generated on any GPIO on the expansion header. * * All GPIO may have different settings.
- The timing accuracy will vary according to the number of GPIO being used for PWM.
It is appreciably less timing accurate than fully hardware PWM or DMA timed PWM. It is much more flexible than DMA timed PWM and just as flexible as fully hardware PWM, e.g. the number of frequencies is unlimited and the number of steps between on and off is unlimited.
- Not really suitable for servos.
- Will control LED brightness but will suffer from glitches
- Suitable for motor speed control.