Busy Timeout with Waveshare E-Ink Display and Arduino

Hello everyone!
I could need some help with my project in which i am using a waveshare eink display.
First a quick description about my project
I am using two arduino microcontrollers.
One nano IoT, which retrieves a message from the IoT cloud and sends it via I2C communication to the second controller (This part of the project seems to work just as intended)
The other controller is an nano 33 BLE. It retrieves the message from the IoT cia I2C, stores it in a char array, that is then null-terminated. I then use regex to split that message up into 3 parts (i get the initial message in the format "16. September 2023 author: Me : This is an example message" and basically split it up into the date, author name and full text) Finally i display these 3 strings on my display, which is a waveshare 7.5" eink display (the number 2)

I have build my code on the waveshare-own epd7in5b_V2, and the GxEPD2_BW.h library is included. (in addition to others, which are used for the regex and I2C)

The problem
The project seems to work initially, but when i run it for a while, i get the error of "Busy Timeout!". First i suspected a cabeling issue, which is why i have replaced the e-paper Driver HAT (also by waveshare). After that it worked again for a while, but now i am facing the Busy Timeout again.
The serial monitor then looks like this: ("Ich bin wach" signifies the beginning of the code when a message is recieved before anything has been done with the message)

19:42:19.276 -> Ich bin wach
19:42:32.264 -> Busy Timeout!
19:42:32.264 -> _PowerOn : 10004975
19:42:48.750 -> Busy Timeout!
19:42:48.750 -> _Update_Full : 10005192
19:42:58.860 -> Busy Timeout!
19:42:58.860 -> _PowerOff : 10000963

I have suspected that the message i send might be too long, and therefore take longer to process (?), but the issue stays no matter the length.
I dont want to just slap my code in here and ask for help, but unfortunately i cant realy find any parts that might be the source of the error. So if there is any part that seems suspicious, i am happy for any help!

#include <Wire.h>
#include <SPI.h>
#include <GxEPD2_BW.h>
#include "epd7in5b_V2.h"
#include <avr/pgmspace.h>
#include <Arduino.h>
#include <Regexp.h>

#include <Fonts/FreeSansBold24pt7b.h> 
#include <Fonts/FreeSerifBoldItalic18pt7b.h>
#include <Fonts/FreeMonoBold18pt7b.h> 

// Define the pins used for communication 
#define CS_PIN    5  // Chip Select pin
#define DC_PIN    4   // Data/Command pin
#define RST_PIN   3   // Reset pin
#define BUSY_PIN  2   // Busy pin
GxEPD2_BW<GxEPD2_750_T7, GxEPD2_750_T7::HEIGHT> display(GxEPD2_750_T7(CS_PIN, DC_PIN, RST_PIN, BUSY_PIN));


MatchState ms;
char receivedData[500] = " ";
void(* resetFunc) (void) = 0;

void setup() {
  Wire.begin(8); 
  display.init(115200); // Default baud rate for the Waveshare Universal e-Paper Driver HAT
  display.setRotation(2); // Set the display rotation if needed (0, 1, 2, or 3), 0= horizontal 
  display.fillScreen(GxEPD_BLACK);

  Wire.onReceive(receiveEvent);
}



void loop (){
 
}



