User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: B+, i2c-0, and Jessie

Tue Nov 25, 2014 2:22 am

To enable i2c-0 on a B+ you have to add
bcm2708.vc_i2c_override=1
to /boot/cmdline.txt and then reboot.

My cmdline looks like this:

Code: Select all

dwc_otg.lpm_enable=0 bcm2708.vc_i2c_override=1 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
Once that is done, then you have to run the script I posted above and then i2c-0 will be alive.

To run the script every time it boots, place the full pathname in rc.local before the "exit 0" statement.
Also make sure the script is executable (chmod 755 scriptname)
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

jam1
Posts: 47
Joined: Tue Oct 21, 2014 5:51 pm

Re: B+, i2c-0, and Jessie

Tue Nov 25, 2014 11:14 pm

Thank you,
Finally got /dev/i2c-0 .

The problem was that I was putting the overide command on a separate line in cmdline.txt. It as to be a single continuous line it seems.

User avatar
rpdom
Posts: 14717
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: B+, i2c-0, and Jessie

Wed Nov 26, 2014 7:13 am

Yes, cmdline.txt must only contain one line.

It contains the command line (hence the name) that is passed to the Linux kernel when it is loaded.

LikesAChallenge
Posts: 32
Joined: Fri Dec 05, 2014 3:39 pm

Re: B+, i2c-0, and Jessie

Fri Dec 05, 2014 3:55 pm

Having the same problem here now.

I'm using two AM2315 sensors which you can't apparently change the address of, so a second I2C bus is crucial.

This is my cmdline.txt:

Code: Select all

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait bcm2708.vc_i2c_override=1

When I run the i2cdetect I get this:

Code: Select all

[email protected] ~ $ sudo i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
[email protected] ~ $ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- -- 
gpio readall shows:

Code: Select all

 +-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   2 |   8 |   SDA.1 | ALT0 | 1 |  3 || 4  |   |      | 5V      |     |     |
 |   3 |   9 |   SCL.1 | ALT0 | 1 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 |   IN | 1 |  7 || 8  | 1 | ALT0 | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 1 | ALT0 | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 |   IN | 0 | 11 || 12 | 0 | IN   | GPIO. 1 | 1   | 18  |
 |  27 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |
 |  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
 |  10 |  12 |    MOSI |   IN | 0 | 19 || 20 |   |      | 0v      |     |     |
 |   9 |  13 |    MISO |   IN | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK |   IN | 0 | 23 || 24 | 1 | IN   | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 1 | IN   | CE1     | 11  | 7   |
 |   0 |  30 |   SDA.0 | ALT0 | 1 | 27 || 28 | 1 | ALT0 | SCL.0   | 31  | 1   |
 |   5 |  21 | GPIO.21 |   IN | 1 | 29 || 30 |   |      | 0v      |     |     |
 |   6 |  22 | GPIO.22 |   IN | 1 | 31 || 32 | 0 | IN   | GPIO.26 | 26  | 12  |
 |  13 |  23 | GPIO.23 |   IN | 0 | 33 || 34 |   |      | 0v      |     |     |
 |  19 |  24 | GPIO.24 |   IN | 0 | 35 || 36 | 0 | IN   | GPIO.27 | 27  | 16  |
 |  26 |  25 | GPIO.25 |   IN | 0 | 37 || 38 | 0 | IN   | GPIO.28 | 28  | 20  |
 |     |     |      0v |      |   | 39 || 40 | 0 | IN   | GPIO.29 | 29  | 21  |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+

And I've run that python script for the B+ in this thread with no change.

If swap the sensors from I2C1 to 0 and vice-versa the other sensor works fine.

They are wired up as shown here: http://forums.adafruit.com/viewtopic.ph ... 30#p252191

I've also added 2.2K (no 1.8K laying about) resistors inline with the i2c0 connectors with no success.

Is my pi configured correctly?

Thanks!

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

Re: B+, i2c-0, and Jessie

Fri Dec 05, 2014 6:25 pm

Have you any means of checking the modes of gpios 28/29? Gpios 28/29 should not be ALT0.

LikesAChallenge
Posts: 32
Joined: Fri Dec 05, 2014 3:39 pm

Re: B+, i2c-0, and Jessie

Fri Dec 05, 2014 8:24 pm

joan wrote:Have you any means of checking the modes of gpios 28/29? Gpios 28/29 should not be ALT0.
Do you mean 27/28?

To be perfectly honest I don't know what your asking! :P

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

Re: B+, i2c-0, and Jessie

Fri Dec 05, 2014 8:37 pm

LikesAChallenge wrote: ...
To be perfectly honest I don't know what your asking! :P
I2C bus 0 is normally implemented by gpios 28/29 for internal use. These gpios are inaccessible to the user. So you have to transfer the functionality of gpios 28/29 to gpios 0/1. This is done by switching gpios 0/1 into mode ALT0 and switching gpios 28/29 to any other mode but ALT0. Your post shows gpios 0/1 are now ALT0. It doesn't show the mode of gpios 28/29 which must not be ALT0.

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: B+, i2c-0, and Jessie

Sat Dec 06, 2014 6:18 am

I would recommend the following

1 - use the cmdline that I posted
2 - disable the tas5713 driver by executing this:
echo "blacklist snd_soc_tas5713" >> //etc/modprobe.d/raspi-blacklist.conf
reboot
3 run the python script i posted.

after that i2c-0 should be working.
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

LikesAChallenge
Posts: 32
Joined: Fri Dec 05, 2014 3:39 pm

Re: B+, i2c-0, and Jessie

Sat Dec 06, 2014 10:55 am

That worked a treat.

Thanks very much!

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: B+, i2c-0, and Jessie

Sat Dec 06, 2014 2:49 pm

LikesAChallenge wrote:That worked a treat.

Thanks very much!
You are welcome.
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

SeanM
Posts: 1
Joined: Sun Dec 07, 2014 4:36 am

Re: B+, i2c-0, and Jessie

Sun Dec 07, 2014 4:53 am

by Richard-TX » Sat Dec 06, 2014 6:18 am
I would recommend the following

1 - use the cmdline that I posted
2 - disable the tas5713 driver by executing this:
echo "blacklist snd_soc_tas5713" >> //etc/modprobe.d/raspi-blacklist.conf
reboot
3 run the python script i posted.
I followed this but I still cannot see any devices on i2c0.
I have added pullup resistors and connected an adafruit 7-segment display.
I noticed that pin 28 SCL.0 is reading 0 even with pullup, I checked with a meter and it is being pulled low by the gpio pin. i2c1 had an unfortunate accident with 10 volts and now responds to every address even with nothing connected, hence my need for an alternative. Do you have any suggestions please?

Code: Select all

 +-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   2 |   8 |   SDA.1 | ALT0 | 0 |  3 || 4  |   |      | 5V      |     |     |
 |   3 |   9 |   SCL.1 | ALT0 | 1 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 |   IN | 1 |  7 || 8  | 1 | ALT0 | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 1 | ALT0 | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 |   IN | 0 | 11 || 12 | 0 | IN   | GPIO. 1 | 1   | 18  |
 |  27 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |
 |  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
 |  10 |  12 |    MOSI | ALT0 | 0 | 19 || 20 |   |      | 0v      |     |     |
 |   9 |  13 |    MISO | ALT0 | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK | ALT0 | 0 | 23 || 24 | 1 | ALT0 | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 1 | ALT0 | CE1     | 11  | 7   |
 |   0 |  30 |   SDA.0 | ALT0 | 1 | 27 || 28 | 0 | ALT0 | SCL.0   | 31  | 1   |
 |   5 |  21 | GPIO.21 |   IN | 1 | 29 || 30 |   |      | 0v      |     |     |
 |   6 |  22 | GPIO.22 |   IN | 1 | 31 || 32 | 0 | IN   | GPIO.26 | 26  | 12  |
 |  13 |  23 | GPIO.23 |   IN | 0 | 33 || 34 |   |      | 0v      |     |     |
 |  19 |  24 | GPIO.24 |   IN | 0 | 35 || 36 | 0 | IN   | GPIO.27 | 27  | 16  |
 |  26 |  25 | GPIO.25 |   IN | 0 | 37 || 38 | 0 | IN   | GPIO.28 | 28  | 20  |
 |     |     |      0v |      |   | 39 || 40 | 0 | IN   | GPIO.29 | 29  | 21  |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: B+, i2c-0, and Jessie

