Article Preview
Buy Now
FEATURE
Rasp Pi Electronic Fun Part 1
Using LibGPIOD Interface for Raspberry Pi Electronics
Issue: 21.3 (May/June 2023)
Author: Eugene Dakin
Author Bio: Eugene works as a Senior Oilfield Technical Specialist. He has university degrees in the disciplines of Engineering, Chemistry, Biology, Business, and a Ph.D. in Chemical Engineering. He is the author of dozens of books on Xojo available on the xdevlibrary.com website.
Article Description: No description available.
Article Length (in bytes): 11,764
Starting Page Number: 54
Article Number: 21305
Resource File(s):
project-21305.zip Updated: 2023-05-05 09:39:22
Related Web Link(s):
http://abyz.me.uk/lg/lg.zip
Excerpt of article text...
If you have spent any time programming electronics on Single Board Computers (SBC) such as Raspberry Pi, Orange Pi, or the many other flavors, there can be a large amount of confusion. Using the GPIO pins to work with electronics in the real-world can be hard, as each board required a slightly different way to use the GPIO pins using helper files, different code, 32-bit vs 64-bit, and the list goes on. The worse part is that there is very little information on
why this change happened, and why this is now the standard way to interface with GPIO pins.LibGPIOD provides a way to unify the GPIO interface for all these different boards. Let us dig into a little history about what is available and the benefits and problems with each.
Before LibGPIOD, when you wanted to have electronics projects with the Raspberry Pi, nano Pi, friendly ARM, Banana Pi, or many other boards, retrieving digital signals would be a nightmare since each board has its own bindings helper. Raspberry Pi would have RPi.GPIO, Beaglebone would have Adafruit bbio, etc. Each time you wrote a program, then the programmer would need to port the same program to be compatible with the binding program to interface with the specific board GPIO. When a new SBC would be created, then a new binding would be created, and more code changes would be needed to be compatible with the new device.
Legacy SYSFS - Deprecated
Legacy systems tried to make a cross-platform way to interface with GPIO's by use of a file system called
sysfs
, which is a virtual file system created by the linux kernel. There would be a fake file system for every GPIO and the programming language would read or write to the sysfs file. Since this is literally writing and reading from a file, access would be slow at about 1- to 2-kilohertz. Sysfs is better than nothing, even though it is slow, and usually the benefit to program once and use sysfs on many different boards was the tradeoff with speed for multiple compatibility. Bit-banging GPIO was usually difficult and slow with sysfs.Legacy DEVMEM
...End of Excerpt. Please purchase the magazine to read the full article.