Page 1 of 1

How to use second I2C on B+

Posted: Sun Nov 23, 2014 2:01 pm
by sukisan
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

Re: How to use second I2C on B+

Posted: Sun Nov 23, 2014 2:18 pm
by joan
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.

Re: How to use second I2C on B+

Posted: Sun Nov 23, 2014 2:24 pm
by sukisan
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 ;-)

Re: How to use second I2C on B+

Posted: Sun Nov 23, 2014 2:33 pm
by joan
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.

Re: How to use second I2C on B+

Posted: Sun Nov 23, 2014 2:39 pm
by sukisan
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 ;-)

Re: How to use second I2C on B+

Posted: Sun Nov 23, 2014 7:02 pm
by Richard-TX
There is a thread on enabling i2c-0 on the B+
http://www.raspberrypi.org/forums/viewt ... 44&t=91762

Re: How to use second I2C on B+

Posted: Wed Nov 26, 2014 1:19 pm
by scotty101
You do know that you can connect multiple devices to a single I2C port don't you?

Re: How to use second I2C on B+

Posted: Wed Nov 26, 2014 3:35 pm
by Richard-TX
scotty101 wrote:You do know that you can connect multiple devices to a single I2C port don't you?
yes