I2C not connecting even when pulled high with external pullup

Hi all, i have issue connecting my MPU6050 with I2c. The error i was getting is

E][esp32-hal-i2c.c:1438] i2cCheckLineState(): Bus Invalid State, TwoWire() Can't init sda=1, scl=0

This is a schemetic of my mpu6050 circuit. It is connected to the ESP32's port SDA34, SCL35.

Running the official I2C scanner picks up no device address. And both pins are pulled high tested with a multimeter with 3.3V.

This is my code which returns a connection failed.

#include <Wire.h>
#include "I2Cdev.h"
#include "MPU6050.h"
MPU6050 accelgyro;
TwoWire I2Cone = TwoWire(0);

void setup() {
    Serial.println("Failed to connect to MPU");

Serial.println("Initializing I2C devices...");

Serial.println("Testing device connections...");
Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");

Can you give a link to the I2C Scanner that you use ?

If something is not working, then remove everything that is not normal and try the most basic most and common things that everyone uses.

Use pin 21 and 22 for the I2C bus and use the Wire library.

#include <Wire.h>

void setup()

Use that for a I2C Scanner.

I don't know if the I2Cdev library works with a ESP32.

What is that doing?
There should be nothing in the brackets of that call.

Im configuring to use another SDA/SCL pin instead of the default pins, but doesnt seem to work

Heres the link. Arduino Playground - I2cScanner
I cant rewire it as its a premade PCB, but i read that its possible to change the default SDA and SCL pins via that example above

Pin 34 and 35 are not the default pins. In fact, no one in the world has the I2C bus on those pins because that is not possible, they are input-only !


oh no.... thanks for letting me know. I'll resolder and see if another port works

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.