Sun Dec 07, 2014 6:43 am

SeanM wrote:
by Richard-TX » Sat Dec 06, 2014 6:18 am
i2c1 had an unfortunate accident with 10 volts and now responds to every address even with nothing connected, hence my need for an alternative. Do you have any suggestions please?
Buy a new Rpi. Microcenter has them on sale for $30 (USA)
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

LaurentG
Posts: 1
Joined: Tue Jan 20, 2015 12:57 pm

Re: B+, i2c-0, and Jessie

Tue Jan 20, 2015 1:10 pm

Hi all,

I followed the discussion in that post and still can't get any device detected on i2c-0 on my B+

Added the overide,

Code: Select all

[email protected] ~ $ more /boot/cmdline.txt
dwc_otg.lpm_enable=0 bcm2708.vc_i2c_override=1  root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
blacklisted stuff to get rif of UU stuff

Code: Select all

[email protected] ~ $ more /etc/modprobe.d/i2c_0_enable.conf
blacklist snd_soc_tas5713
Now nothing reads on the bus, despite I connected either an MCP9808 (adafruit),
or a LSM9DS0 (adafruit).

Code: Select all

[email protected] ~ $ sudo i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
Both sensors read fine on I2C-1

Code: Select all

[email protected] ~ $ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- 04 -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- 18 -- -- -- 1d -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- 6b -- -- -- --
70: -- -- -- -- -- -- -- --
I've checked the pins status, looks good (although it's not clear from previous posts what we should read exactly :

Code: Select all

[email protected] ~ $ sudo gpio readall
 +-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   2 |   8 |   SDA.1 | ALT0 | 1 |  3 || 4  |   |      | 5V      |     |     |
 |   3 |   9 |   SCL.1 | ALT0 | 1 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 |   IN | 1 |  7 || 8  | 1 | ALT0 | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 0 | ALT0 | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 |   IN | 0 | 11 || 12 | 0 | IN   | GPIO. 1 | 1   | 18  |
 |  27 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |
 |  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
 |  10 |  12 |    MOSI | ALT0 | 0 | 19 || 20 |   |      | 0v      |     |     |
 |   9 |  13 |    MISO | ALT0 | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK | ALT0 | 0 | 23 || 24 | 1 | ALT0 | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 1 | ALT0 | CE1     | 11  | 7   |
 |   0 |  30 |   SDA.0 | ALT0 | 1 | 27 || 28 | 1 | ALT0 | SCL.0   | 31  | 1   |
 |   5 |  21 | GPIO.21 |   IN | 1 | 29 || 30 |   |      | 0v      |     |     |
 |   6 |  22 | GPIO.22 |   IN | 1 | 31 || 32 | 0 | IN   | GPIO.26 | 26  | 12  |
 |  13 |  23 | GPIO.23 |   IN | 0 | 33 || 34 |   |      | 0v      |     |     |
 |  19 |  24 | GPIO.24 |   IN | 0 | 35 || 36 | 0 | IN   | GPIO.27 | 27  | 16  |
 |  26 |  25 | GPIO.25 |   IN | 0 | 37 || 38 | 0 | IN   | GPIO.28 | 28  | 20  |
 |     |     |      0v |      |   | 39 || 40 | 0 | IN   | GPIO.29 | 29  | 21  |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+
When running i2c detect on bus 0, I see clock/data lines changing as expected.

If I try to run the python script provided above, then unfortunately, SDA0/SCL0 becomes stuck to 3.3V
(so no way it will work ....)

Code: Select all

[email protected] ~ $ sudo python i2c0.py
B+ or CM detected.
Here is gpio status after python script was run

Code: Select all

