V9 ili9341 & xpt2046 Guru Meditation Error

Using this code…

import lvgl as lv
from ili9XXX import ili9341
from xpt2046 import xpt2046

disp = ili9341(spihost=2, miso=19, mosi=23, clk=18, cs=15, dc=13, rst=0, backlight=27, mhz=10, factor=4, half_duplex=False, double_buffer=True, power_on=1, backlight_on=1) # half_duplex do not work with SDCard
touch = xpt2046(spihost=2, cs=5)

def button_cb(e):
    print("Clicked")

# Screen Objects
scr = lv.scr_act()
btn = lv.btn(scr)
btn.center()
btn.add_event(button_cb, lv.EVENT.CLICKED, None)
label = lv.label(btn)
label.set_text("CLICK Me")
lv.scr_load(scr)

After a ~ 2 minutes or a couple of touches, getting


Double buffer
ILI9341 initialization completed
Enable backlight
♦♦>
MicroPython v1.20.0-700-g841ece132-dirty on 2023-07-28; ESP32 module (spiram) with ESP32
Type "help()" for more information.
>>> 
>>> Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x40084b99  PS      : 0x00060630  A0      : 0x800de23b  A1      : 0x3ffdebe0  
A2      : 0x00000006  A3      : 0x00000ed2  A4      : 0x00000000  A5      : 0x00000006  
A6      : 0x003fffff  A7      : 0x00060823  A8      : 0x00000000  A9      : 0x3ffdebd0  
A10     : 0x3f81b400  A11     : 0x3f403c74  A12     : 0x3ffd2028  A13     : 0x0000026e  
A14     : 0x000003d6  A15     : 0x0000000c  SAR     : 0x0000001c  EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000006  LBEG    : 0x4009620e  LEND    : 0x40096219  LCOUNT  : 0x00000000  


Backtrace: 0x40084b96:0x3ffdebe0 0x400de238:0x3ffdec10 0x400ff90c:0x3ffdec30 0x40127f93:0x3ffdec60 0x401285d8:0x3ffdec80 0x4014076c:0x3ffdecd0 0x400fd7df:0x3ffded00 0x400fc233:0x3ffded20 0x40107895:0x3ffded40 0x400e55b6:0x3ffded60 0x400e5706:0x3ffded80 0x40086515:0x3ffdeda0 0x400df050:0x3ffdee40 0x400e55b6:0x3ffdee70 0x40121c52:0x3ffdee90 0x40121c85:0x3ffdeed0 0x400e55b6:0x3ffdeef0 0x400e56bf:0x3ffdef10 0x400e60ea:0x3ffdef40 0x400e6274:0x3ffdefc0 0x400d87be:0x3ffdefe0 0x400f1f9d:0x3ffdf000 0x400f280e:0x3ffdf020 0x400d855c:0x3ffdf060


xtensa-esp32-elf-addr2line...
0x40084b96: mp_map_lookup at /mnt/d/SmartLOG_V2/lv_micropython/py/map.c:156
0x400de238: mp_obj_dict_get at /mnt/d/SmartLOG_V2/lv_micropython/py/objdict.c:213
0x400ff90c: lv_indev_t_read_cb_callback at /mnt/d/SmartLOG_V2/lv_micropython/ports/esp32/build-GENERIC_SPIRAM/lv_mp.c:23211
0x40127f93: _lv_indev_read at /mnt/d/SmartLOG_V2/lv_micropython/lib/lv_bindings/lvgl/src/core/lv_indev.c:158
0x401285d8: lv_indev_read_timer_cb at /mnt/d/SmartLOG_V2/lv_micropython/lib/lv_bindings/lvgl/src/core/lv_indev.c:188
 (inlined by) lv_indev_read_timer_cb at /mnt/d/SmartLOG_V2/lv_micropython/lib/lv_bindings/lvgl/src/core/lv_indev.c:166
0x4014076c: lv_timer_exec at /mnt/d/SmartLOG_V2/lv_micropython/lib/lv_bindings/lvgl/src/misc/lv_timer.c:346
 (inlined by) lv_timer_handler at /mnt/d/SmartLOG_V2/lv_micropython/lib/lv_bindings/lvgl/src/misc/lv_timer.c:114
 (inlined by) lv_timer_handler at /mnt/d/SmartLOG_V2/lv_micropython/lib/lv_bindings/lvgl/src/misc/lv_timer.c:71
