ESP23-Gateway I2C -> LED Display gives I2C_ERROR_BUSY after a few hours

Started by DaveShep, January 08, 2019, 11:35:00 AM

Previous topic - Next topic

DaveShep

I am successfully sending a time to a 4-digit 7-segment display. The code snippet is called once a second and the time just loops around at 99 min. Several loops will occur just fine, however after 3-8 hours the display will hang and i get a Wire.endTransmission result of 5 = I2C_ERROR_BUSY from then onwards.

If I hard reset the ESP32 at this point, the error changes to 1 = I2C_ERROR_DEV and the display is still hung. If I disconnect and reconnect all power to the display it goes blank and a subsequent hard reset of the ESP32 will clear the error, a full power cycle also gets things back on track.

While this is going on, I receive udp packets async from the hardwired ethernet, and currently do nothing with them. The ESP32 continues to function fine (as far as network comms go) after the display hangs.

Trouble shooting so far:

I am constantly monitoring the ESP32 on my PC so I thought it might be something to do with the USB going to sleep - but that doesn't appear to be the case.

I have tried a different power supply (required to provide additional power to the display)

I am currently counting how many successful writes I can get before the display hangs and I am timing exactly when the hang occurs.


If anyone has suggestions about further troubleshooting I would be grateful.





Hardware:
ESP32 GATEWAY Rev.E (powered by USB)
Adafruit 1.2" 4-Digit 7-Segment display w/I2C Backpack (HT16K33) (powered by PSU)

Environment:
Arduino 1.8.8
Adafruit GFX Library 1.3.6
Adafruit LED Backpack Library 1.1.6
AsyncUDP Library
Arduino board esp32 v1.0.0

Signalling:
I2C sda = pin 32, sca = pin 16
I2C address 0x70 (default)

  unsigned long displayValue = minutes*100 + seconds;

  // Prepare new clock display.
  // Print the time value to the display.
  ledDisplay.print(displayValue, DEC);
  ledDisplay.drawColon(true);
  // Add leading zeroes at -0:0-.
  if (minutes == 0) {
    ledDisplay.writeDigitNum(1,0);
   if (seconds < 10) {
      ledDisplay.writeDigitNum(3,0);
    }
  }
  // Finally push out to the display.
  int result = ledDisplay.writeDisplay();
 
  // Now increase the seconds by one.
  seconds += 1;
    if (seconds > 59) {
    seconds = 0;
    minutes += 1;
  }
  if (minutes > 99) {
    minutes = 0;
  }



LubOlimex

This seems like I2C library issue, and I've seen many reports about hte I2C libraries in the ESP32 GitHub. First make sure to update your Arduino package to the latest development release because the stable version dates from July 2018 and a lot of commits occurred after that - it is 1.0.1-rc2 - maybe this issue was fixed already.
Technical support and documentation manager at Olimex

DaveShep

Updating to esp32 v1.0.1rc4 in the Arduino board manager has fixed the issue. I2C is now reliable.

Karma coming your way.

pettus

I was just trying to debug an I2C connection today and possibly have encountered a similar failure mode.  I took out an oscilloscope to watch the pulses and found that rarely the I2C from the esp32 would only output 8 SCL ticks instead of 9 (I saw this whether I had an actual I2C slave on the bus or not).  When this happened with an addressed slave that pulled an acknowledge low on the SDA line, that would freeze the bus with SDA low and SCL high - the master would treat this like a controlled bus and never restart communication, and the slave would keep waiting for an SCL tick to flip back to high.

I'm running the July 2018 version of the espressif core, back to 1.0.0, so now that I've seen this I'll try updating that and seeing how I do.