[email protected]-LG-01 ~ $ sudo gpio readall
 +-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   2 |   8 |   SDA.1 | ALT0 | 1 |  3 || 4  |   |      | 5V      |     |     |
 |   3 |   9 |   SCL.1 | ALT0 | 1 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 |   IN | 1 |  7 || 8  | 1 | ALT0 | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 0 | ALT0 | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 |   IN | 0 | 11 || 12 | 0 | IN   | GPIO. 1 | 1   | 18  |
 |  27 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |
 |  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
 |  10 |  12 |    MOSI | ALT0 | 0 | 19 || 20 |   |      | 0v      |     |     |
 |   9 |  13 |    MISO | ALT0 | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK | ALT0 | 0 | 23 || 24 | 1 | ALT0 | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 1 | ALT0 | CE1     | 11  | 7   |
 |   0 |  30 |   SDA.0 | ALT0 | 1 | 27 || 28 | 1 | ALT0 | SCL.0   | 31  | 1   |
 |   5 |  21 | GPIO.21 |   IN | 1 | 29 || 30 |   |      | 0v      |     |     |
 |   6 |  22 | GPIO.22 |   IN | 1 | 31 || 32 | 0 | IN   | GPIO.26 | 26  | 12  |
 |  13 |  23 | GPIO.23 |   IN | 0 | 33 || 34 |   |      | 0v      |     |     |
 |  19 |  24 | GPIO.24 |   IN | 0 | 35 || 36 | 0 | IN   | GPIO.27 | 27  | 16  |
 |  26 |  25 | GPIO.25 |   IN | 0 | 37 || 38 | 0 | IN   | GPIO.28 | 28  | 20  |
 |     |     |      0v |      |   | 39 || 40 | 0 | IN   | GPIO.29 | 29  | 21  |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+--B Plus--+---+------+---------+-----+-----+
Here is CPU info just in case (it shows up as a B+, rev 10)

Code: Select all

[email protected] ~ $ cat /proc/cpuinfo
processor       : 0
model name      : ARMv6-compatible processor rev 7 (v6l)
Features        : swp half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2708
Revision        : 0010
Serial          : 0000000xxxxxxxxx

Any idea what could go wrong there ?

Rgds
Laurent

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: B+, i2c-0, and Jessie

Tue Jan 20, 2015 6:04 pm

I will grab my B+ and try it here. It will be later tonight as I am in the middle of another project at the moment.
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

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

Re: B+, i2c-0, and Jessie

Tue Jan 20, 2015 8:22 pm

Are there any pull-ups to 3V3 on the SDA/SCL pins you are using?

radziu88
Posts: 5
Joined: Mon Mar 07, 2016 8:47 pm

Re: B+, i2c-0, and Jessie

Mon Mar 07, 2016 8:57 pm

have problem with my B+ I2C0
I add
bcm2708.vc_i2c_override=1 to cmdline.txt

Code: Select all

 more /boot/cmdline.txt
dwc_otg.lpm_enable=0 bcm2708.vc_i2c_override=1 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadl
ine fsck.repair=yes rootwait
i used script from this topic ( upgraded version ) and get result

Code: Select all

[email protected]:~ $ sudo ./i2c0_en.py 
B+ or CM detected.
[email protected]:~ $ 
and still don't have i2c0

Code: Select all

ls /dev/i
i2c-1    initctl  input/   
my config.txt have added lines for i2c

Code: Select all

tail -10 /boot/config.txt 
# Uncomment this to enable the lirc-rpi module
#dtoverlay=lirc-rpi

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

dtparam=i2c1=on
dtparam=i2c_arm=on
my /etc/modules looks like

Code: Select all

 more /etc/modules
# /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.

i2c-bcm2708 
i2c-dev
I2c1 works fine.

Please help

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7008
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: B+, i2c-0, and Jessie

Mon Mar 07, 2016 9:45 pm

