Initialization problems with the v2 Waveshare e-paper display.

Hello Arduino forums,

This is my first message here. I’m trying to develop my first projects on waveshare displays. Unfortunately I’m currently skilled in programming alone, I know very little about microcontroller’s world.

In particular, I have some problems now regarding the “new” Waveshare e-paper HAT display, 7.5" Black and White, the board is ESP32 based. After I accidentally broke the previous one, they sent me a new one which is like an “updated” version of some sort. Anyway, the thing is the previous code I wrote for the first display does no more work in the display they sent me now even though they’re the same, but the demo code they provide in their webpage works correctly:

https://www.google.it/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=2ahUKEwjN8JC-yJzoAhUSyqQKHV8hCgAQFjAAegQIBRAB&url=https%3A%2F%2Fwww.waveshare.com%2Fwiki%2F7.5inch_e-Paper_HAT&usg=AOvVaw03acwwotSPPvSadpoOpmE2

I also noticed the demo code now has got a “v2” option for the 7.5" display, so I figured out there was a difference between the two they sent me, in fact the product webpage was updated with a red note.

So I believe the initialization must be changed now.
For the previous model, using the GxEPD2 libraries, the initialization was basically this:

GxEPD2_BW<GxEPD2_750, GxEPD2_750::HEIGHT> display(GxEPD2_750(/*CS=*/ 15, /*DC=*/ 27, /*RST=*/ 26, /*BUSY=*/ 25));

(...)

SPI.begin(13, 12, 14, 15);

But now I believe it doesn’t work since the serial output of the drawing function provided in the library’s examples gives a “Busy Timeout!” and the display won’t update.
Also I can’t find any documentation on the SPI.begin() , I took this overloaded method from another post I read on this forum, it seems everyone uses the SPI.begin() without any additional parameters, but it doesn’t work anyway for me.

@nadetalityyy,

welcome to the forum. Your post looks good and informative for a first time poster, thank you.
So you may already have read the General Guidance and How to use the Forum.

You got a tripple complication: you seem to have the Waveshare ESP32 Driver board with its nonstandard SPI pins, a new version of the 7.5" e-paper panel, and a library where in the example for the ESP32 Driver board the constructor line for this panel is missing.

So you need to look at the standard example GxEPD2_Example.ino
and see that there is a constructor line for your panel:

//GxEPD2_BW<GxEPD2_750_T7, GxEPD2_750_T7::HEIGHT> display(GxEPD2_750_T7(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW075T7 800x480

add it to your code and adapt the parameters to the ESP32 Driver pins, like in the example GxEPD2_WS_ESP32_Driver.ino
similar to:

//GxEPD2_BW<GxEPD2_750, GxEPD2_750::HEIGHT> display(GxEPD2_750(/*CS=*/ 15, /*DC=*/ 27, /*RST=*/ 26, /*BUSY=*/ 25));

resulting in:

GxEPD2_BW<GxEPD2_750_T7, GxEPD2_750_T7::HEIGHT> display(GxEPD2_750_T7(/*CS=*/ 15, /*DC=*/ 27, /*RST=*/ 26, /*BUSY=*/ 25));

I should have added that line, but I don’t always update all examples, as these are just examples.

For the explanation about the SPI.begin() parameters see the example GxEPD2_WS_ESP32_Driver.ino.

Jean-Marc

1 Like

@Zingg

Many thanks for rescuing me.

That was a very informative post, thank you.
I understood what you said: I replaced my display initialization with what you just suggested, but unfortunately while compiling I get the following errors:

sketch\epaper.ino.cpp.o:(.literal.startup._GLOBAL__sub_I__Z13ma_debug_initv+0x18): undefined reference to `vtable for GxEPD2_750_T7'

sketch\epaper.ino.cpp.o:(.literal.startup._GLOBAL__sub_I__Z13ma_debug_initv+0x2c): undefined reference to `GxEPD2_750_T7::GxEPD2_750_T7(signed char, signed char, signed char, signed char)'

sketch\epaper.ino.cpp.o:(.literal._Z19showBitmapFrom_HTTPPKcS0_S0_ssb+0x98): undefined reference to `GxEPD2_750_T7::writeImage(unsigned char const*, unsigned char const*, short, short, short, short, bool, bool, bool)'

sketch\epaper.ino.cpp.o:(.literal._Z19showBitmapFrom_HTTPPKcS0_S0_ssb+0x9c): undefined reference to `GxEPD2_750_T7::refresh(bool)'

I must say, also, that I made sure my library GxEPD2 is updated to the 1.2.6 version - the last one.

I hope you can still give me a hand here :slight_smile:

Many thanks for your work.

@nadetalityyy,

I don't understand how this can happen. It might help if you exit the Arduino IDE and start it new.

You could also try to compile the example GxEPD2_WS_ESP32_Driver.ino, after having added the new constructor line.

BTW the updated example is on GitHub, it will be available with Library Manager with the next release.

If I need to check your issue, then you would need to post your complete code.

Jean-Marc

@Zingg

Sorry, that was indeed a mistake I made with the libraries. I had to edit manually some of the libs files because I noticed I messed up a bit with the folders and stuff.

Now everything works well :smiley:

Thanks for your help !