Skip to main content
deleted 162 characters in body
Source Link
Velvet
  • 4.7k
  • 5
  • 18
  • 32

I am struggling to get an acknowledge from the MPU6050 using ESP32 with arduinoArduino framework. I am unable to derive if the problem is hardware or firmware.

I have copied the sparkfun'sSparkfun's breakout board schematic, setting the FSYNC, CLKIN and AD0 pins to GND and SDA, SCL and INT to GPIOs 25, 26 and 27 respectively (INT is unused/floating). I am using 2.7k7 kΩ pull-ups for the i2cI2C lines.

I am using the following code to test the i2cI2C comms:

#include <Wire.h>
 
#define I2C_SDA 25
#define I2C_SCL 26

void setup() {
  Wire.setClock(100000UL);
  Wire.begin(I2C_SDA, I2C_SCL);
  delay(3000);
  Serial.begin(115200);
  Serial.println("\nI2C Scanner");
}
 
void loop() {
  byte error, address;
  int nDevices;
  Serial.println("Scanning...");
  nDevices = 0;
  for(address = 1; address < 127; address++ ) {
    Wire.beginTransmission(address);
    error = Wire.endTransmission();
    if (error == 0) {
      Serial.print("I2C device found at address 0x");
      if (address<16) {
        Serial.print("0");
      }
      Serial.println(address,HEX);
      nDevices++;
    }
    else if (error==4) {
      Serial.print("Unknow error at address 0x");
      if (address<16) {
        Serial.print("0");
      }
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0) {
    Serial.println("No I2C devices found\n");
  }
  else {
    Serial.println("done\n");
  }
  delay(5000);          
}
#include <Wire.h>
 
#define I2C_SDA 25
#define I2C_SCL 26

void setup() {
  Wire.setClock(100000UL);
  Wire.begin(I2C_SDA, I2C_SCL);
  delay(3000);
  Serial.begin(115200);
  Serial.println("\nI2C Scanner");
}
 
void loop() {
  byte error, address;
  int nDevices;
  Serial.println("Scanning...");
  nDevices = 0;
  for(address = 1; address < 127; address++ ) {
    Wire.beginTransmission(address);
    error = Wire.endTransmission();
    if (error == 0) {
      Serial.print("I2C device found at address 0x");
      if (address<16) {
        Serial.print("0");
      }
      Serial.println(address,HEX);
      nDevices++;
    }
    else if (error==4) {
      Serial.print("Unknow error at address 0x");
      if (address<16) {
        Serial.print("0");
      }
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0) {
    Serial.println("No I2C devices found\n");
  }
  else {
    Serial.println("done\n");
  }
  delay(5000);          
}

I have probed the i2cI2C line using a logic analyser. The code behaves as expected but I get no acknowledge. enter image description here

I have checked that the chip has power, lowered the speed from 200kHz200 kHz (default) to 100kHz100 kHz. I have tried using internal pull-ups on esp32ESP32 instead of external. I have tried a different MPU6050 chip.

I am struggling to get an acknowledge from the MPU6050 using ESP32 with arduino framework. I am unable to derive if the problem is hardware or firmware.

I have copied the sparkfun's breakout board schematic, setting the FSYNC, CLKIN and AD0 pins to GND and SDA, SCL and INT to GPIOs 25, 26 and 27 respectively (INT is unused/floating). I am using 2.7k pull-ups for the i2c lines.

I am using the following code to test the i2c comms:

#include <Wire.h>
 
#define I2C_SDA 25
#define I2C_SCL 26

void setup() {
  Wire.setClock(100000UL);
  Wire.begin(I2C_SDA, I2C_SCL);
  delay(3000);
  Serial.begin(115200);
  Serial.println("\nI2C Scanner");
}
 
void loop() {
  byte error, address;
  int nDevices;
  Serial.println("Scanning...");
  nDevices = 0;
  for(address = 1; address < 127; address++ ) {
    Wire.beginTransmission(address);
    error = Wire.endTransmission();
    if (error == 0) {
      Serial.print("I2C device found at address 0x");
      if (address<16) {
        Serial.print("0");
      }
      Serial.println(address,HEX);
      nDevices++;
    }
    else if (error==4) {
      Serial.print("Unknow error at address 0x");
      if (address<16) {
        Serial.print("0");
      }
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0) {
    Serial.println("No I2C devices found\n");
  }
  else {
    Serial.println("done\n");
  }
  delay(5000);          
}

I have probed the i2c line using a logic analyser. The code behaves as expected but I get no acknowledge. enter image description here

I have checked that the chip has power, lowered the speed from 200kHz (default) to 100kHz. I have tried using internal pull-ups on esp32 instead of external. I have tried a different MPU6050 chip.

I am struggling to get an acknowledge from the MPU6050 using ESP32 with Arduino framework. I am unable to derive if the problem is hardware or firmware.

I have copied Sparkfun's breakout board schematic, setting the FSYNC, CLKIN and AD0 pins to GND and SDA, SCL and INT to GPIOs 25, 26 and 27 respectively (INT is unused/floating). I am using 2.7 kΩ pull-ups for the I2C lines.

I am using the following code to test the I2C comms:

#include <Wire.h>
 
#define I2C_SDA 25
#define I2C_SCL 26

void setup() {
  Wire.setClock(100000UL);
  Wire.begin(I2C_SDA, I2C_SCL);
  delay(3000);
  Serial.begin(115200);
  Serial.println("\nI2C Scanner");
}
 
void loop() {
  byte error, address;
  int nDevices;
  Serial.println("Scanning...");
  nDevices = 0;
  for(address = 1; address < 127; address++ ) {
    Wire.beginTransmission(address);
    error = Wire.endTransmission();
    if (error == 0) {
      Serial.print("I2C device found at address 0x");
      if (address<16) {
        Serial.print("0");
      }
      Serial.println(address,HEX);
      nDevices++;
    }
    else if (error==4) {
      Serial.print("Unknow error at address 0x");
      if (address<16) {
        Serial.print("0");
      }
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0) {
    Serial.println("No I2C devices found\n");
  }
  else {
    Serial.println("done\n");
  }
  delay(5000);          
}

I have probed the I2C line using a logic analyser. The code behaves as expected but I get no acknowledge. enter image description here

I have checked that the chip has power, lowered the speed from 200 kHz (default) to 100 kHz. I have tried using internal pull-ups on ESP32 instead of external. I have tried a different MPU6050 chip.

Source Link

MPU6050 ESP32 No Acknowledge

I am struggling to get an acknowledge from the MPU6050 using ESP32 with arduino framework. I am unable to derive if the problem is hardware or firmware.

I have copied the sparkfun's breakout board schematic, setting the FSYNC, CLKIN and AD0 pins to GND and SDA, SCL and INT to GPIOs 25, 26 and 27 respectively (INT is unused/floating). I am using 2.7k pull-ups for the i2c lines.

enter image description here

I am using the following code to test the i2c comms:

#include <Wire.h>
 
#define I2C_SDA 25
#define I2C_SCL 26

void setup() {
  Wire.setClock(100000UL);
  Wire.begin(I2C_SDA, I2C_SCL);
  delay(3000);
  Serial.begin(115200);
  Serial.println("\nI2C Scanner");
}
 
void loop() {
  byte error, address;
  int nDevices;
  Serial.println("Scanning...");
  nDevices = 0;
  for(address = 1; address < 127; address++ ) {
    Wire.beginTransmission(address);
    error = Wire.endTransmission();
    if (error == 0) {
      Serial.print("I2C device found at address 0x");
      if (address<16) {
        Serial.print("0");
      }
      Serial.println(address,HEX);
      nDevices++;
    }
    else if (error==4) {
      Serial.print("Unknow error at address 0x");
      if (address<16) {
        Serial.print("0");
      }
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0) {
    Serial.println("No I2C devices found\n");
  }
  else {
    Serial.println("done\n");
  }
  delay(5000);          
}

I have probed the i2c line using a logic analyser. The code behaves as expected but I get no acknowledge. enter image description here

I have checked that the chip has power, lowered the speed from 200kHz (default) to 100kHz. I have tried using internal pull-ups on esp32 instead of external. I have tried a different MPU6050 chip.

Any help diagnosing would be greatly appreciated.