2
votes

I am using the Raspberry PI for one of my projects.

In this project I need two different I2C interfaces to run simultaneously. I know how to set the GPIO-0 and GPIO-1 to work as I2C (There is tutorials everywhere, ex: one of the tutorials how to enable I2C in raspberry).

Also in this link RPi Low-level peripherialsit says that any GPIO can work as I2C.

How do I configure other GPIO's to work as I2C also so I can have to different interfaces in parallel. (I know I need to add pull-up resistors, but I don't know how to configure this in Linux shell or in C). Can someone explain me in easy steps how this is done?

Thanks, Adrian.

5
This should of been asked at raspberrypi.stackexchange.comAsh Burlaczenko
This has been asked and answered on RPi SESeamus

5 Answers

2
votes

I made an i2c bit banging bus interface on top of wiringPi. You can make a bus out of any 2 GPIO Pins. It is written in C++ but should be easily portable to C. Most functions are C anyways. Maybe it needs some polish, but at least it is a starting point.

https://github.com/robotrovsky/rpi_i2c_bit_banging

1
votes

If the pins has no hardware implemented I2C driver, a software implementation could be implemented using the concept of bit-banging.

0
votes

As already mentioned you could try bitbanging. If you are experienced in soldering you could "hardware-hack" the pi as the second I2C bus lies on the camera interface.

See

http://www.raspberrypi.org/wp-content/uploads/2012/10/Raspberry-Pi-R2.0-Schematics-Issue2.2_027.pdf

Page 4 S5

-1
votes

Why would you want two i2c buses? You can run multiple devices on the same i2c bus, as long as they have different addresses. And most components let you change the address by soldering up two pads.