I2C com issues using logic level converter

I2C master/slave code below works perfect between Mega/Uno R4. When swapping Mega with Giga R1 and using TXS0108E based logic level converter, Uno randomly displays correct int from Giga. For the most part, it doesn't receive anything. Wired the logic level chip with Va 3.3 Vb 5V and OE 3.3V. All channels on Va side measure 3.3 and Vb 5V. Any ideas as to why this is happening?

SHILLEHTEK Pre-Soldered TXS0108E High Speed Full Duplex 8 Channel Logic Level Bi-Directional Converter

Mega/Giga Master:


#include <Wire.h>

const int TestPB = 11;

byte x = 0;

int Test = 0;

void setup()
{
  Wire.begin(); // join i2c bus (address optional for master)
  Serial.begin(9600);

  pinMode(TestPB, INPUT_PULLUP);
}



void loop()
{


  Test = digitalRead(TestPB);

if (Test == LOW) {

 Wire.beginTransmission(1); // 
  
  Wire.write(x); 
  delay(250);             // sends one byte
  Wire.endTransmission();    // stop transmitting

  x++;
    }

 


  delay(250);

    Serial.println(x);
  delay(250);
}

Uno R4 Wifi Slave:

// Wire Peripheral Receiver
// by Nicholas Zambetti [http://www.zambetti.com](http://www.zambetti.com)

// Demonstrates use of the Wire library
// Receives data as an I2C/TWI Peripheral device
// Refer to the "Wire Master Writer" example for use with this

// Created 29 March 2006

// This example code is in the public domain.

byte x = 0;
#include <Wire.h>

void setup()
{
  Wire.begin(1);   
  
  Wire.onReceive(receiveEvent);             // join i2c bus with address #4
  //Wire.onReceive(receiveEvent); // register event
  Serial.begin(9600);           // start serial for output
}

void receiveEvent(int bytes) {
  x = Wire.read();    // read one character from the I2C
}

void loop()
{




 Serial.println(x);

}

// function that executes whenever data is received from master

1 Like

Isn't the Giga R1 a 3.3v system?
Mega/Uno are 5v.

Yes. Thus the need to use a logic level chip.

Pullups missing? Got a voltmeter? Check voltage on the SDA and SCL lines. Should be near V+ on both sides.

the Uno R4 WiFi has 2 I2C buses, the second is a Qwiic connector that operates on 3.3V only. Maybe you could use a Qwiic connector and make the cable compatible with your Giga R1, which would mean you wouldn't have to use the logic level converter.

Something like this

Wires need to be Very Very short when using that IC.
Many people have problems with it.

The converter you are using has no pullups.
I use Adafruit's BSS138 i2c safe converter. It has 10K pullups on all lines.

Should have thought of this before trying logic level. Why convert if not necessary? Ordered qwiic connector.

1 Like

Sometimes its easy to overcomplicate things!