Chandru Posted October 4, 2013 Report Share Posted October 4, 2013 Hi,I am using MPU9150 sensor with dsPic33fj128GP802.I have just started to learn about I2C.I tried checking the value of WHO_AM_I register.I use Mplab in debug mode to check the output.I get 0x68(correct result) only sometime.If I reset and check the result again I get 0XFF or 0x00 or any values most of the time.I am not sure what the problem would be.Can you suggest how can I approach to resolve this problem so that every time I check the value,I get the correct result(0x68). Looking forward to your help. BiapeApoppy 1 Quote Link to comment Share on other sites More sharing options...
eneuro Posted October 5, 2013 Report Share Posted October 5, 2013 Maybe solution is run I2C master at slower speed eg. 10kHz or 1kHz and see what happends, if so many strange readings you have? I have MPU-6050 and just finished PC (RS232) <-> I2C interface which will allow me directly from Linux box talk to this MPU via optical isolation-no debug modes needed to test AVRs and this MPU. This will also allow me to set I2C bus operating voltage to 5V or 3.3V. I'm able to run my Linux box as I2C master now, and test many I2C devices isolated from PC using big LCD screen and no need to debug mode-just print I2C messages and log them to files on PC However, I've implemented MPU detection in I2C, where it first tries talk to 0x68 and if fails uses 0x69 and makes second hit and if success stores detected MPU address for data exchange... This what I'm talking about, but I used custom made I2C library which supports my PC RS232 DE9 <-> I2C board: $ cat i2c_rs232_mpu6050test-ADO1.txtINFO: RS232 I2C port: /dev/ttyS0INFO: RS232 I2C speed: 1000.0 [Hz]INFO: RS232 I2C wait speed: 0.001000 (1000 [us])INFO: RS232 I2C SCL: 1 SDA: 1DEBUG: Looking for MPU-6050 slave at default address: 0x68ERROR: address_slave: 0x68 for write failedDEBUG: Looking for MPU-6050 slave at other address: 0x691|^S1|.0._|_.1|.__.1|.__.0|.__.1|.__.0|.__.0|.__.0|.__.0|._1.|_S1|.0._|_.1|.__.1|.__.0|.__.1|.__.0|.__.0|.__.1|.__.0|._1.|.__.0|.__.1|.__.1|.__.1|.__.0|.__.1|.__.0|.__.1|._1.|._P_0|.1.|INFO: Found MPU-6050 at I2C address: 0x69S1|.0._|_.1|.__.1|.__.0|.__.1|.__.0|.__.0|.__.1|.__.1|._1.|._1_.|.__.|.__.|.__.|.__.|.__.|.__.|.__.|.__.1|._P_0|.1.|INFO: This MPU-6050 read who am i address: 0x68P_0|.1.| First run and with success at very slow delays 1kHz I2C, but I'm unsure now which is max speed with this new board, so decided start with such low I2C speed. I've MPU-6050 ADO pin connected to 3.3Vcc via 4.7k resistor, so my device I2C address as detected is 0x69, but MPU-6050 corectly returns "who am I" 0x68 as expected and described in its datasheet, so I'm able verify if MPU-6050 is available and at which address regardless of its ADO setting. Used custom board to talk directly from Linux PC RS232 De9 <-> I2C below : Quote Link to comment Share on other sites More sharing options...
Chandru Posted October 8, 2013 Author Report Share Posted October 8, 2013 Thank you for your response.your is good.However,i found the problem.It was with he hardware.I found the GND of the senor was floating.I fixed i and its working fine. Quote Link to comment Share on other sites More sharing options...
Ryan Posted April 12, 2014 Report Share Posted April 12, 2014 I am using MPU9150 sensor with dsPic33fj128GP802.I have just started to learn about I2C. I tried checking the value of WHO_AM_I register.I use Mplab in debug mode to check the output.I get 0x68(correct result) only sometime.If I reset and check the result again I get 0XFF or 0x00 or any values most of the time.I am not sure what the problem would be.Can you suggest how can I approach to resolve this problem so that every time I check the value,I get the correct result(0x68). I'm having this same problem. Since the MPU9150 I'm using is embedded in epoxy, I can't test it the grounds. I believe that the correct value for WHO_AM_I is the most significant 6 bits of the address which for either 0c68 or 0x69 would be 0x34. Not sure why I keep getting 0x14... This value is hard coded in MPU6050.cpp: bool MPU6050::testConnection() { return getDeviceID() == 0x34; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.