PWM frequency on Raspberry Pi

PWM frequency on Raspberry Pi

I tried to use my Raspberry Pi as a sound generator and wondered about maximum frequency. In fact it can vary in range of Hz to MHz depending on programming language which you use. If you are interested how quick PWM can you have on your Raspberry Pi I recommend you to visit this site. It's very elegant summary of what can you achieve. Below I pasted table with results.

Language Library Tested / version Square wave
Shell /proc/mem access 2015-02-14 2.8 kHz
Shell / gpio utility WiringPi gpio utility 2015-02-15 / 2.25 40 Hz
Python RPi.GPIO 2015-02-15 / 0.5.10 70 kHz
Python wiringpi2 bindings 2015-02-15 / latest github 28 kHz
Ruby wiringpi bindings 2015-02-15 / latest gem (1.1.0) 21 kHz
C Native library 2015-02-15 / latest RaspPi wiki code 22 MHz
C BCM 2835 2015-02-15 / 1.38 5.4 MHz
C wiringPi 2015-02-15 / 2.25 4.1 – 4.6 MHz
Perl BCM 2835 2015-02-15 / 1.9 48 kHz

 

No feedback yet

This post has 6 feedbacks awaiting moderation...

Leave a comment

Your email address will not be revealed on this site.
(For my next comment on this site)
(Allow users to contact me through a message form -- Your email will not be revealed!)