alvaro36horas
Posts: 11
Joined: Tue Jun 16, 2015 2:43 pm

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

Tue Jul 07, 2015 11:06 am

Hello,
I have recentry bought a Raspberry pi 2 model B with NOOBS and when I run the command "sudo i2cdetect -y 1" this is the response I get:

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

I have tried almost everything I have seen in other forums with this problem but it seems it does not work for me:
https://learn.adafruit.com/adafruits-ra ... guring-i2c
http://skpang.co.uk/blog/archives/575

Your help will be really welcome,
thank you very much

User avatar
joan
Posts: 15038
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

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

Tue Jul 07, 2015 11:08 am

See http://www.raspberrypi.org/forums/viewt ... 28&t=97314

Summary

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

I2C
Add dtparam=i2c1=on (or dtparam=i2c0=on on old models)

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

alvaro36horas
Posts: 11
Joined: Tue Jun 16, 2015 2:43 pm

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

Tue Jul 07, 2015 12:30 pm

Thank you Joan by I have already done that.
This is the content of /boot/config.txt:

dtparam=i2c1=on
dtparam=i2c=on
dtparam=i2c_arm=on
dtparam=i2c_vc
device_tree_param=i2c=on1=on
dtparam=spi=on

Thank you for your help anyway

User avatar
joan
Posts: 15038
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

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

Tue Jul 07, 2015 12:38 pm

Ok. The command

lsmod|grep i2c

should show the I2C module (i2c_bcm2708).

Code: Select all

lsmod|grep i2c
i2c_bcm2708             5006  0 
You need to manually insert another module

sudo modprobe i2c-dev

Then

Code: Select all

lsmod|grep i2c
i2c_dev                 6047  0 
i2c_bcm2708             5006  0 
To insert the module automatically add the following line to the file /etc/modules.

i2c-dev

alvaro36horas
Posts: 11
Joined: Tue Jun 16, 2015 2:43 pm

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

Tue Jul 07, 2015 1:35 pm

Thank Joan but,
Yes I have already done that and I still have the same problem (Error:Could not open file `/dev/i2c-1': No such file or directory)

After running lsmod|grep i2c, I have:
i2c_dev 6027 0
i2c_bcm2708 4990 0

Thanks a lot anyway,
Any idea apart from that?

alvaro36horas
Posts: 11
Joined: Tue Jun 16, 2015 2:43 pm

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

Tue Jul 07, 2015 1:35 pm

Thank Joan but,
Yes I have already done that and I still have the same problem (Error:Could not open file `/dev/i2c-1': No such file or directory)

After running lsmod|grep i2c, I have:
i2c_dev 6027 0
i2c_bcm2708 4990 0

Thanks a lot anyway,
Any idea apart from that?

User avatar
joan
Posts: 15038
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

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

Tue Jul 07, 2015 1:39 pm

As far as I am aware the only other reason it would fail would be if you include the i2c_bcm2708 module in /etc/modules as well as enabling I2C in device tree.

I'd also try removing some of the repeat I2C entries in your /boot/config.txt, perhaps just leaving dtparam=i2c0=on and dtparam=i2c1=on.

alvaro36horas
Posts: 11
Joined: Tue Jun 16, 2015 2:43 pm

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

Tue Jul 07, 2015 2:23 pm

Thanks Joan but,
I have only put these two lines in the /boot/config.txt and again the same problem.

:(

User avatar
joan
Posts: 15038
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

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

Tue Jul 07, 2015 2:35 pm

Device tree needs a recent (>3.18) kernel.

uname -a

It's hard to think of anything else which can go wrong. Are you using raspbian?

alvaro36horas
Posts: 11
Joined: Tue Jun 16, 2015 2:43 pm

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

Tue Jul 07, 2015 2:50 pm

uname -a gives:

Linux raspberry0 3.18.7-v7+ #755 SMP PREEMPT Thu Feb 12 17:20:48 GMT 2015 arm7l GNU/Linux

cat /etc/issue gives:
Raspbian GNU/Linux 7 \n \l

REALLY, THANK A LOT FOR ALL YOUR FAST HELP

User avatar
joan
Posts: 15038
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

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

Tue Jul 07, 2015 3:19 pm

I'm out of ideas.

I've just checked my Pi2.

It has one I2C entry in /boot/config.txt

Code: Select all

 grep i2c /boot/config.txt
dtparam=i2c_arm=on
I don't have anything in /etc/modules as I modprobe i2c-dev manually when I want to use I2C.

It should just work.

alvaro36horas
Posts: 11
Joined: Tue Jun 16, 2015 2:43 pm

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

Tue Jul 07, 2015 3:52 pm

Thank you Joan,

I don't really know what to do. I have another raspberry 2 model B. I think I will try with this second one

Thank you very much for your help anyway

User avatar
DougieLawson
Posts: 39821
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

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

Tue Jul 07, 2015 4:02 pm

If you're using NOOBS then hold the [SHIFT] key during boot so you can use the NOOBS recovery system to edit your config.txt.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

alvaro36horas
Posts: 11
Joined: Tue Jun 16, 2015 2:43 pm

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

Thu Jul 09, 2015 9:50 am

Thank Dougie,
that is starting again from scratch,
ok I did it and I am starting again,
I will see if it solves the problem,
I will post the result,
Álvaro

alvaro36horas
Posts: 11
Joined: Tue Jun 16, 2015 2:43 pm

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

Thu Jul 09, 2015 10:07 am

Ah!, I forget it,
This is what someone said in another forum:
"I've spent a lot time in the module loading maze. You can edit /etc/modules, like adafruit link above or you can use the device tree enabled raspi-config and setup in /boot/config.txt. I found the DT has good debug notes here: https://www.raspberrypi.org/documentati ... ce-tree.md

cat /proc/modules shows loaded modules."

Adafruit link is this (I've already tried this):
https://learn.adafruit.com/adafruits-ra ... guring-i2c

And I see that in the other link
(https://www.raspberrypi.org/documentati ... ce-tree.md) seems to be quite tough, but if there is no choice I'll try this way.

Thanks all

AndreaK
Posts: 1
Joined: Tue Mar 24, 2020 7:12 pm

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

Tue Mar 24, 2020 7:19 pm

Hi,
I'm new here.
I tried to set my raspberry pi 3 to work with an ADS module (ADS1015) and I found the same error discussed in this article. I know this is 5 years old but did someone find a way to fix it?
Thank you.

ewhalvorsen
Posts: 1
Joined: Sun Aug 16, 2020 7:57 pm

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

Sun Aug 16, 2020 8:04 pm

Have you enabled the i2c interface on the device?
raspi-config -> Interfacing Options -> I2C - > Enable

mtrobert
Posts: 1
Joined: Thu Aug 20, 2020 5:55 am

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

Thu Aug 20, 2020 5:58 am

ewhalvorsen wrote:
Sun Aug 16, 2020 8:04 pm
Have you enabled the i2c interface on the device?
raspi-config -> Interfacing Options -> I2C - > Enable
:D Brilliant Simple Solution that works!

Return to “Interfacing (DSI, CSI, I2C, etc.)”