Using E-Paper with the Adruino Nano RP2040 Connect

Hello People,

at the moment i am trying to use the Arduino Nano RP2040 Connect to transfer images onto an E-Paper-Display.
I am using different displays:

  1. Waveshare EPD 4.2" (greyscale)
  2. Waveshare EPD 5.65" (7 Colors)

After rewriting the library a bit (library was written for UNO, had to adjust the pin-settings), and changing the data-type of my image (const unsigned char -> const char) the 4.2" Display works fine on the RP2040.
But i just can't get the 5.65" display to work. There is no problem compiling the sketch, no problem uploading it to flash, but nothing happens after that (windows just shows an error referring to a defect USB-device sometimes so i have to reset the RP2040).
The image is stored as a C-Array.
Both displays work fine on the Arduino Uno and the Arduino Mega 2560 (but i had to switch to a 32 bit controller since my arrays would get bigger than 32767 and the Mega is 16 bit and I also plan to use the connect-features of the RP2040).

My sketch looks like this:

#include <SPI.h>
#include "epd5in65f.h"
#include "Image_imagedata.h"


void setup()
{

Serial.begin(115200);
Epd epd;

if (epd.Init() != 0) 
{
Serial.print("e - Paper init failed");
return;
}

epd.Clear(EPD_5IN65F_WHITE);
epd.EPD_5IN65F_Display(Image);
}

void loop() {}

Image_imagedata.h looks like this:

extern const char Image[];

Image_imagedata.cpp looks like this:

#include "Image_imagedata.h" 
#include <avr/pgmspace.h> 
 
const char Image[] PROGMEM=
{0x00,0x00,0x00,0x00,0x00,0x50..........}

I am using the following libraries:
5.65" 7-Color Display:

4.2" greyscale Display:

I have really no idea why the RP2040 works with the greyscale display but just does nothing when using the 7-Color Display or why the ATMega works fine with both... I would apreciate some tips or help.

Kindest regards

@jzargo, Hi,

Please let me play a moment with my new toy for myself, before having to share it with my comrades!

About 3 hours ago UPS brought my parcel with the Arduino Nano RP2040 I had ordered.
Tomorrow I will have time to play with it, and try to make it work with my library GxEPD2.
This should be quite straightforward. I just need to install the package for RP2040, identify the HW SPI pins, and connect an e-paper display to it. And add a constructor for the e-paper for this target and wiring to the GxEPD2_Example.

I will let you know.

Jean-Marc

See also this post. And this post.

Hey Jean-Marc

thanks a lot for the quick reply! Earlier in my project, i was looking at your libraries so i will take some time to get them to work. Looking forward to hearing from you. My Problem seems to be specific to the display.

I got my new toy working. I use this wiring:

// mapping suggestion for Arduino Nano RP2040 Connect
// BUSY -> 7, RST -> 9, DC -> 8, CS-> 10, CLK -> 13, DIN -> 11

I added this conditional compile section to GxEPD2_display_selection_new_style.h of the example:

#if defined(ARDUINO_ARCH_RP2040)
#define MAX_DISPLAY_BUFFER_SIZE 131072ul // e.g. half of available ram
#if IS_GxEPD2_BW(GxEPD2_DISPLAY_CLASS)
#define MAX_HEIGHT(EPD) (EPD::HEIGHT <= MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8) ? EPD::HEIGHT : MAX_DISPLAY_BUFFER_SIZE / (EPD::WIDTH / 8))
#elif IS_GxEPD2_3C(GxEPD2_DISPLAY_CLASS)
#define MAX_HEIGHT(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE / 2) / (EPD::WIDTH / 8) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE / 2) / (EPD::WIDTH / 8))
#elif IS_GxEPD2_7C(GxEPD2_DISPLAY_CLASS)
#define MAX_HEIGHT(EPD) (EPD::HEIGHT <= (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2) ? EPD::HEIGHT : (MAX_DISPLAY_BUFFER_SIZE) / (EPD::WIDTH / 2))
#endif
// adapt the constructor parameters to your wiring
GxEPD2_DISPLAY_CLASS<GxEPD2_DRIVER_CLASS, MAX_HEIGHT(GxEPD2_DRIVER_CLASS)> display(GxEPD2_DRIVER_CLASS(/*CS=4*/ EPD_CS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));
#endif

The additions will be part of the next release of GxEPD2.


GxEPD2_display_selection_new_style.h (13.2 KB)

@jzargo,

concerning your question, I have no answer, as I am not familiar with the Waveshare sources.

Hello Jean Marc,
Thanks a lot for the answer! I will try out your solution!

Hello again Jean Marc!

i've got the display working with your library, but i am still struggeling with displaying custom bitmaps.
The image you used in your last picture is the test image for the waveshare display, how did you make it show up on the display?
I have written some c++ programms for transformin .ppm images to c-strings, this works for the waveshare sources but apparently not for your library. How do i need to convert the images in order for them to show up the correct way?
At the moment, I am using 8-bit-hex strings, each hex countains the information for two pixels since each pixel needs to be 4-Bit.

Kindest Regards
Lennart

Hi, by running GxEPD2_Example.ino.

It has this function:

#if defined(_WS_Bitmaps7c192x143_H_)
void drawBitmaps7c192x143()
{
  if (display.epd2.panel == GxEPD2::ACeP565)
  {
    display.drawNative(WS_Bitmap7c192x143, 0, (display.epd2.WIDTH - 192) / 2, (display.epd2.HEIGHT - 143) / 2, 192, 143, false, false, true);
    delay(5000);
  }
}
#endif

Jean-Marc

Hello Jean-Marc,

again, thanks a lot! The drawNative function was exactly what i needed!
I will reconfigure my workflow to fit your library.
This task is a part of my masters thesis, since i will now be using your sources, i would like to credit/reference you. I can use your online name or your full name, if you like to you can let me know your preference!

Kindest Regards
Lennart

Hi Lennart

Thank you for the feedback!

I slightly prefer use of my full name in this case, thank you.

Best Regards

Jean-Marc Zingg

Hello Jean Marc,

using your library with the 7-Color Display and the RP2040 i have made some significant progress for my project. Another display i am using is the 4.2" grayscale one from Waveshare. Getting it to work with your library was easy, but i was wondering if it is possible, to use the draw functions (drawRect, drawCircle, fillTriangle etc.) for the different grayscale-levels.
So far, i have not found a way to combine drawing and grayscale, is there a way to do that with your resources?

Kindest Regards
Lennart

Hi Lennart,

there is an experimental library GxEPD2_4G.
It supports the panel GDEW042T2, which is used by the Waveshare 4.2" b/w board.
You would need to download it as ZIP-file and install it with the Library Manager using add ZIP-file.

Jean-Marc

Hello Jean Marc,

thanks again for the fast reply! I will try to get your library to work and notify you of my results.

Kindest Regards
Lennart

Hallo Jean Marc,

i just wanted to give some feedback:
Your experimental library works fine for my panel (GDEW042T2).
I just had to add the RP2040 and adjust the mapping.
Since i am using a diffrent color-code i also adjusted the depth when using the "drawGreyPexmap" funktion (I am using a depth of 2 instead of 4).
I can now integrate this library into my project.

Kindest Regards
Lennart

2 posts were split to a new topic: Alter mapping of GxEPD2_4G library in example codes

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.