Contents Up Previous Next

Loading Drivers at Startup

At your option you can have device drivers for I2C, SPI and 1 Wire loaded at system startup.

You can, of course, load the device drivers dynamically using modprobe but you must be running with root ( administrator ) permissions to do so.

One advantage of loading the device drivers during system startup is that you can configure your system to allow access to the devices for none root users.

These configuration options would also apply if the device drivers are loaded using modprobe, but the process calling modprobe would need root permissions itself.

For setting none root permissions on loaded devices see:

Removing Blacklist Settings for SPI and I2C

The base kernel drivers for I2C and SPI have a blacklist setting in the Raspbian configuration files that prevents them from being loaded automatically (the normal setting). The settings notes that this is because many users don't need them.

The blacklist configuration file is '/etc/modprobe.d/raspi-blacklist.conf' and you need to edit it if you want to load SPI and/or I2C drivers.

sudo nano /etc/modprobe.d/raspi-blacklist.conf

This will open the file in the nano text editor.

Comment out the blacklist lines for the module(s) you wish to have loaded at startup time. In the above example the blacklist setting for both SPI and I2C have been commented out.

You can save your changes with:

<Ctrl> X
Y
<enter>

Configuring Optional Module Load

Other modules you may require are never loaded automatically but must be specified in your system configuration files.

The file you must edit to add any optional modules is '/etc/modules'.

You should edit this file with:

sudo nano /etc/modules

This will open the file in the nano text editor.

The entry for 'snd-bcm2835' should already exist.

Add the line for 'i2c-dev' if you wish to use I2C and the two lines 'w1-gpio' and 'w1-therm' if you wish to use the kernel 1 Wire driver.

You can save your changes with:

<Ctrl> X
Y
<enter>

During your next system startup the selected drivers will be loaded.

See the individaul driver pages for information on managing permissions on loaded devices.





Contents Up Previous Next


HiPi Modules Copyright © 2013 Mark Dootson