8

I'm having difficulties interfacing the Raspberry Pi to basically any I2C sensor. I've gone through a lot of tutorials on how to get the I2C driver to work and my connections are correct. Still, i2cdetect (Or any I2C based code) doesn't get me any address.

What are the necessary troubleshooting steps for this issue? How do I know if the pins are destroyed or not?

I'm using MPU6050 and MAG3110 as example devices.

Ahmed Farid
  • 81
  • 1
  • 1
  • 2

2 Answers2

4

Are you looking at the correct I2C bus, between rev 1 and rev 2 the GPIO header was changed from using I2C 0 to I2C 1, see eLinux - RPi Low-level peripherals for details of the various pin changes.

i2cdetect 0
i2cdetect 1

should scan both buses separately, if your devices show up after one of the calls then that is the bus they are on.

Failing that if you have access to an oscilloscope you can monitor the pins and run i2cdetect again. You are looking for the voltage level to pulse a digital sequence between high (3.3v) and low (0v) on both pins.

I2C trace example

If you are fairly sure the pins are not working then try to use them as simple GPIO pins (0 & 1 for rev 1, 2 & 3 for rev 2) and manually drive them high, check they are high (3.3v) using a multimeter, then drive them low and check they are low (0v).

If you do not know how to drive the GPIO pins manually then see here for a Python example and here for a BASH example.

If they do not go high and low on command then there is something wrong with the pins, if they do but you still cannot get I2C to work then your problem will need further investigation.

PiBorg
  • 1,487
  • 10
  • 11
0

Here is a really good guide which might help you!

http://www.instructables.com/id/Raspberry-Pi-I2C-Python/?ALLSTEPS

  • Welcome to Raspberry Pi Stack Exchange! Whilst this may theoretically answer the question, [it would be preferable](http://meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. This helps protect against "link rot", where the information linked to is no longer where it was when the link was originally posted. – RPiAwesomeness Jun 17 '14 at 23:42