Page 1 of 1

[SOLVED] Waveshare eink 2in7 not displaying anything

Posted: Sat Jan 04, 2020 1:00 pm
by djipey
Hi,

I have a waveshare eink screen 2.7 inches (black and white, no red). I'm trying to make it work with micropython and my ESP32 board. I tested the screen first with an arduino uno board and the code provided here: https://www.waveshare.com/wiki/2.7inch_ ... rduino_UNO and the screen works. So my problem doesn't come from the screen.

I followed the example here: https://github.com/mcauser/micropython- ... ld/test.py, but adapted to my 2.7in screen. I uploaded the proper driver to the board. Here is my main.py:

Code: Select all

from machine import Pin, SPI
import time
import epaper2in7
import framebuf


# SPIV on ESP32
sck = Pin(18)
miso = Pin(19)
mosi = Pin(23)

dc = Pin(32)
cs = Pin(33)
rst = Pin(19)
busy = Pin(35)
spi = SPI(2, baudrate=20000000, polarity=0, phase=0, sck=sck, miso=miso, mosi=mosi)

print("We're in main")

w = 176
h = 264
x = 0
y = 0

e = epaper2in7.EPD(spi, cs, dc, rst, busy)
e.init()

print("Screen ready")


buf = bytearray(w * h // 8)
fb = framebuf.FrameBuffer(buf, w, h, framebuf.MONO_HLSB)
black = 0
white = 1
fb.fill(black)

fb.fill(white)
fb.text("Hello World", 30, 0, black)

e.display_frame(buf)

from image_light import hello_world_light
# print('Image dark')


bufImage = hello_world_light
fbImage = framebuf.FrameBuffer(bufImage, 128, 296, framebuf.MONO_HLSB)
fb.blit(fbImage, 168, 2)
e.display_frame(buf)

print("Image printed")


time.sleep(3)

The pinout of my board:

Image

The wiring of my screen
Image

At the moment, the screen doesn't display anything with micropython. It just seems to not receive any command. main.py executes without crashing though.

Could you please give me a hand?

I'm not sure about the wiring of the mosi, miso and csk pins. To which wires from the screen should they be connected?
How can I debug the problem?

Re: Waveshare eink 2in7 not displaying anything

Posted: Sat Jan 04, 2020 1:12 pm
by Roberthh
In your script you use the same pin for miso and rst. That could be the reason.

Re: Waveshare eink 2in7 not displaying anything

Posted: Sat Jan 04, 2020 3:01 pm
by djipey
I don't think the miso pin is important, since the screen isn't supposed to send any data.

But I also tried this wiring/code:

Code: Select all

sck = Pin(18)
miso = Pin(19)
mosi = Pin(23)
dc = Pin(22)
cs = Pin(5)
rst = Pin(21)
busy = Pin(4)
spi = SPI(2, baudrate=80000000, polarity=0, phase=0, firstbit=0, bits=8, sck=sck, miso=miso, mosi=mosi)

Without much luck either

Re: Waveshare eink 2in7 not displaying anything

Posted: Sat Jan 04, 2020 6:30 pm
by djipey
It turned out it was just the baudrate, mine was too high.

It works with:

Code: Select all

# SPIV on ESP32
sck = Pin(18)
miso = Pin(19)
mosi = Pin(23)
dc = Pin(22)
cs = Pin(5)
rst = Pin(21)
busy = Pin(4)
spi = SPI(2, baudrate=100000, polarity=0, phase=0, sck=sck, mosi=mosi, miso=miso)