[SOLVED] Waveshare eink 2in7 not displaying anything

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
djipey
Posts: 21
Joined: Sun Dec 01, 2019 3:04 pm

[SOLVED] Waveshare eink 2in7 not displaying anything

Post by djipey » Sat Jan 04, 2020 1:00 pm

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?

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Waveshare eink 2in7 not displaying anything

Post by Roberthh » Sat Jan 04, 2020 1:12 pm

In your script you use the same pin for miso and rst. That could be the reason.

djipey
Posts: 21
Joined: Sun Dec 01, 2019 3:04 pm

Re: Waveshare eink 2in7 not displaying anything

Post by djipey » Sat Jan 04, 2020 3:01 pm

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

djipey
Posts: 21
Joined: Sun Dec 01, 2019 3:04 pm

Re: Waveshare eink 2in7 not displaying anything

Post by djipey » Sat Jan 04, 2020 6:30 pm

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)


Post Reply