My Account

Wish List (0)

Saved Carts

Compare

Approved Re-Seller
Follow us on Facebook! Follow us on Twitter! Follow us on Instagram!

Loading I2C, SPI and 1-Wire drivers on the Raspberry Pi under Raspbian "wheezy"

April 16, 2014

On many Raspberry Pi distributions, including Raspbian, the SPI and I2C device drivers are not loaded by default on boot. The file named '/etc/modprobe.d/raspi-blacklist.conf' indicates which kernel modules must not be loaded. Since I2C and SPI, aren't needed by most users, they need to be explicitly removed from that list by placing a '#' mark (comment) in front of the 'blacklist' command.

Edit and save '/etc/modprobe.d/raspi-blacklist.conf' as shown below.

nano /etc/modprobe.d/raspi-blacklist.conf
# blacklist spi and i2c by default (many users don't need them)
#blacklist spi-bcm2708
#blacklist i2c-bcm2708

Then, to gain access to I2C, SPI and 1-Wire devices, their respective device drivers must be loaded, either manually using the 'modprobe' command or on boot.

To load them on boot, edit and save the file named '/etc/modules' as shown below.

nano /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.
#
# sound devices
snd-bcm2835
# SPI devices
spi-dev
# I2C devices
i2c-dev
# 1-Wire devices
w1-gpio
# 1-Wire thermometer devices
w1-therm

Finally, reboot the Raspberry Pi' with the 'reboot' command to get all the kernel module drivers loaded or use the modprobe command if you don't want to reboot the machine.

Verify that all the kernel module drivers have been loaded as expected with the 'lsmod' command.

root@raspberrypi:/# lsmod
Module                  Size  Used by
w1_therm                2705  0
w1_gpio                 1283  0
wire                   23530  2 w1_gpio,w1_therm
cn                      4649  1 wire
i2c_dev                 5587  0
snd_bcm2835            12808  0
snd_pcm                74834  1 snd_bcm2835
snd_seq                52536  0
snd_timer              19698  2 snd_seq,snd_pcm
snd_seq_device          6300  1 snd_seq
snd                    52489  5 snd_seq_device,snd_timer,snd_seq,snd_pcm,snd_bcm2835
snd_page_alloc          4951  1 snd_pcm
spidev                  5136  0
i2c_bcm2708             3681  0
spi_bcm2708             4401  0

 

Last update: September 04, 2015

3 Comments(2 Replies)

Leave a Comment

Leave a Reply

* Name:
* Comment:
* E-mail: (Not Published)
Website: (Site url with http://)
Verification code: