3

Is there any documentation for the raspi-config command that would explain what it actually does when enabling i2c?

In the past I have just removed the i2c blacklist, added the modules and made sure the Pi user was in the correct group, reboot and i2c has created the /dev nodes.

But on a new Pi (Raspbian/B+) I could not get it to work until I followed the Advanced option in raspi-config and enbaled i2c there(and rebooted).

8

But on a new Pi (Raspbian/B+) I could not get it to work until I followed the Advanced option in raspi-config and enbaled i2c there(and rebooted).

This is because newer Raspbian kernels use device tree "to manage some resource allocation and module loading":

The main impact of using Device Tree is to change from everything on, relying on module blacklisting to manage contention, to everything off unless requested...

Raspi-config is a shell script in /usr/bin on Raspbian. In the version I'm looking at from a 2015-01-31 image, the "Advanced Option":

Enable/Disable automatic loading of I2C kernel module

Does a couple of things:

    1. It checks /boot/config.txt for an uncommented line beginning w/ device_tree_param= or dtparam=. If it does not find one, it asks,

      Would you like the ARM I2C interface to be enabled?

    If you do, it adds dtparam=i2c_arm=on to the end of /boot/config.txt.

    1. It then looks for an /etc/modprobe.d/raspi-blacklist.conf, which does not exist by default. If it doesn't exist, it creates it, but leaves it empty. Then it asks,

      Would you like the I2C kernel module to be loaded by default?

    If you do, it runs modprobe i2c-bcm2708 (i.e., loads the module) and deletes any line in that raspi-blacklist.conf file beginning with blacklist and i2c-bcm2708 or i2c_bcm2708.

    If you don't, it adds blacklist i2c-bcm2708 to the end of that file if such a line doesn't exist.

Older versions of the script would not have had step #1 because it was not required with older kernels. The i2c module would have been loaded by default, so "enabling" it was just a matter of making sure it wasn't previously blacklisted. Newer versions of the kernel require a line be added to config.txt; you would have to reboot to make this effective.

  • 2
    That is a seriously complete answer. Thanks for your time, this was exactly what I was looking for. – rob Mar 23 '15 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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