Jump to content
I2Cdevlib Forums

Issue with failed MPU testConnection() - Solved!


Recommended Posts

I had one of my GY-521's that would always fail the testConnection() function and also would not calibrate. So before throwing it away I ran the getDeviceID() function and discovered that its ID was 0x39.

On investigation in MPU6050.cpp, the return value is only true if the ID is 0x34, even further, the following functions (all of the offsets) only work with DeviceID's less than 0x38 !!!

int16_t MPU6050::getXAccelOffset() {
    uint8_t SaveAddress = ((getDeviceID() < 0x38 )? MPU6050_RA_XA_OFFS_H:0x77); // MPU6050,MPU9150 Vs MPU6500,MPU9250
    I2Cdev::readBytes(devAddr, SaveAddress, 2, buffer);
    return (((int16_t)buffer[0]) << 8) | buffer[1];

I changed my MPU6050.cpp values to suit my DeviceID to "getDeviceID() < 0x3A ", because mine was 0x39, it now works fine!!!

Does anyone know what the range is?

Thanks

 

 

Link to comment
Share on other sites

  • 1 year later...

getDeviceID() is not the device address.  My device id for the MPU6050 is 52...go figure.  But it's address is certainly 0x68 (default) and can be made 0x69 (ADO high).   I don't think the ID is important unless you are using other devices (not multiples of the same) on the I2C line.  I'm using multiple MPU6050 and they all report ID of 52.  

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...