Go Down

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

ZinggJM

So sorry ... please, could you try to explain to me again what I need to check?

Thanks a lot for your patience.
I wanted you to test if the SPI signals are really on the pins marked SCK and MOSI on the HUZZAH32.

But this test is no longer needed, as I found out that this is true if you compile for HUZZAH32, as the ESP32 has this flexibility.

So your issue must be something else. I intend to test your wiring on my Wemos D1 R32 with compiled for HUZZAH32, to find out if some pin can't be used.

For now I have no suggestion for you, except to try different pins for the other data lines (CS, DC, RST, BUSY) one by one. Or wait until I might have found out something.
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.

ZinggJM

@juanpabloaj,

I tried your pin mapping on my Wemos D1 R32 with board selected "Adafruit ESP32 Feather", and it also didn't work.

It works, if I change DC to pin 12. I don't know why pin 33 doesn't work, and I didn't check other combinations.

I hope this works for you also. Don't forget my Karma points if it does.
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.

D_Geronimo

Hi all,

Had some trouble connecting a wemos d1 mini v2.3.0 (original one from Wemos) with the waveshare hat.
Also couldn't upload code if wemos was connected to hat and serialmonitor output was al random chars.

Solution that work below:
BUSY -> D2
RST -> D4
DC -> D3
CS -> D1  (Not D8 as found in library examples)
CLK -> D5
DIN -> D7
GND -> GND
3.3V -> 3.3V

GxIO_Class io(SPI, D1, D3, D4);
GxEPD_Class display(io, D4, D2);

Bjack795

Hi,
it's a lot of time I haven't written anything despite I'm always following the discussion.

I'm writing since I had a trouble with my 2.9".
My pc blocked during an execution with the serial monitor open, I couldn't do anything but forcing the closing of Arduino IDE by task manager.

When I opened it again there was an update available for the ESP32 and I did it.
Then I uploaded the sketch again without testing if it was working as it was.

The result is that all it's working except for the screen.
The serial monitor is still sending the "update part" log but the screen it's not updating.

Now I don't know if the problem is caused by the forced stop of the execution (most likely) or it's due to something in the board manager update that I did.

Do you think I should buy another screen? I've tried to upload the demo etc and still no response.

Thank you.

ZinggJM

@Bjack795,

I faintly remember you use a D32 Pro... But you should always repeat relevant information, e.g. board and library used.

See in C:\Users\xxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.1\variants\d32_pro\pins_arduino.h:

Code: [Select]
#ifndef Pins_Arduino_h
#define Pins_Arduino_h

#include <stdint.h>
#include <../d32/d32_core.h>

static const uint8_t LED_BUILTIN = 5;
#define BUILTIN_LED  LED_BUILTIN // backward compatibility
static const uint8_t _VBAT = 35; // battery voltage


#define TF_CS   4  // TF (Micro SD Card) CS pin
#define TS_CS   12 // Touch Screen CS pin
#define TFT_CS  14 // TFT CS pin
#define TFT_LED 32 // TFT backlight control pin
#define TFT_RST 33 // TFT reset pin
#define TFT_DC  27 // TFT DC pin

#define SS      TF_CS

#endif /* Pins_Arduino_h */


They (re-) defined SS, so it is no longer 5, as from d32_core.h.

So you need to use 5 for the CS parameter instead of SS, if you connect CS to 5.

#undef SS // would also work.

I will need to change GxEPD2_boards_added of GxEPD2_Example in the next release.
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.

Bjack795

@Bjack795,

I faintly remember you use a D32 Pro... But you should always repeat relevant information, e.g. board and library used.
Excuse me, you're right. I was pretty desperate and I forgot to repeat the configuration.

They (re-) defined SS, so it is no longer 5, as from d32_core.h.

So you need to use 5 for the CS parameter instead of SS, if you connect CS to 5.

It works perfectly, thank you. I was scared to death  :o

juanpabloaj

It works, if I change DC to pin 12. I don't know why pin 33 doesn't work, and I didn't check other combinations.

I hope this works for you also. Don't forget my Karma points if it does.
I tried with pin 12 without improve :/

Now I will be trying with other combinations.

Thanks a lot for your help.

JLC333

Hello,

I'm just using this library for BW 1.54 e-paper.

Examples work fine.

I met 2 problems, could you help me please ? I'm wondering a few questions I couldn't find answers.

