Exception when I2C WriteRead

Why I received exeption when Write to I2C ?
I use TinyCLR OS 2.0 RTW

    var controller = I2cController.FromName(SC20260.I2cBus.I2c1);
    var settings = new I2cConnectionSettings(0x34, 100000);
    var device = controller.GetDevice(settings);
    var outBuffer = new byte[] { 0x1D, 0xFF };
    var inBuffer = new byte[1];
    try
    {
        device.Write(outBuffer);
        device.Read(inBuffer);
    }
    catch (Exception)
    {
        throw;
    }
#### Exception System.Exception - CLR_E_TIMEOUT (1) ####
#### Message: 
#### GHIElectronics.TinyCLR.Devices.I2c.Provider.I2cControllerApiWrapper::WriteRead [IP: 0000] ####
#### GHIElectronics.TinyCLR.Devices.I2c.I2cDevice::WriteRead [IP: 0021] ####
#### GHIElectronics.TinyCLR.Devices.I2c.I2cDevice::Write [IP: 000c] ####
#### TinyCLRAppTestI2C.Program::Main [IP: 0037] ####
Exception: "System.Exception" in GHIElectronics.TinyCLR.Devices.I2c.dll

no ack or nack from slave.

check slave address.

1 Like

thanks. not worked on 100KHz. reduced to 10KHz

Do you have proper pull up resistors?

1 Like

Yes of course, 5KOm

That should work but we usually use 2.2k

Something not right, we rarely use 10KHz. Usually 100KHz or 400KHz without any issue.

was 10KOm - replaced with 5KOm and made a new cable. now works at 100KHz

2 Likes