i2cdevlib icon indicating copy to clipboard operation
i2cdevlib copied to clipboard

esp-idf mpu6050 example not working

Open brand17 opened this issue 2 years ago • 1 comments

I am running the standard example https://github.com/jrowberg/i2cdevlib/blob/master/ESP32_ESP-IDF/main/example.cpp. I only had to swap PIN_SDA and PIN_CLK to make it working (based on https://www.instructables.com/ESP32-Internal-Details-and-Pinout/).

The code doesn't enter into the following block because the bit 1 is always zero.

    } else if (mpuIntStatus & 0x02) {

What could be a reason?

I've checked that DMP initialized correctly and enabled.

I tried to check the zero bit instead (based on https://invensense.tdk.com/wp-content/uploads/2015/02/MPU-6000-Register-Map1.pdf (page 28)) - but I am getting wrong sensor orientation (angles and quarternion looking like random figures).

I also ensured that the sensor is ok: the Arduino example https://github.com/jrowberg/i2cdevlib/tree/master/Arduino/MPU6050/examples/MPU6050_DMP6 works like a charm from Arduino IDE.

I compared the both examples and found out that the Arduino one doesn't check this register (INT_STATUS) at all. I tried to remove use of this register - but still have unstable quarternion values.

But I checked that the bit 1 works as expected in Arduino example.

Please note that I don't use the sensor interrupt pin - I don't see use of that in the example (interrupt PIN or smth like that).

brand17 avatar Jun 27 '22 17:06 brand17

As far as I understand - there were errors in the firmware (dmpMemory block). I've prepared a patch here - https://github.com/jrowberg/i2cdevlib/pull/698

brand17 avatar Jul 03 '22 16:07 brand17