Welcome, Guest

Author Topic: ESP23-Gateway I2C -> LED Display gives I2C_ERROR_BUSY after a few hours  (Read 281 times)

DaveShep

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
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)

Code: [Select]
  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

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1915
  • Karma: +49/-3
Re: ESP23-Gateway I2C -> LED Display gives I2C_ERROR_BUSY after a few hours
« Reply #1 on: January 08, 2019, 01:40:30 PM »
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

  • Newbie
  • *
  • Posts: 8
  • Karma: +0/-0
Re: ESP23-Gateway I2C -> LED Display gives I2C_ERROR_BUSY after a few hours
« Reply #2 on: January 10, 2019, 11:59:13 AM »
Updating to esp32 v1.0.1rc4 in the Arduino board manager has fixed the issue. I2C is now reliable.

Karma coming your way.

pettus

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Re: ESP23-Gateway I2C -> LED Display gives I2C_ERROR_BUSY after a few hours
« Reply #3 on: February 23, 2019, 07:45:52 AM »
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.