About st77xx.py

I tried using an LCD driver called st77xx.py on esp32 with spiram, but while running my program, my IDE threw an error like the following


These are the py programs I use(I’m curious why I can’t upload a py file)
boot.py.txt (430 Bytes)
st77xx.py.txt (19.1 KB)
And there is no change in the LCD display

Hello PCX-LK
The problem you have is not likely linked to LVGL. Make sure you can run regular Micropython code with Thonny + ESP32 before attempting to use LVGL.

Also I noticed your are using an Adafruit library. Those run on Circuitpython, not Micropython. There is not port of LVGL for Circuitpython. Make sure you understand the differences between Circuitpython and Micropython:

A bit of work is needed to run Adafruit libraries on Micropython, this link might help you, although is it targeted for RP2040 and not ESP32:

In general, If you want to provide snippets of your code on any technical forum, don´t post pictures of your code: it cannot be copy pasted, and nobody will go through the hassle of writing your code by hand to reproduce the problem. Same for incomplete, vague photos of your hardware: provides schematics, not a photo of half of your prototype !

Make sure you go through all the basics, step by step, and that you actually understand all the steps. Even if it looks slow, it´s the fastest way to reach your goal.

Hops this helps,

ACBIAS

Okay, thank you for taking the time to fix my low-level problems

I have a question, you mentioned that I used an “Adafruit library” and said that this library can only be used on CircuitPython, so why does this driver use this repository in the “lv_binding_micropython”. That makes me think it’s for MicroPython

You are right. Was lead me to write about Adafruit is when I had a look of the st7xx.py code, it contains several reference to Adafruit, but actually an Adafruit Board, not to Adafruit libraries.

So, forget what I wrote about circuitpython and Adafruit.

I think you problem comes from copy-pasting code in Thonny editor.
Go step by step, first commenting out anything related to LVGL, and check if your code throws any error.

Copy-paste your errors here (no photo!!) as well as your source as attachement.

Sorry again for the quick but inaccurate feedback

I also advice you, for debugging purposes, not to use the boot.py file but to rename it like boot-test.py : when Micropython finds a boot.py file it will execute it automatically at boot. This makes debugging quite difficult, preventing you sometimes to go step-by-step with the interpreter, then only saving your code as a file when it works.

When your project work, you can use the boot.py file, in order not to have to start your code manually every time.

raceback (most recent call last):
File “lv_utils.py”, line 123, in task_handler
File “/lib/st77xx.py”, line 442, in disp_drv_flush_cb
File “/lib/st77xx.py”, line 248, in blit
File “/lib/st77xx.py”, line 235, in set_window
KeyError: (128, 160, ‘greentab’)

boot-test.py.txt (434 Bytes)
st77xx.py.txt (19.1 KB)

No matter how I debug it, it still gets this error
The firmware I use can be found in the “build” branch of this repository

take the whole lgvl code away of your boot-test.py, does the SPI initalizing happen without error ?
if yes, then do some simple SPI checks to make sure your SPI bus works.
Also in the st77xx lib it´s clear that the greentab board is not supported, try the blacktab.

After testing, SoftSPI works fine
When I set ‘model’ to ‘blacktab’, there were no errors on the first run, but nothing changed on the LCD
The second time it runs, my board automatically restarts, which is the output of the IDE

Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x4015509d  PS      : 0x00060d30  A0      : 0x80136de4  A1      : 0x3ffd4070  
A2      : 0x0000003f  A3      : 0x00000001  A4      : 0x3ffd4090  A5      : 0x00001461  
A6      : 0xffffffff  A7      : 0x3ffc81a8  A8      : 0x000012cc  A9      : 0x00000000  
A10     : 0x00000001  A11     : 0x000011d0  A12     : 0x3f81b210  A13     : 0xffff3fff  
A14     : 0xff000000  A15     : 0x00000001  SAR     : 0x00000020  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x000012cc  LBEG    : 0x4015509d  LEND    : 0x401550c0  LCOUNT  : 0x0000003e  


