Raspberry PI IO Interface Board


Since we’ve got the kernel driver, we thought it was time to post a preview of the digital interface hardware. It’s only a preview, the final version will have 8 output channels and 8 input channels. It’ll fit neatly on top of the Raspberry Pi and allow you to sense the world and interface. All inputs and outputs will be on screw terminals so there’s no excuse, everyone can wire up the world with Raspberry Pi and the IO Interface. Demo of the final version will be posted when we finish it.

Raspberry Pi SPI Kernel Driver Available for Download

Kernel driver for SPI for the Raspberry Pi to drive hardware inferface boards for IO expansion is nearly finished.

You can download the pre-compiled kernel with spi driver included here — just make a backup of your original kernel.img file on the boot partition of your SD card and replace it with this one.


Power up the Raspberry Pi and log in.

type dmesg | grep spi and you should see

pi@raspberrypi:~$ dmesg | grep spi
in spi_init driver
in bcm2835_spi_probe
bcm2835_spi_probe base 0x20204000, remapped 0xcc80c000
in bcm2835_spi_reset
bcm2835_spi setbits wrote  0x00041030 to 0xcc80c000
bcm2835_spi clrbits wrote  0x00041000 to 0xcc80c000
bcm2835_spi bcm2835_spi.0: registered master spi0
in bcm2835_spi_setup
spi spi0.0: setup mode 0, 8 bits/w, 20000 Hz max –> 0
bcm2835_spi bcm2835_spi.0: registered child spi0.0
in bcm2835_spi_setup
spi spi0.1: setup mode 0, 8 bits/w, 20000 Hz max –> 0
bcm2835_spi bcm2835_spi.0: registered child spi0.1
bcm2835_spi_probe complete – 0

Now you need to switch over the pins from general IO to the SPI module. This should be in the pinctrl module, but in the meantime download http://gromit.cs.man.ac.uk/RaspberryPi/switchPinCtrl and execute it with root permissions.

sudo ./switchPinCtrl.

now try sending the a character to the spi with chipselect 0. e.g.

echo -n x > /dev/spidev0.0

Or with chipselect 1:

echo -n x > /dev/spidev0.1

(The -n tells echo not to send a newline character)


Please let us know how you get on. We want to hear your comments and bug reports.

The following will be changed in future releases

  • Alternative SPI modes (e.g. clock and data polarity/sample times)
  • Clock speed (dependent on reading clock speed from board)
  • GPIO pinmux/pinctrl
  • User defined enable/disable of SPI
  • Remove debugging statements

Source is available here:



Kernel Driver Delays, and New Interface Board Design

Unfortunately integrating pinctrl is proving harder than expected to port to the Raspberry Pi. Briefly, pinctrl is the module that controls which module in the SOC is connected to which IO pin. e.g. Is a pin being used for GPIO or is for the SPI module.

As such, I’ll probably just post the patch for the spi driver and pinctrl will have to wait.

However, in the meantime, here’s a new design for a buffered I/O interface. It has 8 inputs, 8 outputs (open collector, each able to sink a reasonable amount of current) with leds, buttons and a couple of relays thrown in. The design’s gone of to the PCB house today, so it should be a couple of days before the real hardware arrives. Enough time to finish the SPI kernel driver maybe!