Troubleshooting I2C module
teganburns
Posts: 134
Hey all I'm having a lot of problems interfacing my MPU-9150 module links for PDF's here -->>(http://www.invensense.com/mems/gyro/mpu9150.html)
This is my first time writing a program that communicates using I2C bus. I tried using a few different I2C drivers from obex but with no prevail. Power should be fine(3.3v from the Quickstart board), Checked my wiring (only 2 wires so that shouldn't be an issue).
And i understand I2C communication protocol. (@DavidJames posted this a while back, thank you) http://www.nxp.com/documents/user_manual/UM10204.pdf
My code is a edited version of Jason Dorie's "ITG-3200" (Gyro Module). My guess is that the problem is in the timing...
If anyone wants to try and troubleshoot the code or give suggestions that would appreciated. :thumb:
My edited code-->> https://raw.github.com/teganburns/Mpu-9150.spin/master/README.md
This is my first time writing a program that communicates using I2C bus. I tried using a few different I2C drivers from obex but with no prevail. Power should be fine(3.3v from the Quickstart board), Checked my wiring (only 2 wires so that shouldn't be an issue).
And i understand I2C communication protocol. (@DavidJames posted this a while back, thank you) http://www.nxp.com/documents/user_manual/UM10204.pdf
My code is a edited version of Jason Dorie's "ITG-3200" (Gyro Module). My guess is that the problem is in the timing...
If anyone wants to try and troubleshoot the code or give suggestions that would appreciated. :thumb:
My edited code-->> https://raw.github.com/teganburns/Mpu-9150.spin/master/README.md
Comments
Double check the model number of the "MPU-9150". I once spent two days trying to get a "Real Time Clock" I2C chip to communicate with a Prop to no avail. I nearly gave up then I pulled out a magnifying glass and realised that I had the wrong chip and its commands were completely different. Then it took me half an hour to put together an object for it.
My problem is in the code... i have spent weeks trying to figure out what's wrong.
@Clive Wakeham i can't make out what it says on the chip but i don't think sparkfun would make the mistake of using the wrong chip (I should have mentioned that its on a board) https://www.sparkfun.com/products/11486
One of the James Extra bits is a method of calling a I2C address and getting a response from it.
Check it out to confirm that the module you got is on the I2C bus and responding to its 7 bit address.
This the first thing I do now (after the issue with the RTC chip) to ensure the I2C device is connected correctly to the Prop.
All you need to do is write a simple program that queries the address of the module and prints OK on the screen using Parallax Serial Terminal etc.
The datasheet also describes clock-stretching by slave devices, though it's not clear if the MPU-9150 makes use of it.
Funny how how i wrote the internal register preliminary configuration correctly but got the device address wrong.. :P
In my last post I forgot to mention that I quickly wrote a short spin program that used the Basic I2C driver "extra bits" to cycle through all the 7 bit addresses to find where the I2C device is at.
There is an assembly language version of the I2C driver on OBEX which runs at a faster speed to the spin version.