Skip to content

I2C write error #6588

@NathanKuo0821

Description

@NathanKuo0821

Board

Esp32 devkit_v4

Device Description

Esp32 devkit_v4

Hardware Configuration

GPIO 32 and 33 connect to I2c LCD device.

[WORK]
46376

[NG]
46374

Version

other

IDE Name

VSC platformIO

Operating System

Windows 10

Flash frequency

40Mhz

PSRAM enabled

yes

Upload speed

921600

Description

Hi All,

I define the two I2C to control M5UnitLCD in ESP32.

#define I2C1_SDA 15
#define I2C1_SDL 16
#define I2C2_SDA 32
#define I2C2_SDL 33

Now there is a problem that when I use I2C1 to control the LCD everything works fine, but when I switch to I2C2, an error like the following debug message will appear, can anyone help?

Nathan Kuo

Sketch

//I2C BUS
#define I2C1_SDA 15
#define I2C1_SDL 16
#define I2C2_SDA 32
#define I2C2_SDL 33

/* I2C Bus */
TwoWire I2C1 = TwoWire(0); //I2C1 bus
TwoWire I2C2 = TwoWire(1); //I2C2 bus

// LCD
#include <M5UnitLCD.h>
M5UnitLCD display (I2C2_SDA,I2C2_SDL,400000); 
void setup()
{
  Serial.begin(115200);
  Serial1.begin(115200, SERIAL_8N1, RXD1, TXD1);
  Serial1.setTimeout(300);
  Serial.println();

 I2C2.begin(I2C2_SDA,I2C2_SDL);

   display.begin();

  if (display.isEPD())
  {
    display.setEpdMode(epd_mode_t::epd_fastest);
    display.invertDisplay(true);
    display.clear(TFT_WHITE);
  }
  if (display.width() < display.height())
  {
    display.setRotation(display.getRotation() ^ 1);
  }

  // width=240 , height=135
  log_d("width=%d , height=%d",display.width(),display.height());

  display.setColorDepth(1); // mono color
  display.setFont(&fonts::Font4);
  display.setTextWrap(false);
  display.setTextSize(3);
  display.setTextColor(TFT_BLACK);

  display.fillScreen(WHITE);

  display.drawString("Ready" , 0, (display.height()/3));
}

Debug Message

[D][esp32-hal-i2c.c:1344] i2cProcQueue():  Busy Timeout start=0xe5, end=0x117, =50, max=50 error=3
[E][esp32-hal-i2c.c:318] i2cDumpI2c(): i2c=0x3ffbe118
[I][esp32-hal-i2c.c:319] i2cDumpI2c(): dev=0x60027000 date=0x16042000
[I][esp32-hal-i2c.c:321] i2cDumpI2c(): lock=0x3ffb86cc
[I][esp32-hal-i2c.c:323] i2cDumpI2c(): num=1
[I][esp32-hal-i2c.c:324] i2cDumpI2c(): mode=1
[I][esp32-hal-i2c.c:325] i2cDumpI2c(): stage=3
[I][esp32-hal-i2c.c:326] i2cDumpI2c(): error=3
[I][esp32-hal-i2c.c:327] i2cDumpI2c(): event=0x3ffb8754 bits=0
[I][esp32-hal-i2c.c:328] i2cDumpI2c(): intr_handle=0x3ffb8788
[I][esp32-hal-i2c.c:329] i2cDumpI2c(): dq=0x3ffb8730
[I][esp32-hal-i2c.c:330] i2cDumpI2c(): queueCount=1
[I][esp32-hal-i2c.c:331] i2cDumpI2c(): queuePos=0
[I][esp32-hal-i2c.c:332] i2cDumpI2c(): errorByteCnt=0
[I][esp32-hal-i2c.c:333] i2cDumpI2c(): errorQueue=0
[I][esp32-hal-i2c.c:334] i2cDumpI2c(): debugFlags=0x00000000
[I][esp32-hal-i2c.c:311] i2cDumpDqData(): Debug Buffer not Enabled
[I][esp32-hal-i2c.c:354] i2cDumpInts(): Debug Buffer not Enabled
[D][esp32-hal-i2c.c:1353] i2cProcQueue():  Gross Timeout Dead start=0x168, end=0x19a, =50, max=50 error=3
[E][esp32-hal-i2c.c:318] i2cDumpI2c(): i2c=0x3ffbe118
[I][esp32-hal-i2c.c:319] i2cDumpI2c(): dev=0x60027000 date=0x16042000
[I][esp32-hal-i2c.c:321] i2cDumpI2c(): lock=0x3ffb86cc
[I][esp32-hal-i2c.c:323] i2cDumpI2c(): num=1
[I][esp32-hal-i2c.c:324] i2cDumpI2c(): mode=1
[I][esp32-hal-i2c.c:325] i2cDumpI2c(): stage=3
[I][esp32-hal-i2c.c:326] i2cDumpI2c(): error=3
[I][esp32-hal-i2c.c:327] i2cDumpI2c(): event=0x3ffb8754 bits=0
[I][esp32-hal-i2c.c:328] i2cDumpI2c(): intr_handle=0x3ffb8788
[I][esp32-hal-i2c.c:329] i2cDumpI2c(): dq=0x3ffb8730
[I][esp32-hal-i2c.c:330] i2cDumpI2c(): queueCount=1
[I][esp32-hal-i2c.c:331] i2cDumpI2c(): queuePos=0
[I][esp32-hal-i2c.c:332] i2cDumpI2c(): errorByteCnt=0
[I][esp32-hal-i2c.c:333] i2cDumpI2c(): errorQueue=1
[I][esp32-hal-i2c.c:334] i2cDumpI2c(): debugFlags=0x00000000
[I][esp32-hal-i2c.c:311] i2cDumpDqData(): Debug Buffer not Enabled
[I][esp32-hal-i2c.c:354] i2cDumpInts(): Debug Buffer not Enabled
[I][esp32-hal-i2c.c:1138] i2cProcQueue(): Bus busy, reinit

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: Peripherals APIRelates to peripheral's APIs.Status: SolvedThe issue has been resolved and requires no further action.Type: QuestionOnly question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions