ESP32 I2C Two Busses

Hi guys!

I'm using an ESP32-WROOM-32E for my project. I want to use an I2C bus to communicate as the master for an LCD screen and the second I2C bus as the slave to receive updates from my atMega3208. Documentation says this is technically possible however when I configure the second bus the first no longer works, at least for displaying text on my LCD. I'm using Wire.h and the liquidcrystal_i2c library which just uses the default Wire. I've moved the Wire initializations around and I only get it to display if I have Wire1 initialized after lcd setup. I can't change what is on the display after Wire1 is set up so I'm sure there's some I2C conflict going on somewhere. Has anyone tried to run both I2C busses and do you know if the libraries I'm using are too limited for this to work properly on the ESP32? Here is some of my setup:

#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#define CLIENT_ADDRESS 0x08

LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
  Serial.begin(115200);
  Serial.setDebugOutput(true);
  Wire1.begin(CLIENT_ADDRESS);
  Wire.begin();
  setupLCD();
  Wire1.onReceive(receiveEvent);
  Wire1.onRequest(requestEvent);
}

void setupLCD() {
  if (!i2cAddrTest(0x27)) {
    lcd = LiquidCrystal_I2C(0x3f, 16, 2);
  }
  lcd.init();
  lcd.backlight();
  lcdPrintTempAndHumidity();
}

Please let me know if I should move this post to a different part of the forum. I'm new here. Thanks!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.