Go Down

Topic: Waveshare e-paper displays with SPI (Read 304529 times) previous topic - next topic

ZinggJM

From …/nona4809/pins_arduino.h

Code: [Select]
#define SPI_MUX       (PORTMUX_SPI0_ALT2_gc)
#define PIN_SPI_MISO  (12)
#define PIN_SPI_SCK   (13)
#define PIN_SPI_MOSI  (11)
#define PIN_SPI_SS    (8)

static const uint8_t SS   = PIN_SPI_SS;
static const uint8_t MOSI = PIN_SPI_MOSI;
static const uint8_t MISO = PIN_SPI_MISO;
static const uint8_t SCK  = PIN_SPI_SCK;


SS differs from UNO(10).

Make sure that pins used for e-paper are free, not used by on board resources.
Most likely a different pin needs be uses for CS, as SPI is used also with WiFi, as far as I have seen on schematics. Check schematics.
No personal message please; any question may be useful for other users. Use code tags for code. Make links clickable with URL tags. Provide links to the product in question.

gilpster

Thank you for your direction @ZinggJM

Got it working with the UNO Wifi Rev2.  The CLK and DIN needed to be connected directly to the ICSP header.  As you suggested pin 10 was used by the wifi module, but CS worked fine attached to pin 4.

Could I suggest the following addition to the mapping suggestions:

Code: [Select]

// mapping suggestion for UNO Wifi Rev2 (#defined as AVR_UNO_WIFI_REV2)
// SPI pins are on 6 pin 2x3 ICSP header
// BUSY -> 7, RST -> 9, DC -> 8, CS-> 4, CLK -> SCK, DIN -> MOSI


The Wifi Rev2 has 48K flash memory.  I don't know what buffer size this would entail, but it works fine at 800.

dadokkio

While I'm still having issues generating c array from images I made I workaround writing my custom encoder and plotting the image with multiple for and drawpixel function.

Now I've another question related to display.print function (with GxEPD2_4G library)

The print function uses all screen size and when the line it's too long it started on the following line from the beginning of the screen. It's possible to limit the text bound so all news lines will start with some lateral margin?

ZinggJM

Quote
It's possible to limit the text bound so all news lines will start with some lateral margin?
No, print is a method of Adafruit_GFX and takes the whole screen size.
No personal message please; any question may be useful for other users. Use code tags for code. Make links clickable with URL tags. Provide links to the product in question.

dadokkio

Ok, It was what I was thinking.
In my case the long text was returned by graphql api, so I've just changed the backend to return a list of small strings instead of the full text.

Thanks

 

acca

#1745
Mar 04, 2020, 10:45 pm Last Edit: Mar 05, 2020, 09:44 am by acca
Hello and thank you very much for GxEPD2
I'd like to use it with Waveshare 7.5" epaper (first version) and waveshare esp8266 driver board
I manage to print bitmaps and text to epaper, but the result is very "faded", i mean the text and bitmap should be black but it is grey.
You can find a photo of my display here : https://photos.app.goo.gl/PbHdCoxF9Sbq59oeA

And my code is :

Code: [Select]
#define ENABLE_GxEPD2_GFX 1

#include <GxEPD2_BW.h>
//#include <GxEPD2_3C.h>
#include <Fonts/FreeMonoBold9pt7b.h>

#include "BitmapDisplay.h"
#include "TextDisplay.h"

#if defined (ESP8266)


// ***** for mapping of Waveshare e-Paper ESP8266 Driver Board *****
// select one , can use full buffer size (full HEIGHT)

GxEPD2_BW < GxEPD2_750, GxEPD2_750::HEIGHT / 2 > display(GxEPD2_750(/*CS=15*/ 15, /*DC=4*/ 4, /*RST=5*/ 5, /*BUSY=16*/ 16));

#endif



#include "GxEPD2_boards_added.h"
//#include "GxEPD2_more_boards_added.h" // private

BitmapDisplay bitmaps(display);

void setup()
{
  Serial.begin(115200);
  Serial.println();
  Serial.println("setup");
  delay(100);
  display.init(115200);
  // first update should be full refresh

  const unsigned char ampoule []  = {
    // 'ampoule, 32x32px
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00,
    0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x01, 0x01, 0x80, 0xc0, 0x01, 0x81, 0x81, 0xc0,
    0x01, 0xc0, 0x03, 0x80, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x63, 0xc2, 0x00, 0x00, 0x07, 0xf0, 0x00,
    0x00, 0x0f, 0xf8, 0x00, 0x00, 0x1f, 0xf8, 0x00, 0x00, 0x1f, 0xfc, 0x00, 0x1f, 0x1f, 0xfc, 0xf8,
    0x1f, 0x1f, 0xfc, 0xf8, 0x00, 0x1f, 0xfc, 0x00, 0x00, 0x1f, 0xf8, 0x00, 0x00, 0x0f, 0xf8, 0x00,
    0x00, 0x07, 0xf0, 0x00, 0x00, 0x60, 0x82, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x01, 0xc0, 0x03, 0xc0,
    0x01, 0x81, 0x81, 0xc0, 0x01, 0x01, 0x80, 0x80, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00,
    0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  };
  display.setRotation(1);
  display.setFont(&FreeMonoBold9pt7b);
  display.setTextColor( GxEPD_BLACK);
  display.setFullWindow();
  display.firstPage();
  do
  {
    display.fillScreen(GxEPD_WHITE);
    display.drawBitmap(16, 16, ampoule, 32, 32, GxEPD_BLACK);
    display.drawBitmap(160, 16, ampoule, 32, 32, GxEPD_BLACK);





    display.setCursor(10, 10);
    display.print("Text to print");

    display.setCursor(50, 50);
    display.println("50    50");

    display.setCursor(100, 100);
    display.println("100    100");

    display.setCursor(200, 200);
    display.println("200    200");

  } while (display.nextPage());
  delay(5000);








  display.powerOff();
  //  deepSleepTest();
  Serial.println("setup done");
}

void loop()
{
}


Thanks for the help

ZinggJM

#1746
Mar 05, 2020, 07:35 am Last Edit: Mar 05, 2020, 09:39 am by ZinggJM
@acca,

welcome to the forum. Please take a moment to read General Guidance and How to use the Forum and its first link.

Code in a Quote window or as included text is unpleasant to read. Please put it in a code window, using the </>-command symbol. Please edit your post and change this, using Modify on bottom right.

Your picture shows less contrast than normal.

The 7.5" b/w panel is used with waveform table from embedded flash memory, both by the demo examples and by GxEPD2. Therefore GxEPD2 has no influence to the contrast. But you can check with the demo from Waveshare or Good Display to see if there is any difference. The 7.5" panels I have are quite "old", the actual panels may be different. Please report in case. Please also check diagnostic output in Serial Monitor, to see if BUSY active times are reasonable. Post it in a code window.

Check the voltage on the 3.3V pin of your ESP8266 Driver Board. It may be too low for the big e-paper panel. The series connection of a protection diode and the LDO may produce a too high drop. You could add an external LDO from 5V to the 3.3V pin. Or you can supply 5V to the 5V pin.

Jean-Marc
No personal message please; any question may be useful for other users. Use code tags for code. Make links clickable with URL tags. Provide links to the product in question.

acca

Hello
I tried Waveshare demo and display is ok

I have the following messages in serial monitor :

Code: [Select]
setup
_PowerOn : 9
_Update_Full : 1
_PowerOff : 2
_PowerOff : 9
setup done

ZinggJM

@acca,

your results are a mystery.

If the Waveshare demo works, then GxEPD2 should also work ok.
But your diagnostic output shows that GxEPD2 doesn't work correctly.
The BUSY active time is not only too short, but BUSY isn't ever active.
The few microseconds are the time to read the BUSY line.

I know that the demo checks the BUSY state, but it may do an additional delay. Maybe this makes it work somehow.

I guess you didn't connect the panel connector correctly to the driver board.

My ESP6266 driver board has a connector with retainer that needs to be pulled out about 1mm before inserting the flex connector well in, then pushed in firmly. The retainer is under the flex connector. The other version has a retainer that is above the flex connector, needs be pulled up before inserting, then pushed down. Make sure that the flex connector is well aligned and firmly in.

That's all I can say to try to help you.
No personal message please; any question may be useful for other users. Use code tags for code. Make links clickable with URL tags. Provide links to the product in question.

acca

#1749
Mar 05, 2020, 09:53 pm Last Edit: Mar 05, 2020, 10:25 pm by acca
Thank you again, i think i found the problem
I think my screen had a start of crack that was causing those problems, because when i opened the frame contening the screen, it cracked without forcing.

Now my screen is dead !

thanks anyway !

Thomasx

Hi

Just got a 7.5" display and hooked it up with a Mega.
Run the epd7in5_V2 and it runs through the whole code but nothing happens on the display.
At one occation one pixel to the left of the screen turned black. But that's the only thing that ever happened. Tried several times. Also tried the epd7in5b_V2 code, same thing.

Any ideas what the issue might be?

ZinggJM

@Thomasx,

welcome to the forum. Please read General Guidance and How to use the Forum and the topic of its first link.

If you provide all relevant information, then I get a better chance for a good answer to your question.

I need to know which 7.5" panel you have, 800x480 or 640x384, b/w or 3-color.
It is best if you provide a link to where you bought it, or to the panel on the Waveshare or Good Display web site, https://www.waveshare.com, http://www.e-paper-display.com/.
Make the link clickable using the insert a link command symbol icon.
The two resolutions have different controllers, and Waveshare has different demos or libraries for them.

I would also need to know which connection board you use to connect the panel to your processor.

I already know from your post that you use an Arduino MEGA and a library or demo from Waveshare.

Jean-Marc
No personal message please; any question may be useful for other users. Use code tags for code. Make links clickable with URL tags. Provide links to the product in question.

Thomasx


@ZinggJM,

Thanks! I have the V2 800x480 (B) Three color version

https://www.waveshare.com/7.5inch-e-paper-hat-b.htm

and the e-Paper HAT for Raspberry Pi that came with it.

I've tried it with the Arduino Uno, Due and Mega, and now also with a Raspberry PI.

I've tried some different demos, but mainly the epd7in5b_V2

I notice when I run it with the Arduino that it "hangs" for a shorter or longer time in the WaitUntilIdle during Init. Sometimes it just runs right pass it and other times it hangs for minutes and suddenly it passes by and does the rest of the demo. But nothing pops up on the screen.

I did some measurements on the connection board and that seems to be working fine. I can measure good signals on both sides of the Voltage level-shifter IC.

ZinggJM

@Thomasx,

https://www.waveshare.com/7.5inch-e-paper-hat-b.htm

https://www.waveshare.com/product/raspberry-pi/displays/e-paper/e-paper-driver-hat.htm

I would first check the flex cable connections. These are a bit tricky. See post #1748:

Quote
My ESP6266 driver board has a connector with retainer that needs to be pulled out about 1mm before inserting the flex connector well in, then pushed in firmly. The retainer is under the flex connector. The other version has a retainer that is above the flex connector, needs be pulled up before inserting, then pushed down. Make sure that the flex connector is well aligned and firmly in.
The connection cable to the Arduino can also cause problems. The connector to the HAT needs be pushed firmly in. The DuPont connectors may have bad contact.

Make sure that the pin use defines of the demo correspond to your wiring.

If you try with the library GxEPD2, available with Library Manager, you need to find the HW SPI pins on MEGA (ICSP connector), as it uses HW SPI. Diagnostic output for BUSY active time may help. Note that GxEPD2 uses per default different pins than the Waveshare demo.

Jean-Marc
No personal message please; any question may be useful for other users. Use code tags for code. Make links clickable with URL tags. Provide links to the product in question.

Thomasx

Hi

There are no issues with the connectors, they're all properly connected.
I tried with an RPI 3B today as well. Also does not work.

I have measured all components and signals on the adapter board and everything looks ok there. So I guess the conclusion has to be that this display simply was bad out of the box.

Will check with the shop tomorrow to see what they say.

I also got a 10.3" e-paper display and that one work great right away.

Go Up