I have a Raspberry Pi 2 and I would like to use it to communicate with an SPI device.

The pins from the SPI device have been connected to the appropriate headers on the board, so all that remains is for me to load the correct modules to talk to the device.

I have used raspi-config to enable SPI and to load the module automatically. After rebooting I saw that /dev/spidev0.0 and /dev/spidev0.1 were available for me to read from. I tried to simply run cat /dev/spidev0.0 & and I got an error message: cat: /dev/spidev0.0: Message too long.

When I run lsmod I see that the module spi_bcm2708 is loaded. I was under the impression that the correct module to load is spi_bcm2835, is this the case?

I can't find the location where this module is loaded, it's not listed in /etc/modules, or anywhere that I can see in any of the init.d scripts. Where can I find the module command to change it to use the more up to date module?

Alternatively is there a way to update raspi-config to use the correct module?

1 Answer 1


On recent kernel releases (post 3.18) device tree is used to load hardware kernel modules.

The device tree settings are configured in /boot/config.txt

Name:   spi-bcm2708
Info:   Selects the bcm2708-spi SPI driver
Load:   dtoverlay=spi-bcm2708
Params: <None>

Name:   spi-bcm2835
Info:   Selects the bcm2835-spi SPI driver
Load:   dtoverlay=spi-bcm2835
Params: <None>

So add the line dtoverlay=spi-bcm2835 to /boot/config.txt and reboot.

See /boot/overlays/README

You really need to use a software module to transfer data with a SPI device. For all the devices I have used (not many) you need to read and write a specific number of bytes.

  • Thanks, that's worked. I still get the cat error message but I think you're right and I'm going to have to write some C to interface properly.
    – James
    Commented Aug 20, 2015 at 10:06
  • @Kells1986 I meant to say you need to check there are not conflicting SPI entries in /boot/config.txt. grep "spi" /boot/config.txt should find any.
    – joan
    Commented Aug 20, 2015 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.