Backtrace:0x4015509a:0x3ffd40700x40136de1:0x3ffd4090 0x401340c1:0x3ffd40d0 0x401331e5:0x3ffd40f0 0x40132ad3:0x3ffd4110 0x40152007:0x3ffd4130 0x40109b05:0x3ffd4160 0x401098d1:0x3ffd4180 0x400e4f61:0x3ffd41a0 0x400e50b2:0x3ffd41c0 0x400861b9:0x3ffd41e0 0x400dee44:0x3ffd4280 0x400e4f61:0x3ffd42b0 0x400e50b2:0x3ffd42d0 0x400861b9:0x3ffd42f0 0x400dee44:0x3ffd4390 0x400e4f61:0x3ffd43c0 0x400e50b2:0x3ffd43e0 0x400e39c6:0x3ffd4400 0x400e35f9:0x3ffd4450 0x400e4f61:0x3ffd4470 0x40086109:0x3ffd4490 0x400dee44:0x3ffd4530 0x400e4f61:0x3ffd4560 0x400e4f8a:0x3ffd4580 0x400f1772:0x3ffd45a0 0x400f19a2:0x3ffd4630 0x400d854a:0x3ffd4680 




ELF file SHA256: aee4e848f7e7e700

Rebooting...

@PCX-LK


@eudoxos - possibly greentab is missing from ST77XX_COL_ROW_MODEL_START_ROTMAP?

I tried to add the following to line 163 of ‘st77xx.py’

(128,160,'greentab'):[(0,0),(0,0),(0,0),(0,0)],

But when I run ‘boot-test.py’ again, I get the same result as this one

>>> %Run -c $EDITOR_CONTENT
Warning: the greentab model was never properly tested
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x40095750  PS      : 0x00060f30  A0      : 0x800dbc47  A1      : 0x3ffd42d0  
A2      : 0x3f81b9b0  A3      : 0x00000130  A4      : 0x00000010  A5      : 0x3f81b9b0  
A6      : 0x00000427  A7      : 0x00000001  A8      : 0x80000000  A9      : 0x3ffd42b0  
A10     : 0x3f81b9b0  A11     : 0x00000002  A12     : 0x000004d0  A13     : 0x3f81be80  
A14     : 0xffffffc0  A15     : 0x0000004d  SAR     : 0x00000010  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000130  LBEG    : 0x40095876  LEND    : 0x40095881  LCOUNT  : 0x00000000  


Backtrace:0x4009574d:0x3ffd42d00x400dbc44:0x3ffd42e0 0x400dbe30:0x3ffd4300 0x40154b07:0x3ffd4320 0x40133149:0x3ffd4340 0x40132acd:0x3ffd4360 0x40108d0d:0x3ffd4380 0x401098d1:0x3ffd43a0 0x400e4f61:0x3ffd43c0 0x400fda8c:0x3ffd43e0 0x400fde91:0x3ffd4410 0x400e35f9:0x3ffd4430 0x400e4f61:0x3ffd4450 0x400e50b2:0x3ffd4470 0x400861b9:0x3ffd4490 0x400dee44:0x3ffd4530 0x400e4f61:0x3ffd4560 0x400e4f8a:0x3ffd4580 0x400f1772:0x3ffd45a0 0x400f19a2:0x3ffd4630 0x400d854a:0x3ffd4680 




ELF file SHA256: aee4e848f7e7e700

Rebooting...

Maybe this help: https://github.com/heixiaoma/lv_st7789

@PCX-LK Could you parse the backtrace and send it here?

To parse the backtrace you can pass the the hex values to xtensa-esp32-elf-addr2line:

xtensa-esp32-elf-addr2line -aipfC -e ./ports/esp32/<Board>/application.elf 0x... ... ..

I can’t do this because my firmware was built using Github Action