Waveshare ePaper & Waveshare ESP32C3-Zero

I am using successfully since quite a while a Waveshare 4.2" ePaper panel driven by ESP8266 chips.
Recently I bought several Waveshare ESP32C3 chips and now I wanted to use them as well togehter with those panels, worked well with Waveshares Demo, but using the GxEPD2 library (great lib, Kudos ZinggJM!) which worked with the 8266 did just not work with my C3's.

I am searching now since two days through posts all over the web, but no luck yet.

I assume the SPI handling may be the problem, but I cannot find any solution...

My testing sketch looks like this:

#define LOAD_GFXFF
#define ENABLE_GxEPD2_GFX 0
#include <GxEPD2_BW.h>
#include <U8g2_for_Adafruit_GFX.h>
#define MAX_DISPLAY_BUFFER_SIZE 800 
#define MAX_HEIGHT(EPD) (EPD::HEIGHT <= MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8) ? EPD::HEIGHT : MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8))

const int EPD_BUSY = 8; // ePaper Busy indicator (SPI MISO equivalent)
const int EPD_RST  = 5; // ePaper Reset switch
const int EPD_DC   = 9; // ePaper Data/Command selection
const int EPD_CS   = 7; // SPI Channel Chip Selection for ePaper
const int EPD_SCK  = 4; // SPI Channel Clock
const int EPD_SDI  = 6; // SPI Channel MOSI Pin  

GxEPD2_BW<GxEPD2_420, MAX_HEIGHT(GxEPD2_420)> display(GxEPD2_420(EPD_CS, EPD_DC, EPD_RST, EPD_BUSY));

U8G2_FOR_ADAFRUIT_GFX u8g2Fonts;

void setup() {

  Serial.begin(115200);
  Serial.println();
  Serial.println("setup");
  delay(100);

  // SPI.begin(EPD_SCK, -1, EPD_SDI, -1);
  display.init(115200, true, 10, false, SPI, SPISettings(4000000, MSBFIRST, SPI_MODE0));

  u8g2Fonts.begin(display);
}

void loop() {
  
  static uint32_t millisUpdate = 0;

  if (millis() > millisUpdate) {

    display.fillScreen(GxEPD_WHITE);
  
    display.setRotation(0);
    uint16_t bg = GxEPD_WHITE;
    uint16_t fg = GxEPD_BLACK;
  
    u8g2Fonts.setFontMode(1);
    u8g2Fonts.setFontDirection(0);
    u8g2Fonts.setForegroundColor(fg);
    u8g2Fonts.setBackgroundColor(bg);
    u8g2Fonts.setFont(u8g2_font_logisoso32_tr);

    display.setPartialWindow(0, 0, display.width(), 296);
    display.firstPage();
    do
    {
      const uint8_t w = 17;
      display.fillScreen(bg);

      const uint16_t x1 = 280;
      const uint8_t y1 = 70;
      u8g2Fonts.setFont(u8g2_font_logisoso16_tr);
      
      String m = String("tmin", 1);
      u8g2Fonts.setCursor(x1, y1);
      u8g2Fonts.print(m.c_str());
    }
    while (display.nextPage());

    millisUpdate = millis() + 10000;
  }
}

Sketch compiles and runs w/o errors, but no output on panel...

Any ideas or hints please anyone?

Hi @tnemec, welcome to the forum!

Your SPI connection should be ok for GxEPD2, I checked your wiring against the pins_arduino.h of your esp32c3.

But your Waveshare display has the "clever reset circuit". You may need to use it with a shortened reset pulse of 2ms instead of 10ms.

ESP32 (and ESP8266) have enough RAM for full buffered graphics with this display (400x300/8 bytes). #define MAX_DISPLAY_BUFFER_SIZE 800 is for Arduino UNO, but would work on your processor as well.

I would use a long delay, 2 to 3 seconds, after Serial.begin(), so you have enough time to start the Serial Monitor after your PC has detected your processor on USB after its reset.
You could then post diagnostic output, if your issue persists.

Good Luck!
-jz-

I have reduced the reset pulse time t 2ms, code looks now this way:

#define LOAD_GFXFF
#define ENABLE_GxEPD2_GFX 0
#include <GxEPD2_BW.h>
#include <U8g2_for_Adafruit_GFX.h>
#define MAX_DISPLAY_BUFFER_SIZE 800 
#define MAX_HEIGHT(EPD) (EPD::HEIGHT <= MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8) ? EPD::HEIGHT : MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8))

