0

I'm trying to make I2C work on my Raspberry Pi 2 model B. Output of uname -a for software/kernel info:

Linux raspberrypi2 4.1.7v7-aufs #1 SMP PREEMPT Wed Sep 16 13:19:27 CEST 2015 armv7l GNU/Linux

I added the line dtparam=i2cin /boot/config.txt and i2c-dev in /etc/modules. The correct modules get loaded at boot, as I can see with lsmod.

However, I2C still doesn't work. If I run i2cdetect -y 1 I get

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

If I run ls -l /dev/*i2c* I get a "No such file or directory" error. What should I do? Thanks.

17
  • Did you reboot after enabling the i2c modules? Mar 11, 2016 at 15:25
  • @SteveRobillard I did Mar 11, 2016 at 15:26
  • Have you tried enabling I2C via raspi-config? Mar 11, 2016 at 15:30
  • @SteveRobillard yes. Mar 11, 2016 at 15:36
  • 1
    sudo modprobe i2c_bcm2708 and sudo modprobe i2c_dev?
    – joan
    Mar 11, 2016 at 18:37

2 Answers 2

5

Initially Enable the I2C protocol feature in raspberry pi:

  1. sudo raspi-config
  2. Enable the I2C
  3. Reboot your system
  4. Connect the I2C device to its SDA and SCL pin respectively refer the pin out of raspberry pi.
  5. Meanwhile also add two line in the mention path :sudo nano /etc/modules -- # i2c-bcm2708 -- i2c-dev
  6. Now cross check whether the correct connection are made or not
  7. Go to the terminal and type "sudo i2cdetect -y 1" it will list all the connected peripheral with raspberry pi
  8. If the address of the connected device is shown then initial validation is over.
  9. Further you can proceed with your program.
2

Open terminal

sudo raspi-config

Select

5 Interfacing Options

Select

P5 I2C

Select "Yes" when asked "Would you like the ARM I2C interface to be enabled?"

Your Answer

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

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