Life got simpler with device tree.
Add "dtparam=i2c_vc=on" to config.txt. Ensure "i2c-dev" is in /etc/modules (it must be if you've got /dev/i2c-1). Job done.
Actually having i2c_bcm2708 in /etc/modules may cause problems. It's not needed with device tree.

Just don't try to use the camera or official display as they're unlikely to work, and may cause unreliability on your i2c use too.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

radziu88
Posts: 5
Joined: Mon Mar 07, 2016 8:47 pm

Re: B+, i2c-0, and Jessie

Tue Mar 08, 2016 9:23 am

THX works like a charm

arduinobeer
Posts: 6
Joined: Wed Jun 08, 2016 7:08 am

Re: B+, i2c-0, and Jessie

Wed Jun 08, 2016 7:19 am

Sorry to dig this out again...

I'm on a B+ and want to read from two BMP085 barometric sensors.

After reading this whole thing and a lot of tuts I added "dtparam=i2c_vc=on" to config.txt and ensured "i2c-dev" is in /etc/modules.

When I wire the bmp085 to i2c1 I get the correct "sudo i2cdetect -y 1" readout with its address 77.

When I wire its SCL to pin 28 and its SDA to pin 27 I do get a "sudo i2cdetect -y 0" readout, but without any addresses.

Since some people suggest putting 1k8 pullup resistors I also tried with 2k2 resistors in series in the SCL and SDA lines, without success.

What am I missing?

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

Re: B+, i2c-0, and Jessie

Wed Jun 08, 2016 8:08 am

arduinobeer wrote:Sorry to dig this out again...

I'm on a B+ and want to read from two BMP085 barometric sensors.

After reading this whole thing and a lot of tuts I added "dtparam=i2c_vc=on" to config.txt and ensured "i2c-dev" is in /etc/modules.

When I wire the bmp085 to i2c1 I get the correct "sudo i2cdetect -y 1" readout with its address 77.

When I wire its SCL to pin 28 and its SDA to pin 27 I do get a "sudo i2cdetect -y 0" readout, but without any addresses.

Since some people suggest putting 1k8 pullup resistors I also tried with 2k2 resistors in series in the SCL and SDA lines, without success.

What am I missing?
You need separate pull-ups on pins 27(SDA) and 28(SCL) to 3V3. 2k2 should be fine.

If that doesn't work your connections may be wrong.

A photo will help.

You shouldn't be using sudo. Make sure the user is in the i2c group (e.g. sudo adduser pi i2c).

Massi
Posts: 1691
Joined: Fri May 02, 2014 1:52 pm
Location: Italy

Re: B+, i2c-0, and Jessie

Wed Jun 08, 2016 8:17 am

From the datasheet, you can simply use the XCLR input to use 2 concurrent BMP085 sensors on the same bus.

Btw, a pullup is not "in series in the sda scl lines", it is between sda and scl AND Vcc

arduinobeer
Posts: 6
Joined: Wed Jun 08, 2016 7:08 am

Re: B+, i2c-0, and Jessie

Wed Jun 08, 2016 9:52 am

So what you guys want me to do is this:
RPIbmp085.png
RPIbmp085.png (53.38 KiB) Viewed 2341 times
@Massi: I do not want to do that XCLR trick, results seem to be rather mixed and slow... But thanks for the pullup heads up...
@joan: I already added pi to i2c, just didn't think about... :?

Massi
Posts: 1691
Joined: Fri May 02, 2014 1:52 pm
Location: Italy

Re: B+, i2c-0, and Jessie

Wed Jun 08, 2016 10:06 am

that is a pullup.
hint: your setup will not work if you change your B+ with a 3B (that's why i was suggesting a different way of doing that..)

arduinobeer
Posts: 6
Joined: Wed Jun 08, 2016 7:08 am

Re: B+, i2c-0, and Jessie

Wed Jun 08, 2016 4:43 pm

@Massi: I'm aware of that.

So I tried again, rewired everything correctly, with the pullups in the correct place.

Without success.

On "i2cdetect -y 1" I get my 77, but not on "i2cdetect -y 0".

A gpio readall gives me ALT0 for pins 27&28. Is that a good sign?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7008
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: B+, i2c-0, and Jessie

Wed Jun 08, 2016 4:57 pm

arduinobeer wrote:So I tried again, rewired everything correctly, with the pullups in the correct place.

Without success.

On "i2cdetect -y 1" I get my 77, but not on "i2cdetect -y 0".

A gpio readall gives me ALT0 for pins 27&28. Is that a good sign?
I was discussing this one with PhilE just the other day.
Please post the output from "sudo raspi-gpio get" ("sudo apt-get install raspi-gpio" if not already installed).
I suspect you have I2C-0 mapped to both GPIOs 0&1, and GPIOS 28&29.

If I've got the runes right, please try

Code: Select all

sudo raspi-gpio set 28 ip
sudo raspi-gpio set 29 ip
which should map those pins back to inputs and allow comms on 0&1 to work.

NB I'm using BRCM GPIO numbers, not pin numbers on the 40 pin header.
(edit: correct typo in raspi-gpio commands - thanks for picking it up arduinobeer)
Last edited by 6by9 on Wed Jun 08, 2016 8:48 pm, edited 1 time in total.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

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