Turn-key PCB assembly services in prototype quantities or low-volume to mid-volume production runs

Raspberry Pi GPIO benchmark update

Couple years ago Joonas from Code and Life have made pretty extensive Raspberry Pi GPIO speed benchmark. But things have changed over two years. Specifically speaking hardware of first generation Raspberry Pi remained same, but firmware and software libraries overcome series of upgrades. It became interesting how GPIO speed have changed since last check.


He tested several libraries and languages. To test GPIO performance a simple pin toggle endless loop were run. Results were quite different comparing to tests done couple years ago. Lets see few of them. First of all he tested Shell based scripts. This method gave 2.9kHz square wave. When using WiringPi library toggling speed dropped down to 40Hz. So it seems that shell scripting is suitable for slow signaling. Python with Rpi.GPIO showed pretty good improvement. From earlier 0.3.0 version 44kHz in version 0.5.10 it jumped to 70kHz. This is great speed for most interfacing tasks. Also python is versatile scripting language to use. Python with Wiring Pi didn’t perform as good – 28kHz, but still pretty useable. Best performance is visible when using C native library – 22MHz. BCM2835 based C library reaches 5.4MHz which didn’t change much. C with Wiring Pi generated 4.1MHz square wave. Other more exotic methods like Ruby and Perl results are very similar to Python. So there are few improvements and few speed loses. But in average it didn’t change much. This comparison of methods give pretty good clue what to expect when using one or another method. Use C when you need fast signaling, but for control and driving applications Python and even shell works fine. Another important thing to remember, that these benchmarks are performed on a blank Raspberry Pi which doesn’t perform other intense tasks. In this case you should expect different results. Always be sure to test you applications in real conditions before use.

[..Source link..]

Bookmark the permalink.

Comments are closed.