This is an old revision of the document!


GPIO bit-bang driver for Linux

The GPIO bit-bang driver creates an interface to Linux GPIOs using the IOCTL API.

Basic 1-bit input and output is available along with accelerated multiple bit shift I/O.

GPIO bit-bang is well suited to PICMicro ICSP but not exclusively.

Raspbian for Raspberry Pi

First install development tools and the kernel headers when using a regular kernel.

apt-get install raspberrypi-kernel-headers

If you updated the kernel with rpi-update, try this tool to install the headers instead.

# https://github.com/RPi-Distro/rpi-source
sudo wget https://raw.githubusercontent.com/RPi-Distro/rpi-source/master/rpi-source -O /usr/local/bin/rpi-source && sudo chmod +x /usr/local/bin/rpi-source && /usr/local/bin/rpi-source -q --tag-update

Install like this.

rpi-source --skip-space

Now install the kernel module.

hg clone http://hg.kewl.org/pub/gpio-bb
cd gpio-bb
make
make install

Void Linux for Raspberry Pi

First install development tools and the kernel headers.

xbps-install mercurial make gcc rpi-kernel-headers 

Now install the kernel module.

hg clone http://hg.kewl.org/pub/gpio-bb
cd gpio-bb
./rpi-void.sh

Bananian for Banana Pi

Install development tools and the kernel headers and then install the kernel module.

hg clone http://hg.kewl.org/pub/gpio-bb
cd gpio-bb
./bpi-bananian.sh

Armbian for Orange Pi Zero

Install development tools and then install the kernel module.

hg clone http://hg.kewl.org/pub/gpio-bb
cd gpio-bb
make
make install

Configuration

Update the modprobe configuration to create the gpio-bb device node when the module is loaded. For example, add the following to /etc/modprobe.d/modprobe.conf

install gpio-bb modprobe --ignore-install gpio-bb && modprobe gpio-bb && mknod /dev/gpio-bb c 180 0 && chmod 666 /dev/gpio-bb

Lastly, add the following to /etc/modules and reboot.

gpio-bb

OpenWRT

Raspbian for Raspberry Pi (obsolete)

Troubleshooting

gpio-bb uses the kernel API to access pins, this API demands exclusive access to a pin per process. This means you cannot use gpio-bb and sysfs export simultaneously for a single pin.

Resources

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies