GDEW042C37 display issue on Heltec board

Hi everyone, I need help please to make my display work.

OK so I have this board


and this screen
https://heltec.org/project/e-ink-screen/ (4.2" black white yellow)

I’m using arduino IDE

I downloaded those libraries
GxEPD 1 &2
Heltec E-INK
Heltec ESP32 devboards
Heltec eink modules

The connection between the PC and the board is OK. I use Heltec E-Ink Driver on COM 10.

I compiled several codes, they seem to work but the texte is never showing on the epaper
I always have busy errors

So I think maybe The CS, DS, RST and BUSY pins are wrong? What are they for a GDEW042C37

My epaper is not referenced in any library so it is hard to figure out the problem

Could someone help please?

Hi @p4ent,

I did a bit of a hunt. The display is currently out of stock at the website, so not sure how you got it, but that doesn’t matter.
The Heltec download directory contains this folder.
While the Heltec listing says it uses the IL0371 as a driver (see here), the download directory reveals it apparently uses the IL0398 and is a 400×300 pixels three-color display.

With this information I went to the infamous GxEPD2 examples, and lo and behold, it contains a similar entry:


Now I’m not at all sure what happens when you connect it through Heltec’s adapter board, but it would definitely be worth giving it a shot. The GxEPD2 system for pin definitions is a hassle - please dig into it very very carefully if you use any non-default SPI pins, and even if you do, double check the pin numbering please. But I think you’ll have a reasonable chance at getting something on your display.

I’ve got it working now with AB01 and Waveshare 2.9inch E-Paper Module 296x128 Resolution
See:


Pinout is:
BUSY GPIO05 33
RST GPIO01 6
DC GPIO02 7
CS GPIO03 8
CLK SCK 21/37
SPI MOSI 19/36

GND GND
VCC Vext or VDD

I hope this helps others.

What exactly does that help here? You’ve got both a different board and a different display :wink:

1 Like

thanks Lordcyber, that may be helpful somehow

Many thanks @bns !
For sure I didn’t know those secret files and they are helpful.
I have to say if it is not obvious yet I’m a total beginner here.

So following your advice, I dug into this GxEPD2_display_selection_new_style.h example.
You’re right, L93 sounds like the good one.

So I uncommented this line and also line 22
#define GxEPD2_DISPLAY_CLASS GxEPD2_3C

Now I guess I have to set up the board?
I can see a lot of arduino lines within “if blocks”, I think none of them is relevant to my board right?

Should I comment everything and try to set up those lines? (L232-235)

’ GxEPD2_DISPLAY_CLASS < GxEPD2_DRIVER_CLASS, MAX_HEIGHT(GxEPD2_DRIVER_CLASS) > display(GxEPD2_DRIVER_CLASS(/sck=/ 13, /miso=/ 12, /mosi=/ 14,
/cs_m1=/ 23, /cs_s1=/ 22, /cs_m2=/ 16, /cs_s2=/ 19,
/dc1=/ 25, /dc2=/ 17, /rst1=/ 33, /rst2=/ 5,
/busy_m1=/ 32, /busy_s1=/ 26, /busy_m2=/ 18, /busy_s2=/ 4));’

I understood that I needed to be careful with the pinouts

I did not find technical documentation yet on this point, but an IA research told me I should use CS:5; DC:17; RST:16 & BUSY:4

So it gave me that simple sketch that eventually didn’t work

#include <GxEPD2_3C.h>
#include <Adafruit_GFX.h>

#define EPD_CS   5
#define EPD_DC   17
#define EPD_RST  16
#define EPD_BUSY 4

GxEPD2_3C<GxEPD2_420c, GxEPD2_420c::HEIGHT> display(GxEPD2_420c(EPD_CS, EPD_DC, EPD_RST, EPD_BUSY));

void setup()
{
  display.init();
  display.setRotation(1);
  display.setTextColor(GxEPD_BLACK);
  display.setCursor(10, 40);
  display.firstPage();
  do {
    display.fillScreen(GxEPD_WHITE);
    display.print("hello world!");
  } while (display.nextPage());
}

void loop() {}

Could you provide me further assistance please? Many thanks

As far as I can tell from the schematic for the Heltec adapter board, the correct pins would be 4, 5, 6 and 7 respectively for CS, DC, RST and BUSY. (Instead of 5, 17, 16, 4.)
And then you would need to ensure that the SPI pins are correct. I think this should work:

SPIClass hspi(HSPI);

void setup() {
  hspi.begin(3, -1, 2, 4); // remap hspi for EPD
  display.epd2.selectSPI(hspi, SPISettings(4000000, MSBFIRST, SPI_MODE0));
  display.init(115200);
  // ...

The argument to display.init() says to do some simple logging using a baudrate of 115200 (default) - if your serial logging is configured correctly, this should show you some timestamps of internal procedures. If these timestamps are single digits, this means that some pins are likely incorrect. If all is good, you should see the number of microseconds it took to do a refresh etc.
Hopefully this will help you get going!

thanks @bns
following your advice, I tried to pass this sketch

#include <GxEPD2_BW.h>

#include <SPI.h>

// Création d'un objet SPI HSPI (second contrôleur SPI de l'ESP32-S3)

SPIClass hspi(HSPI);

// Brochage correct selon le schéma Heltec

#define EPD_CS   4   // Pin 4 - Chip Select

#define EPD_DC   5   // Pin 5 - Data/Command

#define EPD_RST  6   // Pin 6 - Reset

#define EPD_BUSY 7   // Pin 7 - Busy

// Constructeur GxEPD2 pour l'écran GDEW042C37 400x300 (noir, blanc, jaune)

GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(/*CS*/ EPD_CS, /*DC*/ EPD_DC, /*RST*/ EPD_RST, /*BUSY*/ EPD_BUSY));

void setup()

{

  Serial.begin(115200);

  delay(100); // Attente pour éviter les débordements de buffer au démarrage

  // Initialisation du SPI secondaire avec remappage (CLK = 3, MISO = non utilisé, MOSI = 2, CS = 4)

  hspi.begin(3, -1, 2, EPD_CS); // CLK, MISO, MOSI, SS (CS)

  // Remplacer SPI par HSPI pour ce périphérique

  display.epd2.selectSPI(hspi, SPISettings(4000000, MSBFIRST, SPI_MODE0));

  // Initialisation de l'écran avec debug à 115200

  display.init(115200);

  // Nettoyage de l'écran

  display.setRotation(1); // optionnel, selon orientation

  display.setFullWindow();

  display.firstPage();

  do

  {

    display.fillScreen(GxEPD_WHITE);

    display.setTextColor(GxEPD_BLACK);

    display.setCursor(10, 50);

    display.setFont(0); // police de base (texte brut)

    display.println("Hello from ESP32-S3!");

    display.println("GDEW042C37 test.");

  }

  while (display.nextPage());

  Serial.println("Affichage terminé.");

}

void loop()

{

  // Ne rien faire dans la boucle principale

}

but it did not work either

that is the answer on serial monitor

ESP-ROM:esp32s3-20210327

Build:Mar 27 2021

rst:0x1 (POWERON),boot:0x18 (SPI_FAST_FLASH_BOOT)

SPIWP:0xee

mode:DIO, clock div:1

load:0x3fce3818,len:0x508

load:0x403c9700,len:0x4

load:0x403c9704,len:0xad0

load:0x403cc700,len:0x29e4

entry 0x403c9880

Busy Timeout!

_PowerOn : 10001062

Busy Timeout!

_Update_Full : 10001029

_PowerOff : 20000

Affichage terminé.

always busy timeout :confused:

there is a battery slot on this board, do you think :

  • the battery needs to be plugged (it is)
  • the battery needs to be full (I guess, no multimeter available here)

