gregdmeyer / it8951 Goto Github PK
View Code? Open in Web Editor NEWDriver for the IT8951 e-paper controller on Raspberry Pi
License: MIT License
Driver for the IT8951 e-paper controller on Raspberry Pi
License: MIT License
Thank you for your work. I was really looking forward to using the new epaper display together with Python3.
I tried using it with an 7.8" display ( https://www.waveshare.com/wiki/7.8inch_e-Paper_HAT ), but when I run "python test.py" I only get:
Initializing EPD...
Speicherzugriffsfehler (*which is: Segmentation fault*)
P.S. I also installed your PaperTTY ( https://github.com/GregDMeyer/PaperTTY ). This seems to partially work: I do get my shell displayed correctly on epaper and get the following message on shell:
Initializing...
setting TTY size to 70 rows, 156 cols
Could not set TTY size (rows=70, cols=156); continuing.
Running...
When I CTRL+C, I do get the sleeping penguin. So at least something is working regarding the display...(hopefully this additional information helps). Please help me with this matter.
Thanks for sharing the amazing code.
I tried to control the display with this code, but I failed.
I don't know what the problem is, so I would like to seek your advice.
After downloading the repository, I ran three commands.
1) pip install -r requirements.txt
2) pip install ./
3) Python setup.py build_ext —inlace
It turned out that they were all installed successfully.
And then, when I run ‘test.py’,
The following screen is displayed.
Initializing EPD...
VCOM set to 0.0
System info:
display size: 0x0
img buffer address: 0
firmware version:
LUT version:Clearing display...
Traceback (most recent call last):
File "test.py", line 51, in
main()
File "test.py", line 45, in main
t(display)
File "/home/pi/Desktop/kr/IT8951-master/test/integration/test_functions.py", line 38, in clear_display
display.clear()
File "/home/pi/Desktop/kr/myvenv/lib/python3.7/site-packages/IT8951/display.py", line 112, in clear
self.draw_full(DisplayModes.INIT)
File "/home/pi/Desktop/kr/myvenv/lib/python3.7/site-packages/IT8951/display.py", line 54, in draw_full
self.update(self._get_frame_buf().tobytes(), (0,0), (self.width, self.height), mode)
File "/home/pi/Desktop/kr/myvenv/lib/python3.7/site-packages/PIL/Image.py", line 733, in tobytes
e.setimage(self.im)
SystemError: tile cannot extend outside image
As you can see, it doesn’t get the width and height of the display, img_buf_address, firmware_version and lut_version information.
It seems that the above error caused PIL error too (tile cannot extend outside image).
When I ran the c code which was provided by waveshare,
(https://www.waveshare.com/wiki/6inch_HD_e-Paper_HAT)
The display worked well. So I don't think it's not a hardware issue.
The display I got has the Vcom value ‘-2.09’,
I changed all the Vcom value in the display.py / interface.py / test.py / test_xfer.py / time_full.py / time_partial.py
If this is a problem, please let me know what parts should be changed the Vcom value.
I am a beginner with Raspberry Pi, Python, and E-ink Paper.
I would appreciate any advice on what the problem is and how to solve it.
In load_img_area
, the pixel format is currently hardcoded to 4 bits per pixel. It would be nice to make this a function argument so you can actually use a different format, which seems to be otherwise supported.
Currently we need to install tkinter
but this package is only required to run the tests I believe. This package is also not in requirements.txt.
Would it be possible to move the dependency on tkinter
outside of the display driver? Then we could use this package without having to install tkinter
and its X11 dependencies. It would be leaner 🙂
When I try to run the example (virtual display works fine) I get the following error
Initializing EPD...
Traceback (most recent call last):
File "test/integration/test.py", line 56, in <module>
main()
File "test/integration/test.py", line 32, in main
display = AutoEPDDisplay(vcom=-2.06, rotate=args.rotate, spi_hz=24000000)
File "/usr/local/lib/python3.7/dist-packages/IT8951-0.1.0-py3.7-linux-armv7l.egg/IT8951/display.py", line 219, in __init__
epd = EPD(vcom=vcom, bus=bus, device=device, data_hz=spi_hz)
File "/usr/local/lib/python3.7/dist-packages/IT8951-0.1.0-py3.7-linux-armv7l.egg/IT8951/interface.py", line 26, in __init__
self.spi = SPI(**spi_kwargs)
File "IT8951/spi.pyx", line 51, in IT8951.spi.SPI.__cinit__
self.fd = os.open(fd_path, os.O_RDWR)
FileNotFoundError: [Errno 2] No such file or directory: '/dev/spidev0.0'
Hello,
when trying your package under the newest Raspberry OS (based on Debian "bookworm") the installed Python 3.11 gives me the following error:
sudo pip install IT8951
Looking in indexes: https://<internal-proxy-server>
Collecting IT8951
Using cached https://<internal-proxy-server>/IT8951/0.1.0/IT8951-0.1.0.tar.gz (243 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: IT8951
Building wheel for IT8951 (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [20 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-aarch64-cpython-311
creating build/lib.linux-aarch64-cpython-311/IT8951
copying IT8951/interface.py -> build/lib.linux-aarch64-cpython-311/IT8951
copying IT8951/constants.py -> build/lib.linux-aarch64-cpython-311/IT8951
copying IT8951/display.py -> build/lib.linux-aarch64-cpython-311/IT8951
copying IT8951/__init__.py -> build/lib.linux-aarch64-cpython-311/IT8951
running build_ext
building 'IT8951.spi' extension
creating build/temp.linux-aarch64-cpython-311
creating build/temp.linux-aarch64-cpython-311/IT8951
aarch64-linux-gnu-gcc -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/usr/include/python3.11 -c IT8951/spi.c -o build/temp.linux-aarch64-cpython-311/IT8951/spi.o
IT8951/spi.c:209:12: fatal error: longintrepr.h: No such file or directory
209 | #include "longintrepr.h"
| ^~~~~~~~~~~~~~~
compilation terminated.
error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for IT8951
Running setup.py clean for IT8951
Failed to build IT8951
Installing collected packages: IT8951
Running setup.py install for IT8951 ... error
error: subprocess-exited-with-error
× Running setup.py install for IT8951 did not run successfully.
│ exit code: 1
╰─> [22 lines of output]
running install
/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build/lib.linux-aarch64-cpython-311
creating build/lib.linux-aarch64-cpython-311/IT8951
copying IT8951/interface.py -> build/lib.linux-aarch64-cpython-311/IT8951
copying IT8951/constants.py -> build/lib.linux-aarch64-cpython-311/IT8951
copying IT8951/display.py -> build/lib.linux-aarch64-cpython-311/IT8951
copying IT8951/__init__.py -> build/lib.linux-aarch64-cpython-311/IT8951
running build_ext
building 'IT8951.spi' extension
creating build/temp.linux-aarch64-cpython-311
creating build/temp.linux-aarch64-cpython-311/IT8951
aarch64-linux-gnu-gcc -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/usr/include/python3.11 -c IT8951/spi.c -o build/temp.linux-aarch64-cpython-311/IT8951/spi.o
IT8951/spi.c:209:12: fatal error: longintrepr.h: No such file or directory
209 | #include "longintrepr.h"
| ^~~~~~~~~~~~~~~
compilation terminated.
error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> IT8951
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
I had to buy a loose driver board from WaveShare because I toasted the one supplied with a 9.7" panel. The board they sent works fine, but I think it's set for 1600x1200 rather than the 1200x825 resolution of the 9.7" panel.
Up until I killed my stock driver board, I used the following code and it worked properly:
from IT8951.display import AutoEPDDisplay
from IT8951 import constants as constants_HD
myepd = AutoEPDDisplay(vcom=self.vcom)
Unfortunately, allowing AutoEPDDisplay to pull the width and height from the driver board results in AutoEPPDisplay pulling the resolution from the board and setting it to 1600x1200. All the images are clearly not formatted correctly; "partial...update" test falls mostly off the screen and the image of Tux is only about 1/4 on the display. Formerly this worked just fine.
$ python3 ./test.py
Initializing EPD...
VCOM set to -1.9
System info:
display size: 1600x1200
img buffer address: 119F00
firmware version: WS_v.0.1
LUT version: 6M14T
I can see that the
__init__
in AutoEPDDisplay()
class sets the property epd=EPD()
and AutoDisplay()
gets passed the epd.width, epd.height
values. What I can't figure out how to do is properly pass in the width and height arguments so that EPD()
gets them.
I tried to set the width and height manually, but I'm clearly not doing things correctly as the resolution reports that it is correct, but the images are still not scaled correctly:
display = AutoEPDDisplay(vcom=-1.90, rotate=args.rotate, spi_hz=24000000)
display.epd.width=1200
display.epd.height=825
$ python3 ./test.py
Initializing EPD...
VCOM set to -1.9
System info:
display size: 1200x825
img buffer address: 119F00
firmware version: WS_v.0.1
LUT version: 6M14T
Is there a way to do this?
Alternatively, do you have any idea how to bang the resolution into the board firmware?
display.py imports tkinter:
import tkinter as tk
It should be added to requirements.txt
FileNotFoundError : Error 2 No such file or directory: '/dev/spidev0.0 '
It looks like this required file is no longer available from the updsted Kernels anymore.
Any idea ho to solve this?
PS: I am the newest newbie amongst the newbie. Just hope my question makes some sense.
What is the proper procedure for releasing the SPI/GPIO file handles when shutting down the display?
As far as I can tell, when the process exits, the OS typically releases the handles and everything is well. In some instances I would like to shut off the display and release the resources so I can reactivate it later. If I simply init it again using AutoEPDDisplay()
, a new set of handles gets created.
With the non IT8951 epd boards and the WaveShare sample drivers, I ran into this issue because I was naively re-initing the board over and over again whenever I wanted to wake it from sleep. Somewhere along the line my init/sleep got out of sync causing the process to run out of file handles and crash on long-running programs.
I've done some digging and found this in the spi.pyx __del__
method epd.epd.spi.__del__()
. Calling the __del__
method does the job and closes the handles, but I was taught that it's bad form to use private methods.
Is there a better way to tidy up?
When trying to use this library on a raspberry pi 4, I get the following error:
bcm2835_init: gpio mmap failed: Cannot allocate memory
Segmentation fault
This is with version 1.65 of the bcm2835 library (which includes fixes to support the raspberry pi 4), and running as root.
Also, the bcm2835 test program included in that library runs correctly.
Could it somehow be due to the way bcm2835 is used?
I am trying to use partial update in DU mode to speed up interactions with my screen. My screen is also flipped, such that I initialize with rotate='flip'
. I am finding that my screen updates improperly in this mode. In fact, I get the same behavior for any of the low-bpp modes.
To be clear, if I do full updates, it works. If I use non-low-bpp update modes, it works. If I don't set rotate='flip'
it works.
What I am finding is that sometimes the screen updates, sometimes it doesn't. It seems to fail in particular if the updates extend all the way to what would be the top-left corner of the screen, what should be (0,0). Maybe the box_rounding function doesn't work when flipped?
I don't have great repro steps for this at the moment, unfortunately, but I will update if I can generate some.
Would it be possible to add the dependency requirements in either the setup.py
file so they can be pulled in when the library is built? This would help being able to include this library automatically as part of other projects without having to a) include this project reqs in the larger project or b) explaining they need to be installed separately.
I understand there is a difference in install on RPI vs other systems for the purposes of testing. Would using platform filtering in this case solve that issue so it's still cross-platform? I can write up an actual PR but excluding the x86_64
platform would filter out the Linux desktop systems but do the install on Arm architecture.
setup(
....
install_requires = [
'pillow',
'RPI-GPIO; platform_machine != "x86_64"'
]
)
I have an application where I run a Raspberry Pi Zero with driver HAT for the 10.3" e-paper from Waveshare. The whole thing is powered by a battery. Naturally I want the battery to last as long as possible, so I thought it would be a good idea to use the sleep/run functions.
However, after a while (can be minutes or hours) the program freezes and I realize it's stuck in the wait_ready() function in spi.pyx waiting for a response from the driver. I tried running the program not using the sleep/run functions at all, but that also leads to a freeze eventually.
As a work-around I added a timeout in the while loop in wait_ready(), so I have the possibility to detect the freeze and restart the program. It doesn't solve the actual problem, though.
I would appreciate your thoughts on this! Thanks!
I am trying for an hour now. How can I use the display vertically. I can flip it, but how to use it vertically?
I use PIL to draw an vertical image (1404x1872 instead of 1872x1404) and would like to push it to the display...
Writing an image to the screen using the function display_image_8bpp from the test_functions, the image is left/right transposed. Rotation and flipping just re-orient the mirror image.
Raspberry Pi 4B 2gb ram, Fresh OS install:
Initializing EPD...
VCOM set to -2.06
System info:
display size: 1872x1404
img buffer address: 122520
firmware version: WS_v.0.2
LUT version: 8M14T_AF8221
Clearing display...
Displaying gradient...
Starting partial update...
writing full...
writing partial...
Displaying "images/sleeping_penguin.png"...
Traceback (most recent call last):
File "/home/pi/IT8951/test/integration/test.py", line 56, in
main()
File "/home/pi/IT8951/test/integration/test.py", line 50, in main
t(display)
File "/home/pi/IT8951/test/integration/test_functions.py", line 74, in display_image_8bpp
img = Image.open(img_path)
File "/home/pi/.local/lib/python3.9/site-packages/PIL/Image.py", line 2912, in open
fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'images/sleeping_penguin.png'
Any ideas here? The waveshare IT8951 drivers work fine. I'm just trying to get this display working with slowmovie
I tried doing the pip install ./
on a fresh raspberry pi OS install and noticed that this is throwing errors. I believe it's due to the API changes in python 3.11, the generated c code is accessing members no longer available https://docs.python.org/3/whatsnew/3.11.html#pyframeobject-3-11-hiding.
Installing collected packages: IT8951
Running setup.py install for IT8951 ... error
error: subprocess-exited-with-error
× Running setup.py install for IT8951 did not run successfully.
│ exit code: 1
╰─> [54 lines of output]
running install
/home/wujiaqi/git/webepd/eink2/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build/lib.linux-aarch64-cpython-311
creating build/lib.linux-aarch64-cpython-311/IT8951
copying IT8951/interface.py -> build/lib.linux-aarch64-cpython-311/IT8951
copying IT8951/constants.py -> build/lib.linux-aarch64-cpython-311/IT8951
copying IT8951/display.py -> build/lib.linux-aarch64-cpython-311/IT8951
copying IT8951/__init__.py -> build/lib.linux-aarch64-cpython-311/IT8951
running build_ext
building 'IT8951.spi' extension
creating build/temp.linux-aarch64-cpython-311
creating build/temp.linux-aarch64-cpython-311/IT8951
aarch64-linux-gnu-gcc -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=format-security -mbranch-protection=standard -g -fwrapv -O2 -fPIC -I/home/wujiaqi/git/webepd/eink2/include -I/usr/include/python3.11 -c IT8951/spi.c -o build/temp.linux-aarch64-cpython-311/IT8951/spi.o
IT8951/spi.c: In function ‘__Pyx_TraceSetupAndCall’:
IT8951/spi.c:22082:37: error: invalid use of incomplete typedef ‘PyFrameObject’ {aka ‘struct _frame’}
22082 | if (CYTHON_TRACE && (*frame)->f_trace == NULL) {
| ^~
IT8951/spi.c:22084:21: error: invalid use of incomplete typedef ‘PyFrameObject’ {aka ‘struct _frame’}
22084 | (*frame)->f_trace = Py_None;
| ^~
IT8951/spi.c:438:62: error: invalid use of incomplete typedef ‘PyFrameObject’ {aka ‘struct _frame’}
438 | #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
| ^~
IT8951/spi.c:22091:5: note: in expansion of macro ‘__Pyx_PyFrame_SetLineNumber’
22091 | __Pyx_PyFrame_SetLineNumber(*frame, firstlineno);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
IT8951/spi.c: In function ‘__Pyx_PyBytes_Equals’:
IT8951/spi.c:23312:13: warning: ‘ob_shash’ is deprecated [-Wdeprecated-declarations]
23312 | hash1 = ((PyBytesObject*)s1)->ob_shash;
| ^~~~~
In file included from /usr/include/python3.11/bytesobject.h:62,
from /usr/include/python3.11/Python.h:50,
from IT8951/spi.c:6:
/usr/include/python3.11/cpython/bytesobject.h:7:35: note: declared here
7 | Py_DEPRECATED(3.11) Py_hash_t ob_shash;
| ^~~~~~~~
IT8951/spi.c:23313:13: warning: ‘ob_shash’ is deprecated [-Wdeprecated-declarations]
23313 | hash2 = ((PyBytesObject*)s2)->ob_shash;
| ^~~~~
/usr/include/python3.11/cpython/bytesobject.h:7:35: note: declared here
7 | Py_DEPRECATED(3.11) Py_hash_t ob_shash;
| ^~~~~~~~
IT8951/spi.c: In function ‘__Pyx_AddTraceback’:
IT8951/spi.c:438:62: error: invalid use of incomplete typedef ‘PyFrameObject’ {aka ‘struct _frame’}
438 | #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
| ^~
IT8951/spi.c:24384:5: note: in expansion of macro ‘__Pyx_PyFrame_SetLineNumber’
24384 | __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> IT8951
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Update:
When I run this with USE_CYTHON='USE_CYTHON' pip install ./
to recompile the c code it installs fine
I would like to try and use this library with the 9.7" panel, but the tests keep erroring out with RuntimeError: communication with device failed
.
I have a pipenv virtual environment with the proper requirements installed.
ipykernel==5.5.5
<<snip ipykernel related packages>>
IT8951==0.1.0
Pillow==8.2.0
RPi.GPIO==0.7.0
The test code provided by waveshare appears to work as expected; it displays a graduated gray field, a line drawing and then an image. The output of the waveshare IT8951 executable outputs the following while displaying images:
$ sudo ./IT8951 0 0 17.bmp
****** IT8951 ******
Panel(W,H) = (1200,825)
Image Buffer Address = 11A1E0
FW Version = SWv_0.2.1T
LUT Version = M841
VCOM = -1.50V
IT8951_GUI_Example
*****************************************
BMP_cfSize:55864
BMP_cfoffBits:62
BMP_ciSize:40
BMP_ciWidth:800
BMP_ciHeight:558
BMP_ciPlanes:1
BMP_ciBitCount:1
BMP_ciCompress:0
BMP_ciSizeImage:d9fa
BMP_ciXPelsPerMeter:2e25
BMP_ciYPelsPerMeter:2e25
BMP_ciClrUsed:0
BMP_ciClrImportant:0
*****************************************
total_length:55802,55802
bytesPerLine = 100
imageSize = 55800
skip = 0
I've adjusted the test.py as suggested and changed the VCOM value to -1.50
.
When I run the test.py
in the pipenv virtual environment, I get the following output:
$ python3 test.py
Initializing EPD...
Traceback (most recent call last):
File "test.py", line 56, in <module>
main()
File "test.py", line 32, in main
display = AutoEPDDisplay(vcom=-1.50, rotate=args.rotate, spi_hz=24000000)
File "/home/pi/.local/share/virtualenvs/IT8951-cl9zA0KD/lib/python3.7/site-packages/IT8951/display.py", line 219, in __init__
epd = EPD(vcom=vcom, bus=bus, device=device, data_hz=spi_hz)
File "/home/pi/.local/share/virtualenvs/IT8951-cl9zA0KD/lib/python3.7/site-packages/IT8951/interface.py", line 33, in __init__
self.update_system_info()
File "/home/pi/.local/share/virtualenvs/IT8951-cl9zA0KD/lib/python3.7/site-packages/IT8951/interface.py", line 103, in update_system_info
raise RuntimeError("communication with device failed")
RuntimeError: communication with device failed
It appears that no SPI data is being returned when the board is queried. With constants.Commands GET_DEV_INFO
.
A check of the constants.Commands
against the WaveShare IT8951.h
shows a slight difference in the addresses used when calling various commands. I've tried updating constants.Commands
to match the WaveShare Values, but that does not remedy the problem.
The WaveShare IT8951.h
version is below:
//Built in I80 Command Code
#define IT8951_TCON_SYS_RUN 0x0001
#define IT8951_TCON_STANDBY 0x0002
#define IT8951_TCON_SLEEP 0x0003
#define IT8951_TCON_REG_RD 0x0010
#define IT8951_TCON_REG_WR 0x0011
#define IT8951_TCON_MEM_BST_RD_T 0x0012
#define IT8951_TCON_MEM_BST_RD_S 0x0013
#define IT8951_TCON_MEM_BST_WR 0x0014
#define IT8951_TCON_MEM_BST_END 0x0015
#define IT8951_TCON_LD_IMG 0x0020
#define IT8951_TCON_LD_IMG_AREA 0x0021
#define IT8951_TCON_LD_IMG_END 0x0022
//I80 User defined command code
#define USDEF_I80_CMD_DPY_AREA 0x0034
#define USDEF_I80_CMD_GET_DEV_INFO 0x0302
#define USDEF_I80_CMD_DPY_BUF_AREA 0x0037
#define USDEF_I80_CMD_VCOM 0x0039
Beyond this, I'm getting out of my depth and blindly stumbling around. Do you have any suggestions as to how to diagnose and remedy this problem?
Hi @GregDMeyer, firstly thanks for this great codebase!
I'm having an issue with the 7.8in screen that uses the IT8951, connected to a rasbpi zero W. When running tests/integration/test.py
, the initialization of the EPD display hangs foverever. When I CTRL+C out of it, this is the traceback I get:
Traceback (most recent call last):
File "test/integration/test.py", line 56, in <module>
main()
File "test/integration/test.py", line 32, in main
display = AutoEPDDisplay(vcom=-1.38, rotate=args.rotate, spi_hz=100000)
File "/home/pi/.local/lib/python3.7/site-packages/IT8951/display.py", line 219, in __init__
epd = EPD(vcom=vcom, bus=bus, device=device, data_hz=spi_hz)
File "/home/pi/.local/lib/python3.7/site-packages/IT8951/interface.py", line 33, in __init__
self.update_system_info()
File "/home/pi/.local/lib/python3.7/site-packages/IT8951/interface.py", line 99, in update_system_info
self.spi.write_cmd(Commands.GET_DEV_INFO)
File "IT8951/spi.pyx", line 224, in IT8951.spi.SPI.write_cmd
self.write(0x6000, [cmd]) # 0x6000 is preamble
File "IT8951/spi.pyx", line 171, in IT8951.spi.SPI.write
self.transfer(buflen, speed=self.cmd_hz)
File "IT8951/spi.pyx", line 111, in IT8951.spi.SPI.transfer
self.wait_ready()
File "IT8951/spi.pyx", line 103, in IT8951.spi.SPI.wait_ready
sleep(0.001)
I read some of your other posts about changing spi_hz
to account for the slower rasbpi zero clock speed, but this hasn't helped. I get the feeling this might be a hardware issue? Not really sure what else to try, none of the other waveshare provided code for IT8951 has worked either. Any thoughts you have would be great 🙏
Thank you Greg, this software is wonderful. I tested the current update on my "Raspberry Pi 3 Model A+" with a "Waveshare 9.7inch e-Paper HAT" and it works like a charm. The data transfer is so much faster now.
I build a sun clock that displays the current position and trajectory of the sun on moon and gifted it a new large display. Love the large ePaper stuff. So fun to use.
Sorry up front for beginner questions, I am trying to use the driver with a 7.8in EPD for a Very Slow Movie Player. RaspPi 4 2GB. I believe I have the driver built andinstalled correctly (I can run the test script ok) and I have added it to the correct import in the SlowMovie script. It runs until the first command init.Clear then fails saying command not found. If I comment the init command out, it just fails at the next one. Is there something I am missing or haven't installed correctly? Thanks in advance and apologies if this is the wrong place for such a question.
I'm using the 7.5inch display, https://www.waveshare.com/wiki/7.5inch_HD_e-Paper_HAT. I've browsed through similar issues (e.g. #18) and tried the following:
However I'm still getting "communication with device failed" when running
python3.8 test.py
in IT8951/test/integration
For what it's worth, the C WaveShare code from https://www.waveshare.com/wiki/7.5inch_HD_e-Paper_HAT works fine.
Is there something I might be missing here? I've also read that using the Waveshare code might leave the display in a weird state - is there any way I can completely reset the display? Not sure why rebooting does not work here.
Appreciate any pointers :) thank you!
How to reproduce: Remove IT8951 driver board from Pi, call: myepd = AutoEPDDisplay(vcom=-1.93)
The AutoEPDDdisplay
object will wait apparently forever for the spi read/write to complete.
IT8951/interface.py in update_system_info(self)
97 Get information about the system, and store it in class attributes
98 '''
---> 99 self.spi.write_cmd(Commands.GET_DEV_INFO)
100 data = self.spi.read_data(20)
101
Hi, I am running into this issue when updating the screen:
Traceback (most recent call last):
File "/home/pi/show.py", line 41, in <module>
update(sys.argv[1])
File "/home/pi/show.py", line 11, in update
display = AutoEPDDisplay(vcom=-1.46, spi_hz=1000000)
File "/usr/local/lib/python3.9/dist-packages/IT8951/display.py", line 224, in __init__
epd = EPD(vcom=vcom, bus=bus, device=device, data_hz=spi_hz)
File "/usr/local/lib/python3.9/dist-packages/IT8951/interface.py", line 33, in __init__
self.update_system_info()
File "/usr/local/lib/python3.9/dist-packages/IT8951/interface.py", line 99, in update_system_info
self.spi.write_cmd(Commands.GET_DEV_INFO)
File "spi.pyx", line 230, in IT8951.spi.SPI.write_cmd
File "spi.pyx", line 177, in IT8951.spi.SPI.write
File "spi.pyx", line 117, in IT8951.spi.SPI.transfer
File "spi.pyx", line 108, in IT8951.spi.SPI.wait_ready
TimeoutError: Timed out waiting for display to respond
My setup is a Raspi Zero W with the Waveshare HAT and the 7.8" (1842x1404) screen.
My goal is to have a task repeatedly updating the screen with an image retrieved from a server. After a couple of minutes/updates the sccreen gets stuck and I cannot update it anymore. Reboot of the raspi does not help, SPI kernel module reloading does not help. The only thing getting the screen unstuck is depowering, waiting for everything to empty and repower again. Unfortunately, having to unplug is a deal-breaker for me so I am looking for a solution to get the driver unstuck or prevent the issue beforehand.
What I tried already:
Unfortunately none of these helped solve my issue and I am still getting stuck after a coupld of updates. Any help appreaciated. Thanks.
Using the virtual display shows text correctly, but when using the test.py program, any text displayed on the eink display is backwards. Images seem fine.
Any idea why text would be backwards on the 10.3 display?
Do you have guidance on how to play gifs?
Hi,
I already asked here. But I think here is the better place. Some Chinese manufacturers offering a nice 13.3" panel with an controller. They often use an IT8951 controller.
So are all controller supported besides the wavsehare ones?
Those boards also supports usb does your driver work via usb as well?
there are two different wait methods, one which checks the value of a register and one which checks the ready pin. figure out which one of these is appropriate to use.
Hi Greg,
by using the SPI.del method I faced some weird side-effect. My GPIO Config got "lost".
This is due to "spi.pyx" line "GPIO.cleanup().
It does exactly what it should do - it cleans up ALL gpio configs.
def __del__(self): GPIO.cleanup() if self.fd != -1: os.close(self.fd)
Could you remove this line and directly close "self.fd" as done after checking. I see no other reason to use the cleanup here.
Best regards,
KHome
It would be nice to show how this driver can be used 🙂
Contrast is drifting to darker image, after few full refreshes (doesnt matter if i use draw partial or draw full) contrast drifts to dark.
After while the whole display itself seems to crash. i have to reset the board otherwise the panel itself will be destroyed!
I cannot reproduce that behavior with the test program from ITE (E-LINK-TCON-DEMO) but with your implementation it does occur after several "Full"-Updates. First sign is, display gets darker. Small partial Updates are not affected.
See attached image. Clocktime is upated partial since background is updated full.
Even Display Mode INIT leaves a grayish Screen. I have to reset whole IT8951 Driver Hat.
I have rewritten that Code (not fully complete) into C# - Same issue
After every "full" or big partial Update, display gets darker and darker. Small Parial Updates such as Time OSD are stay correct:
kind regards
Greetings Greg, and thank you for putting this necessary project together.
When I do pip install requirements.txt
I get the following error:
Could not find a version that satisfies the requirement requirements.txt (from versions: )
No matching distribution found for requirements.txt
I'm doing this on Raspbian.
Hi, thank you very much for supporting with this nice python-lib.
In my setup I use https://www.smarthomeng.de/ to call a logic, which includes an update of the epaper.
I've missing a "close()" function for the display, which results in several opened SPIDEV ports. After a while my python instance can not open any file anymore. OS ERR24
I've helped myself by calling: "display.epd.spi.del()"
Could you add this kind a destructor?
Since waveshares IT8951 driver doesn't support partial refresh I was hoping this implementation might be able to do partial refreshes of images. Unfortunately I couldn't find any example code in the tests though.
Is it possible to partially refresh images?
there is an error when trying to build with Python 3.10 - undefined symbol: _PyGen_Send
Hi! This project currently focuses on the Raspberry Pi in a few places. I was wondering, if this could also be changed to be more generic; with the ultimate goal being a Micropython implementation for the IT8951.
I'm currently trying to find out if micropython might be a good fit for the m5paper which is an ESP32 + IT8951 in a pretty neat package.
Hi!
I have the 7.8inch e-Paper HAT.
The display is connected to a Raspberry Pi 3B+ with freshly installed RaspbianOS.
The demo from the Waveshare homepage works and runs through without any problems.
Unfortunately nothing works with the Python script here :(
I installed everything according to instructions and apparently it worked without errors.
If I run the test scripts, unfortunately nothing works.
/home/pi/IT8951/test/unit# python3.9 test_img_manip.py
/home/pi/IT8951/test/unit# option parsing failed: Cannot open display:
[Here he is now stuck]
/home/pi/IT8951/test/integration# python3.9 test.py
Initializing EPD...
Traceback (most recent call last):
File "/home/pi/IT8951/test/integration/test.py", line 58, in <module>
main()
File "/home/pi/IT8951/test/integration/test.py", line 34, in main
display = AutoEPDDisplay(vcom=-2.15, rotate=args.rotate, mirror=args.mirror, spi_hz=24000000)
File "/usr/local/lib/python3.9/dist-packages/IT8951/display.py", line 224, in __init__
epd = EPD(vcom=vcom, bus=bus, device=device, data_hz=spi_hz)
File "/usr/local/lib/python3.9/dist-packages/IT8951/interface.py", line 33, in __init__
self.update_system_info()
File "/usr/local/lib/python3.9/dist-packages/IT8951/interface.py", line 103, in update_system_info
raise RuntimeError("communication with device failed")
RuntimeError: communication with device failed
I hope someone here has a solution to the problem.
Demo output:
/home/pi/Downloads/IT8951-ePaper/Raspberry# sudo ./epd -1.53 0
/***********************************/
bcm2835 init success !!!
/***********************************/
VCOM value:1530
Display mode:0
Panel(W,H) = (1872,1404)
Memory Address = 124850
FW Version = .v.0
LUT Version = M841
VCOM = -1.53V
A2 Mode:6
I'm encountering an error when running the build command:
python setup.py build_ext --inplace
IT8951/spi.c:21854:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘use_tracing’; did you mean ‘tracing’?
21854 | return tstate->use_tracing && retval;
Full output here:
error.txt
Is this an error with something I'm doing, is there a workaround, or fix for this?
I was attempting to get this installed and running on Ubuntu (22.04 LTS) in order to test with a virtual display.
I have Python 3.10.4 installed and Cython version 0.29.28
Hello everyone,
I have a 7.8inch waveshare screen with an IT8951 driver. When I try to run the test.py script I have this message displayed :
Initializing EPD... Traceback (most recent call last): File "/home/julien/Documents/IT8951/test/integration/test.py", line 58, in <module> main() File "/home/julien/Documents/IT8951/test/integration/test.py", line 36, in main print('VCOM set to', display.epd.get_vcom()) File "/usr/local/lib/python3.9/dist-packages/IT8951-0.1.1-py3.9-linux-armv7l.egg/IT8951/interface.py", line 115, in get_vcom self.spi.write_cmd(Commands.VCOM, 0) File "spi.pyx", line 230, in IT8951.spi.SPI.write_cmd File "spi.pyx", line 177, in IT8951.spi.SPI.write File "spi.pyx", line 117, in IT8951.spi.SPI.transfer File "spi.pyx", line 108, in IT8951.spi.SPI.wait_ready TimeoutError: Timed out waiting for display to respond
I can noticed small changes on the screen but nothing recognizable.
I tried before to use it on Windows and with the waveshare code for Raspbery pi but nothing happened so it's probably an hardware issue.
But we never know if anyone has experienced a similar case.
Hello everyone!
First of all thanks GregDMeyer for this project.
I recently received a Waveshare 7.8 HD with a resolution of 1872x1404 and managed to get it working with waveshare's sample code and this library likewise.
But one weird problem is consistent among both approaches: I have perfectly regular black stripes on my display. Since they are consistent regardless which library I use I assume it is not a software related bug. Nevertheless I am asking here because I do not know of a better place. There seem to be a lot of epaper experts around.
Here is what I found so far:
Has anybody experienced something similar or has an explanation for this? Any help is appreciated. Thanks.
If it turns out to be faulty hardware I will try to get it replaced. :/
Thank you very much for writing this module! I've been failing to do this for a couple of months and was delighted to find it.
I'm planning a project where a single RPi would drive multiple Waveshare screens (10+), and to avoid running out of GPIO pins I'm planning to:
In any case, I'll need to customize the methods that drive those pins.
My utopian vision would be:
I'll be happy to put up a PR, but I wanted to know your opinion on moving those GPIO operations to separate methods.
You can see my current (yet untested!) attempts in https://github.com/BackSlasher/IT8951-1/tree/inheritable-gpio
Thank you for your time!
In interface.py
, wait_display_ready
includes a sleep
command, but the imports for interface.py
are missing a from time import sleep
.
Thanks putting together this module!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.