I2C Not Working on Xiao MG24 Sense - SDA Line Stuck LOW

With the MG24 Wire library, you should send a “dummy” byte when scanning.

  for (address = 0x01; address < 0x7E; address++)
  {
    Wire.beginTransmission(address);
    Wire.write(DUMMY_BYTE); // Send 1 dummy byte
    i2c_error = Wire.endTransmission();

    if (i2c_error == 0)
    {
      Serial.print("I2C device found at ");
      Serial.println(address, HEX);
      nDevices++;
    }
    else
    {
      Serial.print("No I2C device ");
      Serial.println(address, HEX);
    }
}
2 Likes