Has anyone tried doing a software PWM on the GPIO pins via a custom written module in kernel space?

Wouldn't want to reinvent the wheel, so if there where tries, please forward me to them. Will update the answer when i get new insights.

  • Found a source code for a soft pwm in kernel space here. It complied for the Raspberry without error with the cross compiler. Will test it tomorrow. – TheMeaningfulEngineer Aug 13 '13 at 21:03
  • 1
    Have you solved your problem? If so, please mark the answer that helped you, or if you solved it on your own, create a self-answer and mark it as such. We are trying to get the site Q:A ratio up and marking answers is what does that. If you resolved it and mark then people in the future will be able to profit from what you did and it helps move the site closer to graduation. Thanks! – RPiAwesomeness Mar 23 '14 at 16:48

As Guzunty mentioned, I've used both pi-blaster and servoblaster for using PWM to control LEDs. The latter includes a kernel module, but the recommended method is now the user-space daemon. Both methods create a /dev/servoblaster file which you can write to change the PWM status. (The advantage of the user-space method is that you don't have to match the kernel module to kernel version, which could require compiling.)

How they work is they use the DMA timer of the single PWM pin of the Pi to time the signals on any of the other GPIO pins. I've found them to work pretty reliably under varying CPU load conditions, so I'd say it works well. Much better than pure software PWM.


Google Pi-blaster and servo blaster which are both software based solutions for RPi.

  • 3
    The answer would be more useful if there were more details. – Tevo D Sep 7 '13 at 21:36
  • this answer needs more information, just offsite links are not an acceptable answer. – DrCord Jun 2 '15 at 14:09

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.