void receiveEvent(int random){
  Serial.println("Ich bin wach");
  display.init(115200);
  int i = 0;
      while (Wire.available()) {
        receivedData[i] = Wire.read();
        i++;
      }
    receivedData[i] = '\0'; // Null-terminate the char array#

  String TEXT = String(receivedData);
  String DATUM = String(receivedData);
  String AUTOR = String(receivedData);
  ms.Target (receivedData);

  char resultDatum = ms.Match("[0-9][0-9]..([A-Z][a-z]*).[0-9][0-9][0-9][0-9]");
     int indexDatum = ms.MatchStart;
     int lengthDatum = ms.MatchLength;
          if (resultDatum > 0){
            DATUM.remove(lengthDatum);
            //Serial.println(DATUM);
          }

  char resultAutor = ms.Match("Autor:.([A-Z].*).:.");
     int indexAutor = ms.MatchStart;
     int lengthAutor = ms.MatchLength;
       // Serial.println(resultAutor);
            
        if (resultAutor > 0){
          AUTOR.remove(0, lengthDatum); 
          
          AUTOR.remove(lengthAutor-2);
          AUTOR.remove(0, 8);

          TEXT.remove(0, lengthDatum); // Remaining part is the text
          TEXT.remove(0, lengthAutor);
        }

    //digitalWrite(BUSY_PIN, HIGH);
    display.firstPage();
    //delay(5000);
          do {
            display.fillScreen(GxEPD_WHITE); // Set background color to white
            display.setTextColor(GxEPD_BLACK); // Set text color to black
            display.setFont(&FreeSansBold24pt7b); // Use a built-in font
            display.setCursor(/*x*/350, /*y*/50); // Set text position
            display.println(DATUM);

           
            display.setCursor(/*x*/10, /*y*/90); // Set text position
            display.println("_____________________________");

            display.setCursor(/*x*/20, /*y*/400); // Set text position
            display.println("_____________________________");
            
            display.setFont(&FreeMonoBold18pt7b);
            display.setCursor(/*x*/10, /*y*/150); // Set text position
            display.println(TEXT);

            display.setFont(&FreeSerifBoldItalic18pt7b);
            display.setCursor(/*x*/50, /*y*/470); // Set text position
            display.println(AUTOR);
            delay(3000);

            } while (display.nextPage());
            
  display.powerOff();
  resetFunc(); //call reset 
  
 
}

Thank you very much in advance and for reading, any ideas are welcome !

How is your display powered? I'm just repeating some quick advice I'd heard here before, but the Arduino's 3.3v pin might not supply enough power for a large display like that.

I've also heard that there's something tricky about reset with some waveshare stuff.

Maybe something here helps?

currently I have it connected to the 3.3 V pin, yes. I am not too sure if putting it on the 5V is a "save" thing to do, though.
I saw in a different post that someone said that the 3.3 is not strong enough so I actually measured the power supply pins and found that they are a bit above the 3.3 and 5 V that is specified.
Since in the waveshare documentation it is stated that the display needs 3.3,i am a bit scared to fry my display :sweat_smile:

@jojomart, hi,

Please post links to the devices you use.
Makes it easier to give good answers, when we know exactly what you use.

The current Waveshare HATs have 5V to 3.3V LDO (series regulator) and level converters.
If you feed 3.3V through the LDO, the resulting voltage is to low and weak for big e-paper displays.

Use the shortened reset pulse with the "clever" reset circuit. Search for "clever" reset circuit in this forum to learn more.

The code you posted uses library GxEPD2. Remove the #include for the Waveshare code.
-jz-

Sure!
So these are the devices i use:
The arduino nano 33 IoT (capturing the message from the arduino cloud) https://store.arduino.cc/products/arduino-nano-33-iot
The arduino nano 33 BLE (recieving the message and connected to the display) https://store.arduino.cc/products/arduino-nano-33-ble
The e Paper Driver HAT connected to the BLE https://www.waveshare.com/wiki/E-Paper_Driver_HAT (but bought from amazon so the flat cable was included : [https://www.amazon.com/-/de/dp/B0BS6ZF9GM/ref=sr_1_1?__mk_de_DE=ÅMÅŽÕÑ&crid=21N46PH6RPTFG&keywords=e+paper+driver+hat&qid=1695036885&sprefix=e+paper+driver+hat%2Caps%2C261&sr=8-1](Amazon Link)
And the 7.5" Waveshare eink display: https://www.waveshare.com/wiki/7.5inch_e-Paper_HAT_Manual#Overview

About the "clever" reset circuit that you mentioned, I have tried to look into that, but am not sure I understand how to include that in the code. Could you maybe link a specific post where that is described?

Already thank you very much for the reply!

Or look at the example GxEPD2_Example.ino

Oh yep! I can see it's all commented in there.

Didn't want to get in the way here at all, just half-remembered a few things you had said before, and wanted to mention them in case you were busy elsewhere. Probably jumped the gun a bit, sorry about that.

You're welcome. We just are in different time zones, I think.
The quote added an unintended backlink.

The quote added an unintended backlink

Ah that makes sense!