PeteJ Posted October 27, 2020 Report Share Posted October 27, 2020 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 Quote Link to comment Share on other sites More sharing options...
Kraken Posted May 13 Report Share Posted May 13 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. 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.