0x400fd7df: lv_task_handler at /mnt/d/SmartLOG_V2/lv_micropython/lib/lv_bindings/lvgl/src/lv_api_map.h:42
0x400fc233: mp_lv_task_handler at /mnt/d/SmartLOG_V2/lv_micropython/ports/esp32/build-GENERIC_SPIRAM/lv_mp.c:24037
0x40107895: lv_fun_builtin_var_call at /mnt/d/SmartLOG_V2/lv_micropython/ports/esp32/build-GENERIC_SPIRAM/lv_mp.c:103
0x400e55b6: mp_call_function_n_kw at /mnt/d/SmartLOG_V2/lv_micropython/py/runtime.c:695
0x400e5706: mp_call_method_n_kw at /mnt/d/SmartLOG_V2/lv_micropython/py/runtime.c:711
0x40086515: mp_execute_bytecode at /mnt/d/SmartLOG_V2/lv_micropython/py/vm.c:1042
0x400df050: fun_bc_call at /mnt/d/SmartLOG_V2/lv_micropython/py/objfun.c:278
0x400e55b6: mp_call_function_n_kw at /mnt/d/SmartLOG_V2/lv_micropython/py/runtime.c:695
0x40121c52: mp_call_method_self_n_kw at /mnt/d/SmartLOG_V2/lv_micropython/py/objboundmeth.c:70
0x40121c85: bound_meth_call at /mnt/d/SmartLOG_V2/lv_micropython/py/objboundmeth.c:83
0x400e55b6: mp_call_function_n_kw at /mnt/d/SmartLOG_V2/lv_micropython/py/runtime.c:695
0x400e56bf: mp_call_function_1 at /mnt/d/SmartLOG_V2/lv_micropython/py/runtime.c:673
0x400e60ea: mp_call_function_1_protected at /mnt/d/SmartLOG_V2/lv_micropython/py/runtime_utils.c:33
0x400e6274: mp_sched_run_pending at /mnt/d/SmartLOG_V2/lv_micropython/py/scheduler.c:110
 (inlined by) mp_handle_pending at /mnt/d/SmartLOG_V2/lv_micropython/py/scheduler.c:239
0x400d87be: mp_hal_stdin_rx_chr at /mnt/d/SmartLOG_V2/lv_micropython/ports/esp32/mphalport.c:103
0x400f1f9d: readline at /mnt/d/SmartLOG_V2/lv_micropython/shared/readline/readline.c:560
0x400f280e: pyexec_friendly_repl at /mnt/d/SmartLOG_V2/lv_micropython/shared/runtime/pyexec.c:610
0x400d855c: mp_task at /mnt/d/SmartLOG_V2/lv_micropython/ports/esp32/main.c:181
PS D:\SmartLOG_V2>

Does anything stand out ???

So I rebuit my BOARD=GENERIC_SPIRAM .bin
Uploaded, the same issue…

ALSO GET THIS SOMETIMES…

Traceback (most recent call last):
File “lv_utils.py”, line 124, in task_handler
KeyError: lv_indev_t_read_cb

Where to start ???

Changed to IDF 4.4 (from 4.4.5)

ESP32-WROVER-E-N4R8 4MB flash 8MB spiram

lv_micropython master

  • @file lv_conf.h
  • Configuration file for v9.0.0-dev

WSL Ubuntu version 20.04.6 LTS

micropython.mem_info()
stack: 704 out of 31744
GC: total: 4098240, used: 18048, free: 4080192
No. of 1-blocks: 336, 2-blocks: 26, max blk sz: 264, max free sz: 254376

esp.flash_size()
4194304

I have also tried on 2 esp32 modules.

Anyone ???

I’m not sure what is the problem but,

  • Does it happen with v8 as well? You can try building lv_micropython release/v8 and test it there.
  • Did you notice that there are two implementations of xpt2046? One ESP32 specific and the other is Micropython generic.
    Which one are you using? Did you try the other one?
  • There are also two implementations for ili9341 (esp specific and mp generic)

Using both ESP32 specific.
The defaut build drivers for ESP32.
I am updating a large project from 1.17 and v8 and like to use the lastest 1.20 / v9.

My 1st build failed because partitions.csv factory was not large enough for the 2.1MB build !!!
How does anyone do OTA with that (they don’t).
The next I have to do is start throwing modules overboard…
lv_micropython/lib/lv_bindings/lv_conf.h
lv_micropython/py/mpconfig.h
lv_micropython/ports/esp32/mpconfigport.h

Newcomers to lv_micropython are going to be overwhelmed and spend days if not weeks just to see there simple button code work.

Should be able to compile without any tweaks.