Is it possible to use setRotation with writeImage ?
I can't do this : Image always displays as original coordinates.

Is it possible to do partial update for a writeImage too ?


Is writeImage function writing directly in E-Paper controller or in a local buffer (wich can be rotated before be sent to controller) ?

Thank you,
JL

ZinggJM

@JLC333,

Quote
Is it possible to use setRotation with writeImage ?
setRotation is a method of Adafruit_GFX, and rotation applies to buffered drawing, implemented in the drawPixel method. So it has no effect to writeImage, which writes directly to the controller buffer.

If you want to draw a bitmap using rotation, you need to use a drawBitmap method from Adafruit_GFX, e.g.

Code: [Select]
    drawBitmap(int16_t x, int16_t y, const uint8_t bitmap[],
      int16_t w, int16_t h, uint16_t color),
    drawBitmap(int16_t x, int16_t y, const uint8_t bitmap[],
      int16_t w, int16_t h, uint16_t color, uint16_t bg),
    drawBitmap(int16_t x, int16_t y, uint8_t *bitmap,
      int16_t w, int16_t h, uint16_t color),
    drawBitmap(int16_t x, int16_t y, uint8_t *bitmap,
      int16_t w, int16_t h, uint16_t color, uint16_t bg),


Quote
Is it possible to do partial update for a writeImage too ?
Yes.

Code: [Select]
    void refresh(bool partial_update_mode = false) // screen refresh from controller memory to full screen
    {
      epd2.refresh(partial_update_mode);
    }
    void refresh(int16_t x, int16_t y, int16_t w, int16_t h) // screen refresh from controller memory, partial screen
    {
      epd2.refresh(x, y, w, h);
    }


Quote
Is writeImage function writing directly in E-Paper controller or in a local buffer (wich can be rotated before be sent to controller) ?
Directly to the buffer in the controller.

You could also read the README.MD

Code: [Select]
### Paged Drawing, Picture Loop
 - This library uses paged drawing to limit RAM use and cope with missing single pixel update support
 - buffer size can be selected in the application by template parameter page_height, see GxEPD2_Example
 - Paged drawing is implemented as picture loop, like in U8G2 (Oliver Kraus)
 - see https://github.com/olikraus/u8glib/wiki/tpictureloop
 - Paged drawing is also available using drawPaged() and drawCallback(), like in GxEPD
- ` // GxEPD style paged drawing; drawCallback() is called as many times as needed `
- ` void drawPaged(void (*drawCallback)(const void*), const void* pv) `
- paged drawing is done using Adafruit_GFX methods inside picture loop or drawCallback

### Full Screen Buffer Support
 - full screen buffer is selected by setting template parameter page_height to display height
 - drawing to full screen buffer is done using Adafruit_GFX methods without picture loop or drawCallback
 - and then calling method display()

### Low Level Bitmap Drawing Support
 - bitmap drawing support to the controller memory and screen is available:
 - either through the template class instance methods that forward calls to the base display class
 - or directly using an instance of a base display class and calling its methods directly
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.

JLC333

Thanks a lot for all those informations.