#include <Fonts/FreeMonoBold9pt7b.h>

const char HelloWorld[] = "Hello World!";

const int EPD_BUSY = 8; // ePaper Busy indicator (SPI MISO aquivalent)
const int EPD_RST  = 5; // ePaper Reset switch
const int EPD_DC   = 9; // ePaper Data/Command selection
const int EPD_CS   = 7; // SPI Channel Chip Selection for ePaper
const int EPD_SCK  = 4; // SPI Channel Clock
const int EPD_SDI  = 6; // SPI Chanpnel MOSI Pin  

GxEPD2_BW<GxEPD2_420, MAX_HEIGHT(GxEPD2_420)> display(GxEPD2_420(EPD_CS, EPD_DC, EPD_RST, EPD_BUSY));

U8G2_FOR_ADAFRUIT_GFX u8g2Fonts;

void setup() {

  Serial.begin(115200);
  delay(3000);
  Serial.println();
  Serial.println("setup");
  delay(100);

  SPI.begin(EPD_SCK, -1, EPD_SDI, -1);
  display.init(115200, true, 2, false, SPI, SPISettings(4000000, MSBFIRST, SPI_MODE0));

  u8g2Fonts.begin(display);
}

void loop() {

  static uint32_t millisUpdate = 0;

  if (millis() > millisUpdate) {

    display.fillScreen(GxEPD_WHITE);
  
    display.setRotation(0);
    uint16_t bg = GxEPD_WHITE;
    uint16_t fg = GxEPD_BLACK;
  
    u8g2Fonts.setFontMode(1);
    u8g2Fonts.setFontDirection(0);
    u8g2Fonts.setForegroundColor(fg);
    u8g2Fonts.setBackgroundColor(bg);
  
    u8g2Fonts.setFont(u8g2_font_logisoso32_tr);

    display.setPartialWindow(0, 0, display.width(), 296);
    display.firstPage();
    do
    {
      const uint8_t w = 17;
      display.fillScreen(bg);

      const uint16_t x1 = 280;
      const uint8_t y1 = 70;
      u8g2Fonts.setFont(u8g2_font_logisoso16_tr);
      
      String m = String("test", 1);
      u8g2Fonts.setCursor(x1, y1);
      u8g2Fonts.print(m.c_str());
    }
    while (display.nextPage());

    millisUpdate = millis() + 10000;
  }
}

output is:

09:15:36.196 ->
09:15:36.196 -> setup
09:15:46.681 -> _PowerOn : 4
09:15:46.681 -> _Update_Full : 1
09:15:46.681 -> _Update_Part : 1
09:15:56.837 -> _Update_Part : 0
09:16:06.989 -> _Update_Part : 0
09:16:17.146 -> _Update_Part : 0
09:16:27.274 -> _Update_Part : 0

and so forth....

still no output on the panel, though WaveShare Demo does work with same wiring...

There are 3 driver candidates for your display. Try them all, or compare the inking on the flexible panel connector.

//#define GxEPD2_DRIVER_CLASS GxEPD2_420     // GDEW042T2   400x300, UC8176 (IL0398), (WFT042CZ15)
//#define GxEPD2_DRIVER_CLASS GxEPD2_420_M01 // GDEW042M01  400x300, UC8176 (IL0398), (WFT042CZ15)
//#define GxEPD2_DRIVER_CLASS GxEPD2_420_GDEY042T81 // GDEY042T81 400x300, SSD1683 (no inking)

_M01 has this log (and no output on the panel):

09:33:07.088 ->
09:33:07.088 -> setup
09:33:17.530 -> _PowerOn : 6
09:33:17.530 -> _Update_Full : 1
09:33:17.530 -> _Update_Part : 1
09:33:27.698 -> _Update_Part : 1
09:33:37.825 -> _Update_Part : 1

GxEPD2_420_GDEY042T81 has this output:

09:34:58.374 ->
09:34:58.374 -> setup
09:34:59.922 -> _PowerOn : 97001
09:34:59.922 -> _Update_Full : 1148000
09:35:10.533 -> _Update_Part : 361000
09:35:21.118 -> _Update_Part : 360000

and produces (at least) pixel chaos on the display

Most likely this panel is not supported by GxEPD2. Waveshare now buys panels from different sources.

most probably you are right: I switched to a previously purchased panel and this worked fine - damn!