User avatar
AirRietveld
Posts: 26
Joined: Tue Jun 24, 2014 1:53 pm
Location: Groningen
Contact: Website

I2C GPIO

Tue Jun 24, 2014 2:06 pm

I'm implementing the Compute module in flight simulation hardware. I need I2C to communicate with a PIC16, but I am not really sure which GPIO's are I2C SDA and SCL. I see them on J6 for example as CD0_SDA, CD0_SCL, CD1_SDA and CD1_SCL. But those don't show on the SO-DIMM, also I am not really sure if these are the ones GPIO's I need to use.
This http://www.raspberrypi.org/documentatio ... -camera.md talks about GPIO0 and GPIO1 for CD1_SDA and CD1_SCL, but again I am not a 100% sure if these are the ones to use to communicate with the PIC16.

Is there somebody who is sure about which GPIO's to use? Thank you in advance.

User avatar
[email protected]
Posts: 2020
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: I2C GPIO

Tue Jun 24, 2014 9:39 pm

I've not tried it yet, but you'll want to use gpio 2 (sda) and gpio 3 (scl) for your I2c. (J5:5 and J5:7) You'll also need to fit pull-ups somewhere.

Loading the I2C module should set the pins in the right mode and off you go - same as a Rev 2 Pi.

Gpio 0 and 1 are also I2C - the Pi has 2 I2C interfaces. They were the ones used on the Rev 1 board before they switched to the other port - why you need to specify port 1 in e.g. i2cdtect -y 1 rather than i2cdetect -y 0 on a Rev 1.

-Gordon
--
Gordons projects: https://projects.drogon.net/

User avatar
AirRietveld
Posts: 26
Joined: Tue Jun 24, 2014 1:53 pm
Location: Groningen
Contact: Website

Re: I2C GPIO

Wed Jun 25, 2014 6:38 am

Thank you for your advice Gordon, I will use GPIO 2 and 3.

arm2
Posts: 253
Joined: Thu Dec 15, 2011 3:46 pm

Re: I2C GPIO

Wed Jun 25, 2014 8:52 am

Re SDA & SCL "You'll also need to fit pull-ups somewhere." I've always understood that BCM2835 has internal pull ups. There are many standard Pi boards that don't have pull ups.

User avatar
[email protected]
Posts: 2020
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: I2C GPIO

Wed Jun 25, 2014 8:59 am

arm2 wrote:Re SDA & SCL "You'll also need to fit pull-ups somewhere." I've always understood that BCM2835 has internal pull ups. There are many standard Pi boards that don't have pull ups.
The SoC has internal pull-ups, but they're in the order of approx. 50KΩ - not enough for I2C although you may get away with using them if your device is really close to the CM. (I've seen similar done on Arduino/ATmega platforms) The Pi has on-board 1K8 pull-ups to 3.3v so all the current boards you buy for the Pi doesn't need them. You will need to consider adding something like that to your own interface as these are not present on the CM.

-Gordon
--
Gordons projects: https://projects.drogon.net/

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: I2C GPIO

Wed Jun 25, 2014 11:36 am

AirRietveld wrote:I see them on J6 for example as CD0_SDA, CD0_SCL, CD1_SDA and CD1_SCL. But those don't show on the SO-DIMM
Looking at the IO board schematics, the CD0_ and CD1_ pins are connected only to the CAM0, CAM1, DISP0 and DISP1 slots, and allow you (using jumper wires) to mix'n'match which pins on the SODIMM connect to which pins on the Camera and Display connectors.

User avatar
AirRietveld
Posts: 26
Joined: Tue Jun 24, 2014 1:53 pm
Location: Groningen
Contact: Website

Re: I2C GPIO

Wed Jun 25, 2014 2:14 pm

But I don't want to use the camera :P It's for a PCB design.

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: I2C GPIO

Wed Jun 25, 2014 2:32 pm

AirRietveld wrote:But I don't want to use the camera :P It's for a PCB design.
Well then don't connect anything to the CD0_ or CD1_ pins - simple!

http://elinux.org/RPi_BCM2835_GPIOs now makes it clearer to see which pins the I2C buses are available on 8-)

User avatar
AirRietveld
Posts: 26
Joined: Tue Jun 24, 2014 1:53 pm
Location: Groningen
Contact: Website

Re: I2C GPIO

Thu Jun 26, 2014 3:37 pm

Thanks for the schedule, that's very helpful. I am designing a new board for the Compute, so I am not using the normal headers, only the pin-out of the SO-DIMM module. I've picked GPIO 2 and 3, so SDA and SCL 1.

Thanks everybody!

Return to “Compute Module”