I did read the README.MD but all those informations were confusing me (because I hadn't a global view of the classes, neither buffer management).

It seems a bit clearer now, correct me if I'm wrong : screen display data can be at 3 different places

In the program :
- locally in _buffer (AdaFruit functions as drawPixel, fillRectangle, drawLine, and so on)

In the screen :
- screen buffer (in the memory controller, not yet displayed) : data are sent from Arduino/ESP to memory controller thanks to writeImage function for example
- displayed on the screen (thanks to display method for example).


JL

JLC333

Hello,

I've met a new problem I couldn't resolve, may be anyone has already had it ?

I'm using 2 waveshare modules with an E-Paper 1.54 each (https://www.waveshare.com/1.54inch-e-Paper-Module.htm).

Everything worked fine till I changed of module : the same program made the image appear with an offset on the screen (about 40 pixels on X and Y). The top right image corner was not at the top right corner of the screen but close to 160,160 coordinates (instead of 199,199).

I switched off and on many times, it didn't work.
I used initial demo from GxEPD2, it didn't work.
I disconnected the wires between module and ESP32, it didn't work.

The only solution was to disconnect the screen from the waveshare module PCB and reconnect it again.


Has anybody met this problem ?
Is there a software solution to avoid this problem please ?

I'm using :
- Adafruit GFX Library 1.3.6
- GxEPD2 1.1.4

juanpabloaj

I may have misrepresented the busy status. Technically it's not stuck, the timeout occurs and the serial monitor reports the following, going on forever:

setup
setup done
Beginning Loop...
Busy Timeout!
Power On : 10000140
Busy Timeout!
drawPicture : 10000144
Busy Timeout!
Power On : 10000144
Busy Timeout!
drawCornerTest : 10000144
Busy Timeout!
Power On : 10000356
Busy Timeout!
drawPaged : 10000328
Beginning Loop...

I've had zero response from the screen no matter what I do. Open to any other suggestions.
@lcocking how did you solve that problem?

ZinggJM

@juanpabloaj,

Maybe you could post close-up photos of your e-paper display, from both sides.

We won't be able to see if it is dead, but I can compare to the ones I have.
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.

juanpabloaj

#1168
Feb 23, 2019, 03:58 pm Last Edit: Feb 23, 2019, 04:09 pm by juanpabloaj
@ZinggJM

thanks for your answer.

When I use the epaper with esp32 nodemcu, I don't have problems



I that test I used this code

Code: [Select]

#include<NTPClient.h>
#include<WiFi.h>
#include<WiFiUdp.h>

#include <GxEPD.h>
#include <GxGDEP015OC1/GxGDEP015OC1.cpp>    // 1.54" b/w
//#include <GxGDEH029A1/GxGDEH029A1.cpp>      // 2.9" b/w
#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>
#include <GxIO/GxIO.cpp>
#include <Fonts/FreeSansBold12pt7b.h>

const char *ssid = "ssid";
const char *password = "password";

WiFiUDP ntpUDP;

NTPClient timeClient(ntpUDP);

GxIO_Class io(SPI, SS, 22, 21);
GxEPD_Class display(io, 16, 4);

const char* name = "FreeSansBold12pt7b";
const GFXfont* f = &FreeSansBold12pt7b;

void setup() {
  Serial.begin(9600);
  Serial.println("Starting ...");

  display.init(9600);
  display.setRotation(1);
  display.fillScreen(GxEPD_BLACK);
  display.setFont(f);
  display.update();

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print("Connecting to wifi ...");
  }

  timeClient.begin();
}

void loop() {
  showDateTime();
  delay(10000);
}

void showDateTime() {
  timeClient.update();

  String dateString = timeClient.getFormattedTime();
  Serial.println(dateString);

  uint16_t box_x = 40;
  uint16_t box_y = 40;
  uint16_t box_w = 110;
  uint16_t box_h = 24;
  uint16_t cursor_y = box_y + 20;

  display.fillRect(box_x, box_y, box_w, box_h, GxEPD_BLACK);
  display.setTextColor(GxEPD_WHITE);
  display.setCursor(box_x+4, cursor_y);
  display.print(dateString);
  display.updateWindow(box_x, box_y, box_w, box_h, true);
}



with huzzah32 I don't get reactions from the epaper display ...
(I started to try with huzzah32 because it has battery connector)


BTW after January 22, 2019, huzzah32 Adafruit Feather has changed SS pin from 2 to 33. (this board hasn't a pin 2, so the previous configuration didn't make sense)


https://github.com/espressif/arduino-esp32/pull/2344/files


Like always, thanks a lot for your help :)

ZinggJM

#1169
Feb 23, 2019, 04:50 pm Last Edit: Feb 23, 2019, 05:25 pm by ZinggJM
Thank you for your answer; now I know that your e-paper display works.
I assume the code you posted is for the nodemcu; btw I don't know esp32 nodemcu, only esp8266 nodemcu, do you have a link? Aha, I see there is a board NodeMCU-32S, so maybe same code?

Please post the constructor values you used for HUZZAH32 for the failed test, and the connections used.

Then I can try once more with the Wemos D1 R32 or any other WROOM32 compiling for huzzah32.

In my test I couldn't use 33 for DC, so maybe it also doesn't work for CS.

The SPI class uses the value for SS for bookkeeping for bus reservation, but not for real CS use (unless automatic SS handling by HW is enabled), afaik.

The tagged release 1.0.1 does not contain the pull request you linked, so the version updated by Boards Manager still has SS 2.
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.

Go Up