I2C not working

I am porting an existing working project from a Wemos D1 to the Arducam ESP-uno board.

The I2C bus is scanned on power up and any devices found reported to the serial console. When running the code on the Arducam ESP-uno board the devices are not detected. Running the same code on the Wemos works fine.

Both boards use the same pins 21 + 22 as SDA + SCL respectively, both boards have pins 21 + 22 in same physical location.

What I get is the following error…

[114067][E][Wire.cpp:513] requestFrom(): i2cRead returned Error 263

What am I missing? It appears as if the pins are incorrect but all of the documentation I can find shows them as correct.

Here’s the code that I’m using to scan the I2C bus.

void Hardware::getI2CList() {   
  
  Messages _message;

  _message.serialPrintf("Scanning for I2C devices...\n");
  byte count = 0;
  
  for (byte address = 1; address < 127; address++)   {
    Wire.beginTransmission (address);          
    if (Wire.endTransmission () == 0)  {  
      _message.serialPrintf("Found address: %u (0x%X)\n", address, address);
      count++;
    }
  }
  
  _message.serialPrintf("Found %u device(s). \n", count);

}

Any help / ideas / pointers welcomed

/DM

Further to the above. The previously noted error actually comes from the code immediately following the scan where it attempts to communicate with an ADS1115. But the root cause is the same in both cases. It cannot see anything on the I2C bus.

I modified the above code as follows to print out the error received on each iteration of the for loop…

void Hardware::getI2CList() {   
  
  Messages _message;

  _message.serialPrintf("Scanning for I2C devices...\n");
  byte count = 0;
  byte error;
  
  for (byte address = 1; address < 127; address++)   {
    Wire.beginTransmission (address);       
    error = Wire.endTransmission();
    _message.serialPrintf("Error: %u (0x%X)\n", error, error);
    if (error == 0)  {  
      _message.serialPrintf("Found address: %u (0x%X)\n", address, address);
      count++;
    }
  }
  
  _message.serialPrintf("Found %u device(s). \n", count);

}

I received the following…

Error: 5 (0x5)
Error: 5 (0x5)
Error: 5 (0x5)
Error: 5 (0x5)
Error: 5 (0x5)
Error: 5 (0x5)
Error: 5 (0x5)
Error: 5 (0x5)
Error: 5 (0x5)

5 is a ‘STOP’ error which is described as a ‘Timeout waiting for stop condition to be detected’. There’s a further description of the bus transactions as follows…

“Once the device has successfully written all the data it wants to send to the peripheral (or read back all the data that it requested), it signals the completion of the transaction with a stop condition: while SCL is high, SDA is released to go high too (the waveform has a rising edge). This releases the bus for other devices to make use of it. Again, the device checks that this stop signal has been sent correctly. If it has not, then this error will be issued.”

I have read elsewhere about issues with SDA being held low by the Arducam. I suspect that this is a similar issue although the cause may be of my own doing and related to the pullup resistors as after reviewing the shield these are missing. I suspect that the Wemos board had the SDA and SCL lines tied high somewhere which masked the omission of the pullup resistors.

I’ll add these in and see if there’s any change

/DM

So the pullup resistors have made no difference. :frowning:

I’m kinda scratching my head here.

I’m now wondering if this is a compiler issue. I’m using vscode / platformio and have the board set to ESP32DEV which always worked on the Arduino platform albeit I’ve not previously used I2C on this board before. The project compiles and uploads fine but I’m thinking that perhaps the I2C aspect of the firmware is different. The big issue here is that I cannot find any info on how to set up the Arducam ESP32 Uno board in platformio.

Any pointers warmly welcomed

/DM