I am using I²C to control a Bright Pi module.

I followed instructions from 'Configuring GPIO - Adafruit' and 'Configuring I²C - Adafruit' to set up the I²C. I have done this a few months ago and everything went fine.

This is how I connected the Bright Pi on my Raspberry Pi (Model B):

Circuit Bright Pi

Since today I noticed the I²C doesn't work anymore as it used to. Using the commands like 'sudo i2cdetect -y 1' and 'sudo i2cset -y 1 0x70 0x00 0xff' will give the error:

Could not open file '/dev/i2c-1' or '/dev/i2c/1': No such file or directory

Using the command 'sudo i2cdetect' will give the error

No i2c-bus specified!

which means the i2c-dev is running.

The file '/etc/modules' looks like this:

#/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.

snd-bcm2835
i2c-dev
i2c-bcm2708

The file '/etc/modprobe.d/raspi-blacklist.conf' looks like this:

blacklist spi and i2c by default (many users don't need them)

#blacklist spi-bcm2708
#blacklist i2c-bcm2708
blacklist snd-soc-pcm512x
blacklist snd-soc-wm8804

I've tried reinstalling all required modules, but that didn't help either. Also apt-get update and apt-get upgrade didn't help.

The command 'lsmod | grep i2c' shows this:

i2c_bcm2708          6004  0   
i2c_dev              6709  0

It is strange, because it used to work before. I might think it is "broken" since I did a firmware update two days ago, because my Raspberry Pi was showing weird kernel errors.

How can I fix the problem with the I²C?

up vote 34 down vote accepted

The latest firmware implements device tree support. That will have broken things like I²C, SPI, and 1-wire bus.

For fuller details see I²C, SPI, I2S, LIRC, PPS, stopped working? Read this..

Summary

Add one or more of the following to your /boot/config.txt and reboot.

I2C
No longer add: dtparam=i2c1=on (or dtparam=i2c0=on on old models)
Instead add: dtparam=i2c_arm=on (as this is correctly mapped to 0 or 1 for each model)
A very few users might need: dtparam=i2c_vc=on (for the other i2c interface - see note below)

SPI
Add dtparam=spi=on

I2S
Add dtparam=i2s=on

lirc-rpi
Add dtoverlay=lirc-rpi
Add module parameters to the end of the dtoverlay line,
e.g. dtoverlay=lirc-rpi,gpio_in_pin=16,gpio_in_pull=high

w1-gpio
If you require the external pullup
dtoverlay=w1-gpio-pullup,gpiopin=x,pullup=y
otherwise
dtoverlay=w1-gpio-pullup,gpiopin=x
(where x and y are gpios).

Audio card
Add one of the following
dtoverlay=hifiberry-dac
dtoverlay=hifiberry-dacplus
dtoverlay=hifiberry-digi
dtoverlay=iqaudio-dac
dtoverlay=iqaudio-dacplus

heartbeat LED
dtparam=act_led_trigger=heartbeat

Note: It is recommended that you only use i2c_vc (and i2c_vc_baudrate) if you really need to - for example, if you are programming a HAT EEPROM. Enabling i2c_vc can stop the Pi Camera being detected.

  • You sir, are my hero! This fixed my I2C. – LittleOne Jan 24 '15 at 23:45
  • It fixed mine too, thanks for the hint! – Nicolas Heitz Jan 29 '15 at 22:52

You can use sudo raspi-config and in Advanced Options disable Device Tree. Might be faster than changing the configuration manually.

Or you can just use sudo raspi-config to enable I2C in Advanced Options > I2C.

protected by Community Mar 17 '15 at 15:01

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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