2

I am having trouble utilizing the i2c bus on my raspberry pi. I am attempting to use it through Adafruits python module for their Servo driver board. When I run a method using the i2c I get:

IOError: [Errno 2] No such file or directory: '/dev/i2c-1'

When I execute i2cdetect -l I get nothing.

When I execute i2cdetect 1 I get:

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

(The same happens with 0)

I have tried issuing the command sudo modprobe --first-time i2c-dev

To which I receive:

modprobe: ERROR: could not insert 'i2c_dev': Module already in kernel

The results of journalctl | grep modules are in the following image:

journalctl | grep modules

1
  • Also when the pi boots I get: " failed to start load kernel modules "
    – Airfield20
    Feb 13, 2017 at 6:34

2 Answers 2

5

Add the following line to /boot/config.txt

dtparam=i2c_arm=on

Add the following line to /etc/modules

i2c-dev

Reboot

6
  • This did not help. I still have the same exact errors as before.
    – Airfield20
    Feb 13, 2017 at 14:15
  • Is Ubuntu Mate the IoT version? Either way I don't use Mate and if it doesn't properly support device tree you are probably stuffed.
    – joan
    Feb 13, 2017 at 14:26
  • No, it is not the IoT version. Should I be using that? The reason I am using Ubuntu Mate is because I need to install ROS and I had too many issues trying to do that in raspbian jessie.
    – Airfield20
    Feb 13, 2017 at 14:44
  • That is even odder, I could see IoT not being mainstream, but not Ubuntu proper. It should work. Perhaps ask on raspberrypi.org/forums (when it is back up) or a Ubuntu forum. I'm afraid it is a cold hard fact that you will get the best support if you are using Raspbian.
    – joan
    Feb 13, 2017 at 14:50
  • Ubuntu MATE (at least the recent versions) uses Device Tree, and identical kernel and firmware to Raspbian.
    – Milliways
    Feb 13, 2017 at 23:08
2

To enable i2C on the Pi3, do the following:

  1. sudo raspi-config
  2. Choose advanced options
  3. Choose I2C Enable/Disable automatic loading
  4. Follow the prompts to set this to load this automatically
  5. Reboot the Pi

I'd recommend getting the i2C utilities too with:

sudo apt-get install -y i2c-tools

Use:

sudo i2cdetect -y 1

This will display a grid showing what address any devices are using on the i2C bus.

1
  • 1
    raspi-config is definitely not available for Ubuntu Mate the solution you posted is for raspbian. raspi-config is a front end for the /boot/config.txt file. The solution you posted would add dtparam=i2c_arm=on to /boot/config.txt and also remove i2c from the blacklists file if its listed. The answer posted by joan instructs this but also did not work for my pi.
    – Airfield20
    Feb 14, 2017 at 4:32

Your Answer

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

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