Arduino Zero I2C strange behaviour

Hello guys,

I am having monochrome i2c ole 128x32 display and when using arduino uno to search for i2c device I can find it,but when I switch to arduino zero i2c scanner it seems that it can't find it.

Is there anny difference between the two boards ?

Hi,

I noticed that the zero runs @3v3, not 5v as the uno.

I'm not sure if the Zero supports I2C on the A4 and A5 pins. It refers to the SDA and SCL pins. Those are on the other side of the Zero.

I am not using analog4,5 as sda,scl

I notice a similar problem using the i2c_scanner with the Arduino Zero. It doesn’t work with this board(?).

I have the SDA and SCL pins on the Ardunio Zero connected to two slaves (OV7670 and MPU-6050) as shown below, with a 4.7kOhm pull up to 3.3V on each line.

I assume the following:
OV7670 is at 0x42 and 0x43
MPU6050 is at 0x68
but I want to verify with i2c_scanner.

I ran the i2c_scanner code and it returns “Unknow error at address” for all addresses. I tried disconnecting each of the slaves to run the i2c_scanner again with just one slave on the bus, but same problem for each slave device.

I can communicate with the MPU6050 via I2C knowing the address, but the OV7670 is giving me trouble…that’s for another thread.

I tried playing around with the i2c_scanner code (see below) to see if there is another way of finding valid addresses. I don’t know if this would work on other boards, as I only have an Arduino Zero, but I notice it hangs inside of Wire.requestFrom(address, numBytes) when the address isn’t valid. I welcome input. Especially on how to step out of this function when the program is hung inside waiting.

One more note, I’m new to Arduino and haven’t found a better way to debug than using the serial monitor. :slightly_smiling_face:

void setup()
{
  Wire.begin(); //join i2c bus
  Serial.begin(9600);
}

void loop()
{ 
  for(address = 104; address < 127; address++ )//Start at known valid address
  {
    bool flag = 1;
    
    Serial.print("checking address ");
    Serial.println(address);
    
    Wire.requestFrom(address,10);//guessing 10 bytes is enough
    Serial.println("debug1");
    
    while(Wire.available()) 
    {
      Serial.println("debug2");
      int b = Wire.read();
      Serial.println(b, HEX);
      flag = 0;
    }
    
    if(flag)//wire not available
    {
     Serial.println("nothing at this address");
    }
    Serial.println("debug3"); 
    error = Wire.endTransmission();
  }
}

Serial monitor output:
I2C Scanner
Scanning…
Unknow error at address 0x68
Unknow error at address 0x69
.
.
.
Unknow error at address 0x7D
Unknow error at address 0x7E
No I2C devices found
checking address 104
debug1
debug2
A
debug2
28
debug2
6F
debug2
6F
debug2
94
debug2
66
debug2
0
debug2
0
debug2
0
debug2
0
debug3
checking address 105

It is hung waiting for a slave at address 105.