note:

  • when usb connected : one battery makes the orange led on for 2 minutes (I think it is full), with the other the led stays orange (charging?)
  • no orange led on without usb connected

In this sketch, you switched from 3C to BW (and from 420c to 420), so that is at least something. Best not to use ChatGPT for every small modification. But that won’t solve the Busy problem here.

Can you confirm that this is your board?

You are totally right :smile: and I corrected this afterwards, which did not solve the busy issue unfortunately.

I confirm this is absolutely my board.

Ah, even this board has Vext_Ctrl, on pin 45. You will have to turn this pin LOW as first in the setup.

Oh my ! GG @bns ! I finally got a text on my screen

Here is the code

#include <GxEPD2_3C.h>

#include <SPI.h>

// SPI secondaire (HSPI) pour l'écran

SPIClass hspi(HSPI);

// Brochage correct selon le schéma Heltec

#define EPD_CS   4   // Chip Select

#define EPD_DC   5   // Data/Command

#define EPD_RST  6   // Reset

#define EPD_BUSY 7   // Busy

// Déclaration de l'écran trichrome 4.2"

GxEPD2_3C<GxEPD2_420c, GxEPD2_420c::HEIGHT> display(GxEPD2_420c(EPD_CS, EPD_DC, EPD_RST, EPD_BUSY));

void setup() {

  // Activation alimentation écran via Vext (GPIO 45)

  pinMode(45, OUTPUT);

  digitalWrite(45, LOW); // LOW = ON pour activer Vext

  Serial.begin(115200);

  delay(1000);

  Serial.println("Début du setup");

  // Initialisation du SPI secondaire avec brochage

  hspi.begin(3, -1, 2, 4); // SCK = 3, MISO = -1 (non utilisé), MOSI = 2, SS = 4

  // Affectation du SPI secondaire à l'écran

  display.epd2.selectSPI(hspi, SPISettings(4000000, MSBFIRST, SPI_MODE0));

  Serial.println("Initialisation de l'écran...");

  display.init(115200);

  delay(100);

  display.setRotation(1);

  display.setTextColor(GxEPD_BLACK); // Noir pour commencer

  display.setFullWindow();

  display.firstPage();

  do {

    display.setCursor(10, 30);

    display.setTextSize(2);

    display.print("HELLO EINK");

  } while (display.nextPage());

  Serial.println("Affichage terminé");

}

void loop() {

  // Rien ici pour l’instant

}

I still have some BUSY stuff in the monitor but the text definitely appeared

ESP-ROM:esp32s3-20210327

Build:Mar 27 2021

rst:0x1 (POWERON),boot:0x3b (SPI_FAST_FLASH_BOOT)

SPIWP:0xee

mode:DIO, clock div:1

load:0x3fce3818,len:0x508

load:0x403c9700,len:0x4

load:0x403c9704,len:0xad0

load:0x403cc700,len:0x29e4

entry 0x403c9880

Début du setup

Initialisation de l'écran...

Busy Timeout!

_PowerOn : 20001041

Busy Timeout!

_Update_Full : 20001030

_PowerOff : 6737000

Affichage terminé

Thank you so much @bns that is a big step forward

1 Like

Sweet! I’m not sure what the underline means on the schematic of the driver board or if the display uses some inverted BUSY logic. You may try adding LOW or TRUE as an argument after EPD_BUSY in the display constructor - not sure which is the right one.
Alternatively, it could be that there is a small incompatibility between the GxEPD2 driver and the actual display driver. As another argument after the BUSY logic level, you can specify a timeout duration in microseconds I think, if the busy logic cannot be fixed otherwise.

Try getting a line over the top of some text vs getting some text underlined. So most of us just resort to underline or maybe a ~ at the front or or a suffix of _INV or occasionally something even more cryptic.

Those mathematicians have a lot to answer with all their squiggles for basic logic …

Perhaps time, XKCD style, to introduce a new standard.

1 Like