I2C on MEGA2560 R3 - SDA and SCL continous Clock Signal

I tried to communicate with the MPU6050 over I2C. But it never worked, so i tried to find out what the problem was and i connected my Logic Analyzer. Below you can see the result and i dont know what i should do to get it working. Unfortunately I don't own a second sensor or other stuff that can require I2C to check if my arduino isn't working. Has anyone ever had such a problem or knows how to solve it?

SDA,SCL

The Code i was using:

#include<Wire.h>

const int MPU_addr=0x68;  // I2C address of the MPU-6050
int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;
void setup(){
  Wire.begin();
  Wire.beginTransmission(MPU_addr);
  Wire.write(0x6B);  // PWR_MGMT_1 register
  Wire.write(0);     // set to zero (wakes up the MPU-6050)
  Wire.endTransmission(true);
  Serial.begin(9600);
  Serial.print("IM here");
}

void loop(){
  Wire.beginTransmission(MPU_addr);
  Wire.write(0x3B);  // starting with register 0x3B (ACCEL_XOUT_H)
  Wire.endTransmission(false);
  Wire.requestFrom(MPU_addr,14,true);  // request a total of 14 registers
  AcX=Wire.read()<<8|Wire.read();  // 0x3B (ACCEL_XOUT_H) & 0x3C (ACCEL_XOUT_L)    
  AcY=Wire.read()<<8|Wire.read();  // 0x3D (ACCEL_YOUT_H) & 0x3E (ACCEL_YOUT_L)
  AcZ=Wire.read()<<8|Wire.read();  // 0x3F (ACCEL_ZOUT_H) & 0x40 (ACCEL_ZOUT_L)
  Tmp=Wire.read()<<8|Wire.read();  // 0x41 (TEMP_OUT_H) & 0x42 (TEMP_OUT_L)
  GyX=Wire.read()<<8|Wire.read();  // 0x43 (GYRO_XOUT_H) & 0x44 (GYRO_XOUT_L)
  GyY=Wire.read()<<8|Wire.read();  // 0x45 (GYRO_YOUT_H) & 0x46 (GYRO_YOUT_L)
  GyZ=Wire.read()<<8|Wire.read();  // 0x47 (GYRO_ZOUT_H) & 0x48 (GYRO_ZOUT_L)
  Serial.print("AcX = "); Serial.print(AcX);
  Serial.print(" | AcY = "); Serial.print(AcY);
  Serial.print(" | AcZ = "); Serial.print(AcZ);
  Serial.print(" | Tmp = "); Serial.print(Tmp/340.00+36.53);  //equation for temperature in degrees C from datasheet
  Serial.print(" | GyX = "); Serial.print(GyX);
  Serial.print(" | GyY = "); Serial.print(GyY);
  Serial.print(" | GyZ = "); Serial.println(GyZ);
}

My Arduino and the MPU are all quite new.

Thanks for answering :slight_smile:

Below you can see the result

Nope, nothing to see.

Use the I2C_scanner program to check basic connections and verify device communications.

Hm yea i see its not showing up. Try to right click on it and select show in new Tab, then its working.

oh okey thank you didn't know this exists! i will try it! :slight_smile:

The program stoped at Scanning..
Now i tried to measure the resistance between the SCL and the SDL wire and it seems to be 1 Ohm. (When it's turned off, of course.) Thats why both of them got the same voltage all the time on my Logic Analyzer. Later i measured the voltage on the SDA pin (usually 5V) when nothing is connected and it only displayed 2.5V (because it always switches between 5 and 0V like in the picture). Same with the SCL pin. Does anyone know what i should do?

There is a short circuit somewhere. Take it all apart and rewire it carefully, checking connections with a magnifying glass and a multimeter.

I did but i can't find any connection. Is it possible that its in the ATMEGA2560?

Yes, there could be damage to the port. Pins can be burned out from over current.

Does the chip feel warm or hot to the touch at all? That's usually a good sign an IO pin (or several) has been damaged, and the part may imminently fail.

I cant't feel or smell anything suspicious. I think it would even be too late for that anyway so. Thank you all for your qick reply! I guess I am just gonna ask if they could replace it, since its just a week old! :slight_smile:

Is it possible that its in the ATMEGA2560?

What do you see when you run the i2c scanner program with nothing connected to SDA/SCL. If it halts at "scanning" the Arduino is damaged or there is a short between the pins, if it shows no devices connected, the short is not in the Arduino, but in the connected circuit.