sukisan
Posts: 10
Joined: Mon Jul 07, 2014 10:20 pm

How to use second I2C on B+

Sun Nov 23, 2014 2:01 pm

Hi,

I'm using both I2C interfaces on my model B. To do so, I configured GPIO 28 & 29 to be in their ALT0 function. I'd really love to switch to the A+, because it's much smaller.

I already figured out that the A+ and B+ pinouts are identical.

Question is: is it save to connect an I2C device to GPIO0/1 (ID_SD and ID_SC) which does not have an EEPROM?

I'm using a buch of these: https://www.adafruit.com/products/815 with a PCA9685 chip

I already read the Add-on board design guide:
GPIO Configuration Sequencing wrote:The one exception to this rule is ID_SC and ID_SD. On a Model B+, GPIO0 (ID_SD) and GPIO1 (ID_SC) will be switched to ALT0 (I2C-0) mode and probed for an EEPROM. These pins will revert to inputs once the probe sequence has completed.
ID EEPROM wrote:Within the set of pins available on the J8 GPIO header, ID_SC and ID_SD (GPIO0/SCL and GPIO1/SDA) are reserved for board detection / identification. The only allowed connections to the ID_ pins are an ID EEPROM plus 3.9K pull up resistors. Do not connect anything else to these pins!
The second paragraph kind of scares me. Am I allowed to connect my extension board? After all it's a I2C chip, but it's not an EEPROM. Am I only allowed to connect after the probing completed? And what about the pull up resistors? On the model B resistors could be configured for the GPIO pins, I read that's true for the B+ too - will that work like before?

Thanks,
Suki

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

Re: How to use second I2C on B+

Sun Nov 23, 2014 2:18 pm

You need to set gpios 0/1 to mode ALT0.

You need to set gpios 28/29 to mode INPUT (actually probably anything but ALT0 would work).

You need to add pull-ups to 3V3 on gpios 0/1 (the B+ doesn't have hardware pull-ups for those gpios). I don't think that using internal pull-ups will be reliable. The B use 1K8 pull-ups to 43V3.

Edited to add:

You need to add bcm2708.vc_i2c_override=1 to the command line in /boot/cmdline.txt.

You need to modprobe i2c_bcm2708 to make /dev/i2c-0 and /dev/i2c-1 available.
Last edited by joan on Sun Nov 23, 2014 2:34 pm, edited 1 time in total.

sukisan
Posts: 10
Joined: Mon Jul 07, 2014 10:20 pm

Re: How to use second I2C on B+

Sun Nov 23, 2014 2:24 pm

Thanks joan for the quick response!

The A+ is already ordered. I'm still a bit afraid I'll fry it by just connecting the board, due to the explicit warning - I'll let you know how it went ;-)

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

Re: How to use second I2C on B+

Sun Nov 23, 2014 2:33 pm

I forgot to say you also need to add bcm2708.vc_i2c_override=1 to the command line in /boot/cmdline.txt.

For completeness I'll also mention the need to modprobe i2c_bcm2708 to make /dev/i2c-0 and /dev/i2c-1 available.

sukisan
Posts: 10
Joined: Mon Jul 07, 2014 10:20 pm

Re: How to use second I2C on B+

Sun Nov 23, 2014 2:39 pm

Thanks again!

Your hint brought me to B+ disable ID_EEPROM. Just as follow up for someone who might stumble over this thread.
ShiftPlusOne wrote:The firmware will check for an attached eeprom first, but that shouldn't affect your device.
I'm not afraid anymore ;-)

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

Re: How to use second I2C on B+

Sun Nov 23, 2014 7:02 pm

There is a thread on enabling i2c-0 on the B+
http://www.raspberrypi.org/forums/viewt ... 44&t=91762
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

scotty101
Posts: 3649
Joined: Fri Jun 08, 2012 6:03 pm

Re: How to use second I2C on B+

Wed Nov 26, 2014 1:19 pm

You do know that you can connect multiple devices to a single I2C port don't you?
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

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

Re: How to use second I2C on B+

Wed Nov 26, 2014 3:35 pm

scotty101 wrote:You do know that you can connect multiple devices to a single I2C port don't you?
yes
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

Return to “Advanced users”