joukos / PaperTTY

PaperTTY - Python module to render a TTY or VNC on e-ink
942 stars 101 forks source link

IT8951 9.7" Memory Error -- could be due to firmware #82

Closed txoof closed 2 years ago

txoof commented 2 years ago

I've got a tough one. I can successfully use papertty with a epd5in83 display, but when I try to use it with an IT8951 and a 9.7" display, I get the following errors:

$ sudo papertty --driver it8951 terminal
Loading PIL font /usr/local/lib/python3.7/dist-packages/papertty/resources/tom-thumb.pil. Font size is ignored.
width = 65535
height = 65535
img_addr = ffffffff
firmware = ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
lut = ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
VCOM = -65.53V
Traceback (most recent call last):
  File "/usr/local/bin/papertty", line 10, in <module>
    sys.exit(papertty.cli())
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/papertty/papertty.py", line 628, in terminal
    ptty = settings.get_init_tty()
  File "/usr/local/lib/python3.7/dist-packages/papertty/papertty.py", line 399, in get_init_tty
    tty.init_display()
  File "/usr/local/lib/python3.7/dist-packages/papertty/papertty.py", line 251, in init_display
    self.driver.init(partial=self.partial)
  File "/usr/local/lib/python3.7/dist-packages/papertty/drivers/driver_it8951.py", line 237, in init
    image = Image.new("L", (self.width, self.height), 0x255)
  File "/usr/local/lib/python3.7/dist-packages/PIL/Image.py", line 2578, in new
    return im._new(core.fill(mode, size, color))
MemoryError

This IT8951 board is likely cursed: I toasted the origninal IT8951 board that the panel shipped with. I can't get it to work at all. I contacted waveshare and they sold me a new IT8951 board, but I think it might be misconfigured. It appears to be set for 1600x1200. When I run the waveshare provided code, instead of reporting 1200x825 when the code starts, it spits out 1600x1200.

Do you have any idea what's going on, or alternatively how I might be able to re-flash the firmware?

txoof commented 2 years ago

After a couple of reboots and reseating the GPIO headers, I can now get papertty to flash/wipe the screen on start, but I don't get anything to display. Indeed it reports a resolution of 1600x1200 though:

$ sudo papertty --driver it8951 terminal                            
Loading PIL font /usr/local/lib/python3.7/dist-packages/papertty/resources/tom-thumb.pil. Font size is ignored.
width = 1600
height = 1200
img_addr = 00119f00
firmware = SWv_0.1.
lut = M641
VCOM = -2.00V
Started displaying /dev/vcsa1, minimum update interval 0.1 s, exit with Ctrl-C
Font /usr/local/lib/python3.7/dist-packages/papertty/resources/tom-thumb.pbm doesn't support Unicode. Falling back to 8-bit encoding.

Any ideas for how to set the resolution properly would be greatly appreciate!

joukos commented 2 years ago

Hmm, well now that it at least reports the firmware version etc. and not some totally crazy values it sounds at least possible that it might work, but if you toasted the original board, I wonder if the panel also suffered there. The resolution is obviously wrong at least, so it's no wonder if nothing gets drawn.

Beyond ensuring that the power supply is adequate, SPI speed is not set to something too high, any jumpers on the board are set correctly and cables are nice and snug and don't mesh with power cables, I don't have very good ideas to suggest at the moment. Besides asking Waveshare, since their support is pretty helpful.

txoof commented 2 years ago

Thanks for the ideas. I think I need different firmware on the board. I appreciate the advice.