0

I have a AZ-Delivery ESP32 DevKitC V2 connected to an GY521/MPU6050:

VCC --> 3V3
GND --> GND
SCL --> G22
SDA --> G21
INT --> G19

I installed I2Cdev and MPU6050 using PlatformIO from https://github.com/jrowberg/i2cdevlib and copied examples/MPU6050_DMP6 into my main.cpp and changed INTERRUPT_PIN from 2 to 19.

When I flash and run this code the code is always stuck at mpu.initialize(). I added a serial output between mpu.initialize() and pinMode(INTERRUPT_PIN, INPUT) (Lines: 188-189) and this I the output I get all the time:

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:12784
load:0x40080400,len:3032
entry 0x400805e4
Initializing I2C devices...

Any help?

Marcel Lorenz
  • 295
  • 2
  • 13

1 Answers1

0

I would recommend not using I2Cdev and MPU6050 libraries for your Arduino, since libraries adds complexity to your code compilation and the chance of something breaking.

I suggest just using wire.h library (which is well maintained and preinstalled on the Arduino IDE) and nothing else for your MPU6050. An example is available in the Arduino code on: https://www.instructables.com/How-to-Make-a-Robot-Car-Drive-Straight-and-Turn-Ex/

When using interrupts, you need to remember than I2C communication can take up to 3 milliseconds to complete, which is a significant amount of lag. During this lag, it is best not to trigger an interrupt to avoid confusing the Arduino.

J Z
  • 26
  • 4